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.安裝FTP,通常都是經過FTP來下載軟件包.
安裝好後啓動它.
2.如今進行拷貝文件.
把光盤裏的全部文件都拷貝到/var/ftp/pub/下面.實際上只拷貝Server 和VT兩個文件過去就好了,還能夠不用把所有RPM安裝軟件包拷貝過去,太多了,一共2.4G左右,若是系統一開始安裝分配給var的空間不夠就能夠這樣作.
完成後切換到/var/ftp/pub/目錄下
刪除*.html
刪除Server/repodata/TRANS.TBL
刪除VT/repodata/TRANS.TBL
以上是建議刪除的,不刪除也能夠.
進去後添加以下內容.注意看清了內容很相似.
配置文件內容簡介:
[ ]內的是倉庫的名字
name倉庫的描述
baseurl 是你的YUM源地址,由於這裏配置的是FTP,還能夠是HTTP,FILE等
enabled 是否啓用這個倉庫,1爲起用,0爲禁用
gpgcheck 是否檢查GPG簽名(用來驗證要安裝的包是否是REDHAT官方的)
GPGKEY 的存放地址須要用下面的命令到入這個簽名。才能使用這項功能
三.配置服務器
安裝createrepo工具,而後用這個工具生成YUM通用數據庫.
可看到一個是安裝,兩個操做,很相似的.也能夠看到是成功的.
這樣就OK下
四.下面看下yum的命令和進行測試.
1. yum install <package> 這裏是安裝下載的軟件包,因爲本實驗沒有提供FTP下載.
2.yum localinstall <package> 本地安裝軟件包,在這裏本服務器作YUM源.看個例子.
[root@rhel5 /]# 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@rhel5 /]# 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@rhel5 /]# 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@rhel5 /]# 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* .
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.
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.
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* .
10.yum remove | erase package1 刪除程序包
[root@rhel5 /]# 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@rhel5 /]#
yum 會把下載的軟件包和header存儲在cache中,而不會自動刪除。若是以爲它們佔用了磁盤空間,可使用yum clean指令進行清除.yum clean headers清除headeryum clean packages清除下載的rpm包yum clean all 清除header與rpm包 基本完成,呵呵.