如何讓新建立的虛擬機器可以安裝官方軟體?(yum倉庫的簡單搭建)
阿新 • • 發佈:2018-11-08
如何讓新建立的虛擬機器可以安裝官方軟體 ?
雖然虛擬機器也是用映象封裝的,但是安裝虛擬機器時只下載了映象裡的部分安裝包 還有好多安裝包並沒有下載
我們可以把映象光碟匯入虛擬機器,以通過搭建yum倉庫,來下載映象裡沒有下載的其他安裝包
@1匯入光碟
注意:匯入之前,必須先關機(force off),這樣才能生效
@2掛載
[[email protected] ~]# df
[[email protected] ~]# mkdir /rhel7.2
[[email protected] ~]# mount /dev/sr1 /rhel7.2
[ [email protected] ~]# df
@3.設定系統安裝源指向
[[email protected] ~]# cd /etc/yum.repos.d/ [[email protected] yum.repos.d]# ls redhat.repo ##以.repo結尾的檔名均可 [[email protected] yum.repos.d]# vim rhel.repo ################## [rhel7.2] #名字 name=rhel7.2 #說明 baseurl=file:///rhel7.2 #file:// 表示本地檔案 gpgcheck=0 #0表示安裝軟體時無需檢測(1代表需要檢測)
[[email protected] yum.repos.d]# cd
##清空快取
[[email protected] ~]# yum clean all
##列出yum源的詳細資訊
[[email protected] ~]# yum repolist
測試:
##安裝hdcp服務
[[email protected] ~]# yum install -y dhcp
@@也可以匯入光碟後無需掛載,直接編寫檔案
##重啟後之前的掛載便會失效,因為是臨時掛載
[[email protected] ~]# reboot
[[email protected] ~]# df
[[email protected] ~]# cd /etc/yum.repos.d/
[[email protected] yum.repos.d]# ls
redhat.repo rhel.repo
[[email protected] yum.repos.d]# vim rhel.repo
#############################
[rhel7.2] #倉庫名稱
name=hello word! #說明
baseurl=file:///run/media/root/RHEL-7.2\ Server.x86_64 #file://表示本地檔案; /run/media/root/RHEL-7.2\ Server.x86_64 為映象檔案的掛載點
gpgcheck=0 #安裝軟體時不檢測
##清空快取
[[email protected] yum.repos.d]# yum clean all
##列出yum源的詳細資訊
[[email protected] yum.repos.d]# yum repolist