Yum的概述
Yum(全称为 Yellow dog Updater, Modified)是一个在Fedora中的shell前端软件包管理器。基于rpm包管理,能够从指定的服务器自动下载RPM包并且安装,可以自动处理依赖性关系,并且一次安装所有依赖的软体包,无须繁琐地一次次下载、安装。
软体包来源
可供Yum下载的软体包包括fedora 本身的软体包以及源自rpm.livna.org的Fedora Extras,全部是由Linux社区维护的,并且基本是自由软体。所有的包都有一个独立的GPG签名,主要是为了你的系统安全。而对于Fedora core 4.0 的用户,rpm.livna.org 的签名是自动导入并安装的。
图形化前端
Yum的图形化前端主要有yumex和kyum。它们并不是独立于Yum的,而是Yum的图形前端,也就是说在安装和使用Yumex和kyum同时,都是以Yum的安装和配置为基础;所以在用Yumex或kyum 时,必须先安装配置Yum。
1.准备工作
(1)安装ftp
[root@localhost ~]#cd /mnt/cdrom/Server
[root@localhost ~]#rpm –ivh vsftp-2.0.5-10……
(2)启动ftp
[root@localhost ~]# service vsftpd restart
关闭 vsftpd: [失败]
为 vsftpd 启动 vsftpd: [确定]
2.现在进行拷贝文件.
把光盘里的所有文件都拷贝到/var/ftp/pub/下面.实际上只拷贝Server 和VT两个文件过去就行了,还可以不用把全部RPM安装软件包拷贝过去,太多了,一共2.4G左右,如果系统一开始安装分配给var的空间不够就可以这样做.
完成后切换到/var/ftp/pub/目录下
删除*.html
删除Server/repodata/TRANS.TBL
删除VT/repodata/TRANS.TBL
以上是建议删除的,不删除也可以.
二.配置客户端
[root@rhel5 ~]#vim /etc/yum.rhel –debuginfo.repo
进去后添加如下内容.注意看清了内容很类似.
配置文件内容简介:
[ ]内的是仓库的名字
name仓库的描述
baseurl 是你的YUM源地址,因为这里配置的是FTP,还可以是HTTP,FILE等
enabled 是否启用这个仓库,1为起用,0为禁用
gpgcheck 是否检查GPG签名(用来验证要安装的包是不是REDHAT官方的)
GPGKEY 的存放地址需要用下面的命令到入这个签名。才能使用这项功能
root@localhost ~]# rpm -import /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-
三.配置服务器
安装createrepo工具,然后用这个工具生成YUM通用数据库.
四.下面看下yum的命令和进行测试.
1. yum install <package> 这里是安装下载的软件包,由于本实验没有提供FTP下载.
2.yum localinstall <package> 本地安装软件包,在这里本服务器做YUM源.看个例子.
[root@ localhost /]# yum localinstall /var/ftp/pub/Server/dhcp*
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-3.el5.i386.rpm: dhcp - 12:3.0.5-3.el5.i386
Examining /var/ftp/pub/Server/dhcp-devel-3.0.5-3.el5.i386.rpm: dhcp-devel - 12:3.0.5-3.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-3.el5.i386.rpm to be installed
Setting up repositories
Reading repository metadata in from local files
Marking /var/ftp/pub/Server/dhcp-devel-3.0.5-3.el5.i386.rpm to be installed
Setting up repositories
Reading repository metadata in from local files
Marking /var/ftp/pub/Server/dhcpv6-0.10-33.el5.i386.rpm to be installed
Setting up repositories
Reading repository metadata in from local files
Marking /var/ftp/pub/Server/dhcpv6_client-0.10-33.el5.i386.rpm to be installed
Setting up repositories
Reading repository metadata in from local files
Resolving Dependencies
--> Populating transaction set with selected packages. Please wait.
---> Package dhcp.i386 12:3.0.5-3.el5 set to be updated
---> Package dhcpv6.i386 0:0.10-33.el5 set to be updated
---> Package dhcpv6_client.i386 0:0.10-33.el5 set to be updated
---> Package dhcp-devel.i386 12:3.0.5-3.el5 set to be updated
--> Running transaction check
Dependencies Resolved
=============================================================================
Package Arch Version Repository Size
=============================================================================
Installing:
dhcp i386 12:3.0.5-3.el5 /var/ftp/pub/Server/dhcp-3.0.5-3.el5.i386.rpm 2.1 M
dhcp-devel i386 12:3.0.5-3.el5 /var/ftp/pub/Server/dhcp-devel-3.0.5-3.el5.i386.rpm 1.4 M
dhcpv6 i386 0.10-33.el5 /var/ftp/pub/Server/dhcpv6-0.10-33.el5.i386.rpm 759 k
dhcpv6_client i386 0.10-33.el5 /var/ftp/pub/Server/dhcpv6_client-0.10-33.el5.i386.rpm 161 k
Transaction Summary
=============================================================================
Install 4 Package(s)
Update 0 Package(s)
Remove 0 Package(s)
Total download size: 4.4 M
Is this ok [y/N]: y
Downloading Packages:
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing: dhcp ######################### [1/4]
Installing: dhcpv6 ######################### [2/4]
Installing: dhcpv6_client ######################### [3/4]
Installing: dhcp-devel ######################### [4/4]
Installed: dhcp.i386 12:3.0.5-3.el5 dhcp-devel.i386 12:3.0.5-3.el5 dhcpv6.i386 0:0.10-33.el5 dhcpv6_client.i386 0:0.10-33.el5
Complete!
[root@rhel5 /]#
3.yum update ---------
à全部更新
[root@ localhost /]# yum update
Loading "rhnplugin" plugin
Loading "installonlyn" plugin
This system is not registered with RHN.
RHN support will be disabled.
Setting up Update Process
Setting up repositories
Reading repository metadata in from local files
No Packages marked for Update/Obsoletion
4.yum update package --------
à更新指定程序包package
5.yum check-update
[root@ localhost /]# yum check-update
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 filesck-update
6.yum info <package>-------
à 显示安装包信息
7.yum list ----------
à显示所有已经安装和可以安装的程序包
8.yum list <package> --------
à显示指定程序包安装情况
9.yum search <keyword>--------
à查找软件包
[root@ localhost /]# yum search "dhcp*"
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
dhcpv6_client.i386 0.10-33.el5 installed
Matched from:
dhcpv6_client
DHCPv6 client
Provides the client for the DHCPv6 protocol (RFC 3315) to support
dynamic configuration of IPv6 addresses and parameters.
See man dhcp6c(8), dhcp6c.conf(5), and the documentation in
/usr/share/dhcpv6_client* .
[url]http://dhcpv6.sourceforge.net/[/url]
dhcp-devel.i386 12:3.0.5-3.el5 installed
Matched from:
dhcp-devel
Development headers and libraries for interfacing to the DHCP server
Libraries for interfacing with the ISC DHCP server.
[url]http://isc.org/products/DHCP/[/url]
dhcp.i386 12:3.0.5-3.el5 installed
Matched from:
dhcp
A DHCP (Dynamic Host Configuration Protocol) server and relay agent.
DHCP (Dynamic Host Configuration Protocol) is a protocol which allows
individual devices on an IP network to get their own network
configuration information (IP address, subnetmask, broadcast address,
etc.) from a DHCP server. The overall purpose of DHCP is to make it
easier to administer a large network. The dhcp package includes the
ISC DHCP service and relay agent.
To use DHCP on your network, install a DHCP service (or relay agent),
and on clients run a DHCP client daemon. The dhcp package provides
the ISC DHCP service and relay agent.
[url]http://isc.org/products/DHCP/[/url]
dhcpv6.i386 0.10-33.el5 installed
Matched from:
dhcpv6
DHCPv6 - DHCP server and client for IPv6
Implements the Dynamic Host Configuration Protocol (DHCP) for
Internet Protocol version 6 (IPv6) networks in accordance with
RFC 3315 : Dynamic Host Configuration Protocol for IPv6 (DHCPv6).
Consists of dhcp6s(8), the server DHCP daemon, and dhcp6r(8),
the DHCPv6 relay agent.
Install this if you want to support dynamic configuration of
IPv6 addresses and parameters on your IPv6 network.
See man dhcp6s(8), dhcp6r(8), dhcp6s.conf(5),
and the documentation in /usr/share/doc/dhcpv6* .
[url]http://dhcpv6.sourceforge.net/[/url] localhost /]#
[root@
10.yum remove | erase package1 删除程序包
[root@ localhost /]# yum remove "dhcp*"
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-3.el5 set to be erased
---> Package dhcpv6.i386 0:0.10-33.el5 set to be erased
---> Package dhcpv6_client.i386 0:0.10-33.el5 set to be erased
---> Package dhcp-devel.i386 12:3.0.5-3.el5 set to be erased
--> Running transaction check
Dependencies Resolved
=============================================================================
Package Arch Version Repository Size
=============================================================================
Removing:
dhcp i386 12:3.0.5-3.el5 installed 2.1 M
dhcp-devel i386 12:3.0.5-3.el5 installed 1.4 M
dhcpv6 i386 0.10-33.el5 installed 759 k
dhcpv6_client i386 0.10-33.el5 installed 161 k
Transaction Summary
=============================================================================
Install 0 Package(s)
Update 0 Package(s)
Remove 4 Package(s)
Is this ok [y/N]: y
Downloading Packages:
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Removing : dhcp ######################### [1/4]
Removing : dhcpv6 ######################### [2/4]
Removing : dhcpv6_client ######################### [3/4]
Removing : dhcp-devel ######################### [4/4]
Removed: dhcp.i386 12:3.0.5-3.el5 dhcp-devel.i386 12:3.0.5-3.el5 dhcpv6.i386 0:0.10-33.el5 dhcpv6_client.i386 0:0.10-33.el5
Complete!
[root@ localhost /]#
yum 会把下载的软件包和header存储在cache中,而不会自动删除。如果觉得它们占用了磁盘空间,可以使用yum clean指令进行清除.
yum clean headers清除header
yum clean packages清除下载的rpm包
yum clean all 清除header与rpm包