一、YUM客户端及服务器的配置
yum,是Yellow dog Updater Modified的简称,起初是由yellow dog这一发行版的开发者Terra Soft研发,那时还叫做yup(yellow dog updater),后经杜克大学的开发团队进行改进,遂有此名。yum的关键之处是要有可靠的repository,顾名思义,这是软件的仓库,它可以是http或ftp站点,也可以是本地软件池,但必须包含rpm的header,header包括了rpm包的各种信息,包括描述,功能,提供的文件,依赖性等.正是收集了这些 header并加以分析,才能自动化地完成余下的任务
二、下面我们开始配置服务器。
(1)挂载CD-ROM并安装VSFTPD。(前提是讲RHEL的带RPM包的安装盘放进虚拟CD-ROM)
(2)安装成功以后,把光盘里所有的文件拷贝到 /var/ftp/pub 目录里
cp -rv ../* /var/ftp/pub
(3)切换到 /var/ftp/pub目录
删除*.html
删除Server/repodata/TRANS.TBL
删除VT/repodata/TRANS.TBL
如果你不删除以上文件也可能成功,但是也有可能出现意想不到的问题。建议删除
rm -f *.html
rm -f Server/repodata/TRANS.TBL rm -f VT/repodata/TRANS.TBL(4)安装createrepo工具,然后用这个工具生成YUM通用数据库,记住使用TAB补全路径和命令。
[root@rhel5 Server]# rpm -ivh createrepo-0.4.4-2.fc6.noarch.rpm
[root@rhel5 Server]# createrepo -g /var/ftp/pub/Server/repodata/comps-rhel5-server-core.xml /var/ftp/pub/Server/
[root@rhel5 Server]# createrepo -g /var/ftp/pub/VT/repodata/comps-rhel5-vt.xml /var/ftp/pub/VT/
(5)然后从新启动FTP 服务:service vsftpd restart
到此基本大功告成,下面我们进行测试:
安装
yum install package 安装指定的安装包package1[root@rhel5 Server]# yum install telnet*
Loading "security" plugin Loading "rhnplugin" plugin Loading "installonlyn" plugin This system is not registered with RHN. RHN support will be disabled. Setting up Install Process Setting up repositories rhel-debuginfo 100% |=========================| 1.1 kB 00:00 Reading repository metadata in from local files primary.xml.gz 100% |=========================| 9.5 kB 00:00 ################################################## 31/31 Parsing package install arguments Examining telnet-0.17-38.el5.i386.rpm: telnet - 1:0.17-38.el5.i386 telnet-0.17-38.el5.i386.rpm: does not update installed package. Examining telnet-server-0.17-38.el5.i386.rpm: telnet-server - 1:0.17-38.el5.i386 Marking telnet-server-0.17-38.el5.i386.rpm to be installed Resolving Dependencies --> Populating transaction set with selected packages. Please wait. ---> Package telnet-server.i386 1:0.17-38.el5 set to be updated --> Running transaction check --> Processing Dependency: xinetd for package: telnet-server --> Finished Dependency Resolution Error: Missing Dependency: xinetd is needed by package telnet-server [root@rhel5 Server]# yum install xinetd Loading "security" plugin Loading "rhnplugin" plugin Loading "installonlyn" plugin This system is not registered with RHN. RHN support will be disabled. Setting up Install Process Setting up repositories Reading repository metadata in from local files Parsing package install arguments No Match for argument: xinetd Nothing to do [root@rhel5 Server]# ls |grep xinetd xinetd-2.3.14-10.el5.i386.rpm [root@rhel5 Server]# rpm -ivh xinetd-2.3.14-10.el5.i386.rpm Preparing... ########################################### [100%] 1:xinetd ########################################### [100%] [root@rhel5 Server]# yum install telnet* Loading "security" plugin Loading "rhnplugin" plugin Loading "installonlyn" plugin This system is not registered with RHN. RHN support will be disabled. Setting up Install Process Setting up repositories Reading repository metadata in from local files Parsing package install arguments Examining telnet-0.17-38.el5.i386.rpm: telnet - 1:0.17-38.el5.i386 telnet-0.17-38.el5.i386.rpm: does not update installed package. Examining telnet-server-0.17-38.el5.i386.rpm: telnet-server - 1:0.17-38.el5.i386 Marking telnet-server-0.17-38.el5.i386.rpm to be installed Resolving Dependencies --> Populating transaction set with selected packages. Please wait. ---> Package telnet-server.i386 1:0.17-38.el5 set to be updated --> Running transaction checkDependencies Resolved
=============================================================================
Package Arch Version Repository Size ============================================================================= Installing: telnet-server i386 1:0.17-38.el5 telnet-server-0.17-38.el5.i386.rpm 49 kTransaction Summary
============================================================================= Install 1 Package(s) Update 0 Package(s) Remove 0 Package(s)Total download size: 49 k
Is this ok [y/N]: yy,就开始安装了
Downloading Packages:
Running Transaction Test Finished Transaction Test Transaction Test Succeeded Running Transaction Installing: telnet-server ######################### [1/1]Installed: telnet-server.i386 1:0.17-38.el5
Complete! [root@rhel5 Server]# yum localinstall package 本地安装软件包[root@rhel5 ~]# yum localinstall /var/ftp/pub/Server/dhcp*
Loading "security" plugin Loading "rhnplugin" plugin Loading "installonlyn" plugin This system is not registered with RHN. RHN support will be disabled. Setting up Local Package Process Examining /var/ftp/pub/Server/dhcp-3.0.5-7.el5.i386.rpm: dhcp - 12:3.0.5-7.el5.i386 Examining /var/ftp/pub/Server/dhcp-devel-3.0.5-7.el5.i386.rpm: dhcp-devel - 12:3.0.5-7.el5.i386 Examining /var/ftp/pub/Server/dhcpv6-0.10-33.el5.i386.rpm: dhcpv6 - 0.10-33.el5.i386 Examining /var/ftp/pub/Server/dhcpv6_client-0.10-33.el5.i386.rpm: dhcpv6_client - 0.10-33.el5.i386 Marking /var/ftp/pub/Server/dhcp-3.0.5-7.el5.i386.rpm to be installed Setting up repositories rhel-debuginfo 100% |=========================| 1.1 kB 00:00 Reading repository metadata in from local files Marking /var/ftp/pub/Server/dhcp-devel-3.0.5-7.el5.i386.rpm to be installed Marking /var/ftp/pub/Server/dhcpv6-0.10-33.el5.i386.rpm to be installed /var/ftp/pub/Server/dhcpv6_client-0.10-33.el5.i386.rpm: does not update installed package. Resolving Dependencies --> Populating transaction set with selected packages. Please wait. --> Package dhcpv6.i386 0:0.10-33.el5 set to be updated --> Package dhcp-devel.i386 12:3.0.5-7.el5 set to be updated --> Package dhcp.i386 12:3.0.5-7.el5 set to be updated --> Running transaction checkDependencies Resolved
=============================================================================
Package Arch Version Repository Size ============================================================================= Installing: dhcp i386 12:3.0.5-7.el5 /var/ftp/pub/Server/dhcp-3.0.5-7.el5.i386.rpm 2.1 M dhcp-devel i386 12:3.0.5-7.el5 /var/ftp/pub/Server/dhcp-devel-3.0.5-7.el5.i386.rpm 1.4 M dhcpv6 i386 0.10-33.el5 /var/ftp/pub/Server/dhcpv6-0.10-33.el5.i386.rpm 759 kTransaction Summary
============================================================================= Install 3 Package(s) Update 0 Package(s) Remove 0 Package(s)Total download size: 4.2 M
Is this ok [y/N]: y Downloading Packages: Running Transaction Test Finished Transaction Test Transaction Test Succeeded Running Transaction Installing: dhcp ######################### [1/3] Installing: dhcpv6 ######################### [2/3] Installing: dhcp-devel ######################### [3/3]Installed: dhcp.i386 12:3.0.5-7.el5 dhcp-devel.i386 12:3.0.5-7.el5 dhcpv6.i386 0:0.10-33.el5
Complete! You have new mail in /var/spool/mail/root [root@rhel5 ~]#更新和升级
yum update 全部更新yum check-update 检查可更新的程序
查找和显示
yum info <package> 显示安装包信息[root@rhel5 ~]# yum info dhcp
Loading "security" plugin Loading "rhnplugin" plugin Loading "installonlyn" plugin This system is not registered with RHN. RHN support will be disabled. Setting up repositories Reading repository metadata in from local files Installed Packages Name : dhcp Arch : i386 Epoch : 12 Version: 3.0.5 Release: 7.el5 Size : 2.1 M Repo : installed yum list <package> 显示指定程序包安装情况yum search <keyword>查找软件包
[root@rhel5 ~]# yum search dhc
Loading "security" plugin Loading "rhnplugin" plugin Loading "installonlyn" plugin This system is not registered with RHN. RHN support will be disabled. Setting up repositories Reading repository metadata in from local filesdhclient.i386 12:3.0.5-7.el5 installed
Matched from: dhclient dhcdbd.i386 2.2-1.el5 installed Matched from: dhcdbd删除程序
yum remove | erase package1 删除程序包[root@rhel5 ~]# yum remove dhcp
Loading "security" plugin Loading "rhnplugin" plugin Loading "installonlyn" plugin This system is not registered with RHN. RHN support will be disabled. Setting up Remove Process Resolving Dependencies --> Populating transaction set with selected packages. Please wait. --> Package dhcp.i386 12:3.0.5-7.el5 set to be erased --> Running transaction check Setting up repositories Reading repository metadata in from local files --> Processing Dependency: dhcp = 12:3.0.5 for package: dhcp-devel --> Restarting Dependency Resolution with new changes. --> Populating transaction set with selected packages. Please wait. --> Package dhcp-devel.i386 12:3.0.5-7.el5 set to be erased --> Running transaction checkDependencies Resolved
=============================================================================
Package Arch Version Repository Size ============================================================================= Removing: dhcp i386 12:3.0.5-7.el5 installed 2.1 M Removing for dependencies: dhcp-devel i386 12:3.0.5-7.el5 installed 1.4 MTransaction Summary
============================================================================= Install 0 Package(s) Update 0 Package(s) Remove 2 Package(s)Is this ok [y/N]: y
Downloading Packages: Running Transaction Test Finished Transaction Test Transaction Test Succeeded Running Transaction Removing : dhcp-devel ######################### [1/2] Removing : dhcp ######################### [2/2]Removed: dhcp.i386 12:3.0.5-7.el5
Dependency Removed: dhcp-devel.i386 12:3.0.5-7.el5 Complete! [root@rhel5 ~]#yum 会把下载的软件包和header存储在cache中,而不会自动删除。如果我们觉得它们占用了磁盘空间,可以使用yum clean指令进行清除.
yum clean headers 清除headeryum clean packages 清除下载的rpm包
yum clean all 清除header与rpm包