YUM簡介:。YUM = Yellow dog Updater, Modified,主要功能是方便RPM包的添加、刪除及更新,它能自動解決包的倚賴性問題,可以同時配置多個資源庫(Repository), yum的關鍵之處是要有可靠的repository,顧名思義,就是軟件的倉庫,它可以是http或ftp站點,也可以是本地軟件池,但必須包含rpm的header,header包括了rpm包的各種信息,包括描述,功能,提供的文件,依賴性等
YUM配置:YUM準備工作及服務器的配置
3、切換到 /yumroot目錄
4、安裝createrepo工具,然後用這個工具生成YUM通用數據庫
[root@redfeng1 yumroot]# createrepo -g /yumroot/Server/repodata/comps-rhel5-server-core.xml /yumroot/Server/
[root@redfeng1 yumroot]# createrepo -g /yumroot/VT/repodata/comps-rhel5-server-core.xml /yumroot/VT/
YUM客戶端的配置
[root@redfeng1 yumroot]# createrepo -g /yumroot/Server/repodata/comps-rhel5-server-core.xml /yumroot/Server/
[root@redfeng1 yumroot]# createrepo -g /yumroot/VT/repodata/comps-rhel5-server-core.xml /yumroot/VT/
YUM客戶端的配置
Linux YUM配置信息都儲存在一個叫yum.conf的配置文件中,通常位於/etc目錄下, 具體內容如下:
[root@redfeng1 ~]# vi /etc/yum.conf
[main] //YUM服務器主配置文件
cachedir=/var/cache/yum //Linux YUM配置緩存的目錄
keepcache=0
debuglevel=2 //除錯級別,0-10,默認是2
logfile=/var/log/yum.log //日誌文件
distroverpkg=redhat-release//指定一個軟件包,根據這個包判斷你的發行版本,默認是redhat-release
tolerant=1 //有兩個選項 0 和1
exactarch=1 //有兩個選項 0 和1
obsoletes=1
gpgcheck=1
plugins=1
# Note: yum-RHN-plugin doesn't honor this.
metadata_expire=1h
# Default.
# installonly_limit = 3
# PUT YOUR REPOS HERE OR IN separate files named file.repo
# in /etc/yum.repos.d
另外在/etc/yum.repo.d/目錄下存放着的是YUM的服務器配置,所有服務器都應該遵循如下格式,這是整個Linux YUM配置系統的重中之重
[root@redfeng1 ~]# cat /etc/yum.repos.d/rhel-debuginfo.repo
[Server] //用於區別各個不同的資源庫,必須獨一無二
name=Red Hat Enterprise Linux //對資源庫進行描述
baseurl=file:///yumroot/Server //倉庫的位置,對於本地資源庫必須這樣寫
enabled=1 //是否啓用這個倉庫,1爲起用,0爲禁用
gpgcheck=1 //是否檢查GPG簽名(用來驗證要安裝的包是不是REDHAT官方的)
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release//存放簽名地址
[VT]
name=Red Hat Enterprise Linux
baseurl=file:///yumroot/VT
enabled=1
gpgcheck=1
YUM測試
YUM測試
到此爲止YUM的相關配置基本完成,下面進行YUM測試:
[root@redfeng1 ~]#yum [option] [工作項目] [軟件]
Option,主要的參數包括:
--installroot=/some/path:選擇安裝路徑
-Y:當YUM詢問用戶的意見時,主動回答yes而不需要用戶輸入
工作項目]包括以下幾個:
Install :指定安裝的軟件名稱
Update :進行軟件的升級
Remove :移除某個軟件
Clean :清除下載到/var/cache/yum/的項目
packages|headers|metadata|cache
List :列出目前YUM所管理的所有軟件的名稱與版本
Install :指定安裝的軟件名稱
Update :進行軟件的升級
Remove :移除某個軟件
Clean :清除下載到/var/cache/yum/的項目
packages|headers|metadata|cache
List :列出目前YUM所管理的所有軟件的名稱與版本
Groupinstall :組安裝