【Linux】Linux軟體安裝管理2 使用安裝光碟配置本地yum倉庫

海星星hktk發表於2016-01-13
Linux軟體安裝管理2 
使用安裝光碟配置本地yum倉庫



配置yum使用yum可以更好地解決軟體包之間依賴關係
OS:RHEL6.4 - 64bit



1 重新掛載光碟到指定目錄
光碟載入到光碟機後預設掛載點(訪問入口)為 /media/RHEL_6.4 x86_64 Disc 1
路徑中包含空格,不方便使用。

建立目錄 作為新掛載點 (訪問光碟的入口)
[root@rhel64 ~]# mkdir /mnt/dvd
[root@rhel64 ~]# ls -ld /mnt/dvd


檢視光碟對應裝置名稱   /dev/sr0
[root@rhel64 ~]# df -Th


掛載光碟到新建的掛載點

[root@rhel64 ~]# mount /dev/sr0 /mnt/dvd
[root@rhel64 ~]# df -Th


使用新掛載點即可訪問光碟中檔案
[root@rhel64 ~]# ls /mnt/dvd


[root@rhel64 ~]# cd /mnt/dvd/Server/
[root@rhel64 Server]# ll


/mnt/dvd/Server  是配置yum倉庫要用到的路徑




2 檢視並編寫配置檔案

[root@rhel64 ~]# cd /etc/yum.repos.d/
[root@rhel64 yum.repos.d]# ll


[root@rhel64 yum.repos.d]# cat rhel-source.repo


配置檔案目錄 /etc/yum.repos.d/
配置檔名稱 file.repo              以.repo為字尾
檔案內容格式:
[repo name]           唯一的repo名稱
name=               自定義名稱
baseurl=              rpm包對應repodata目錄(後設資料)所在路徑  路徑格式: ftp://dir 或 http://dir  或 file://dir
gpgcheck=            0 不檢查包來源(練習環境)    1 檢查(生產環境通常要檢查)
enabled=              0 不啟用               預設:1 啟用      
gpgkey=


編輯配置檔案,在最後追加寫入內容  baseurl中file表示及本地檔案,第三個/表示 根目錄

[root@rhel64 yum.repos.d]# cp rhel-source.repo rhel-source.repo.bak
[root@rhel64 yum.repos.d]# vi rhel-source.repo
[rhel64]

name=rhel64 repo
baseurl=file:///mnt/dvd/Server
gpgcheck=0

[root@rhel64 yum.repos.d]# tail -5 rhel-source.repo


3 yum 命令
[root@rhel64 ~]# yum clean all



yum list 列出所有軟體包
[root@rhel64 ~]# yum list
[root@rhel64 ~]# yum list | grep zsh


4 yum info 檢視軟體包資訊
[root@rhel64 ~]# yum info zsh


5 yum install 安裝軟體包

[root@rhel64 ~]# yum install zsh


[root@rhel64 ~]# yum info zsh


6 yum remove 刪除軟體包

[root@rhel64 ~]# yum remove zsh


[root@rhel64 ~]# yum info zsh



呂星昊
2016.1.13


來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29475508/viewspace-1976055/,如需轉載,請註明出處,否則將追究法律責任。

相關文章