RHEL5.4学习总结——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!