RHEL5.4學習總結——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測試:
[root@redfeng1 ~]#yum [option] [工作項目] [軟件]
Option,主要的參數包括:
--installroot=/some/path:選擇安裝路徑
-Y:當YUM詢問用戶的意見時,主動回答yes而不需要用戶輸入
工作項目]包括以下幾個:
Install :指定安裝的軟件名稱
Update :進行軟件的升級
Remove :移除某個軟件
Clean :清除下載到/var/cache/yum/的項目
packages|headers|metadata|cache
List :列出目前YUM所管理的所有軟件的名稱與版本
Groupinstall :組安裝
安裝vsftpd
[root@redfeng1 ~]# yum install vsftpd*
Loaded plugins: rhnplugin, security
This system is not registered with RHN.
RHN support will be disabled.
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package vsftpd.i386 0:2.0.5-16.el5 set to be updated
Server/filelists | 2.4 MB 00:00
VT/filelists | 27 kB 00:00
--> Finished Dependency Resolution
Dependencies Resolved
==============================================================================================================================================
Package Arch Version Repository Size
==============================================================================================================================================
Installing:
vsftpd i386 2.0.5-16.el5 Server 140 k
Transaction Summary
==============================================================================================================================================
Install 1 Package(s)
Update 0 Package(s)
Remove 0 Package(s)
Total download size: 140 k
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : vsftpd 1/1
Installed:
vsftpd.i386 0:2.0.5-16.el5
Complete!