yum localinstall 解決本地rpm包的依賴問題
這次本想記錄一個yum的特殊用法,沒想到找了一個yum這麼全的說明。
先說說那個特殊用法吧
[[email protected] linux]$ rpm -ivh VirtualBox-3.1-3.1.0_55467_fedora12-1.i686.rpmwarning: VirtualBox-3.1-3.1.0_55467_fedora12-1.i686.rpm: Header V4 DSA signature: NOKEY, key ID 6dfbcbae
error: Failed dependencies:
libQtCore.so.4 is needed by VirtualBox-3.1-3.1.0_55467_fedora12-1.i686
libQtGui.so.4 is needed by VirtualBox-3.1-3.1.0_55467_fedora12-1.i686
libQtNetwork.so.4 is needed by VirtualBox-3.1-3.1.0_55467_fedora12-1.i686
libQtOpenGL.so.4 is needed by VirtualBox-3.1-3.1.0_55467_fedora12-1.i686
發現缺少依賴包,咋整?
於是乎
[[email protected] linux]# yum localinstall VirtualBox-3.1-3.1.0_55467_fedora12-1.i686.rpm
來安裝,需要的rpm包也下載完成了,只是最後提示
warning: rpmts_HdrFromFdno: Header V4 DSA signature: NOKEY, key ID 6dfbcbae
VirtualBox-3.1-3.1.0_55467_fedora12-1.i686.rpm 的公鑰沒有安裝
原來是公鑰沒有安裝,還是加個 --nogpgcheck 引數來禁止檢查gpg簽名
[[email protected] linux]# yum localinstall VirtualBox-3.1-3.1.0_55467_fedora12-1.i686.rpm --nogpgcheck
最後終於得到下面的提示
已安裝:
VirtualBox-3.1.i686 0:3.1.0_55467_fedora12-1
作為依賴被安裝:
libmodplug.i686 1:0.8.7-2.fc12 libmpcdec.i686 0:1.2.6-6.fc12
phonon.i686 0:4.3.1-102.fc12 phonon-backend-xine.i686 0:4.3.1-102.fc12
qt.i686 1:4.5.3-9.fc12 qt-sqlite.i686 1:4.5.3-9.fc12
qt-x11.i686 1:4.5.3-9.fc12 xine-lib.i686 0:1.1.16.3-4.fc12
完畢!
--------------------------------------------------分割線---------------------------------------------------------------
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源.看個例子. [[email protected] /]# 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!
[[email protected] /]#
3.yum update 全部更新 [[email protected] /]# 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 [[email protected] /]# 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>查詢軟體包 [[email protected] /]# 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 刪除程式包
[[email protected] /]# 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!
[[email protected] /]#
yum 會把下載的軟體包和header儲存在cache中,而不會自動刪除。如果覺得它們佔用了磁碟空間,可以使用yum clean指令進行清除.
yum clean headers清除header
yum clean packages清除下載的rpm包
yum clean all 清除header與rpm包