最詳細的Linux YUM命令使用教程
YUM(Yellow dog Updater, Modified)為多個Linux發行版的前端軟件包管理器,例如 Redhat RHEL, CentOS & Fedora. YUM通過調用RPM的軟件包信息讓用戶更方便地進行軟件安裝,升級,卸載等軟件包管理操作。
這篇教程適用所有使用YUM管理軟件包的Linux發行版,包括CentOS, RHEL or Fedora.
怎么使用YUM命令升級所有RPM軟件包?
yum update
怎么使用YUM命令升級單個RPM軟件包
yum update 軟件名稱
使用YUM安裝RPM軟件包
yum install 軟件名稱
使用YUM升級全部軟件時怎么排除個別軟件
假如你想升級所有軟件包,但不想升級內核,就可以用下面的命令: yum --exclude=package kernel* update
怎么使用YUM來確定某個軟件需要升級
下面的命令會檢測 Fedora/CentOS/RHEL上的所有軟件是否需要升級
check-update
使用YUM卸載軟件
yum remove 軟件名稱 或者 yum erase 軟件名稱
使用YUM查看軟件包相關信息
yum list可以讓你獲取軟件包相關信息,后面不指定軟件包名的話,它會列出所有軟件包的信息。 yum list 軟件名稱
使用yum了解軟件的主要功能
比如你想知道httpd這個軟件是干嗎的,可以輸入下面的的命令: yum provides httpd
Loaded plugins: priorities
nginx-.0.5-3.el6.i686 : A high performance web server and reverse proxy server
Repo : epel
使用YUM查找軟件包
如果你不知道某個軟件包的全稱,這個命令就非常有用了,它會根據你提供的關鍵詞在RPM的軟件包數據庫里搜索相適配的軟件包。比方說我想找 samba這個軟件的全稱,我只需要輸入下面的命令即可: yum search samba
然后會顯示下面的信息:
============================== N/S Matched: samba ==============================
ncid-samba.noarch : NCID samba module sends caller ID information to windows
: machines
php-pear-Auth-samba.noarch : Samba support for php-pear-Auth
samba-client.i686 : Samba client programs
samba-common.i686 : Files used by both Samba servers and clients
samba-doc.i686 : Documentation for the Samba suite
samba-swat.i686 : The Samba SMB server Web configuration program
samba-winbind.i686 : Samba winbind
samba-winbind-clients.i686 : Samba winbind clients
samba-winbind-krb5-locator.i686 : Samba winbind krb5 locator
samba4.i686 : The Samba4 CIFS and AD client and server suite
samba4-devel.i686 : Developer tools for Samba libraries
samba4-libs.i686 : Samba libraries
sblim-cmpi-samba.i686 : SBLIM WBEM-SMT Samba
sblim-cmpi-samba-devel.i686 : SBLIM WBEM-SMT Samba - Header Development Files
sblim-cmpi-samba-test.i686 : SBLIM WBEM-SMT Samba - Testcase Files
ctdb.i686 : A Clustered Database based on Samba's Trivial Database (TDB)
php-pear-File-SMBPasswd.noarch : Class for managing SAMBA style password files
samba.i686 : Server and Client software to interoperate with Windows machines
samba-domainjoin-gui.i686 : Domainjoin GUI
使用YUM查看軟件包的基本信息
Loaded plugins: priorities
Installed Packages
Name : samba
Arch : i686
Version : 3.5.0
Release : 25.el6
Size : 7 M
Repo : installed
From repo : base
Summary : Server and Client software to interoperate with Windows machines
URL : http://www.samba.org/
License : GPLv3+ and LGPLv3+
Description :
: Samba is the suite of programs by which a lot of PC-related
: machines share files, printers, and other information (such as
: lists of available files and printers). The Windows NT, OS/2, and
: Linux operating systems support this natively, and add-on packages
: can enable the same thing for DOS, Windows, VMS, UNIX of all
: kinds, MVS, and more. This package provides an SMB/CIFS server
: that can be used to provide network services to SMB/CIFS clients.
: Samba uses NetBIOS over TCP/IP (NetBT) protocols and does NOT
: need the NetBEUI (Microsoft Raw NetBIOS frame) protocol.
怎么清除YUM緩存和下載包文件
每安裝一個軟件包,YUM都是先下載一個RPM軟件包然后再安裝,安裝完后并不會自動刪除。時間長了,這些文件占很多空間的。所以,需要定時清理: yum clean all
怎么使用YUM安裝本地RPM包
如果你想要自己創建一個RPM軟件包,你你可以用YUM來確定存在哪些依賴關系: yum localinstall 軟件名稱.rpm
使用YUM升級本地RPM軟件包
如果你想升級一個本地RPM軟件包,可以用下面的命令: yum localupdate update-package.rpm
確定RPM包依賴哪些組件
如果你想自己源碼安裝軟件,了解安裝的軟件包依賴哪些軟件非常有必要的。deplist可以讓你知道軟件包依賴哪些組件,這些組件的全稱是什么。 yum deplist 軟件名稱
查看YUM的版本信息
yum -v
使用YUM安裝軟件包到chroot環境(chroot)
你可以使用下面的命令把軟件安裝到chroot: yum --installroot=/path/to/chroot/
使用YUM啟用已存在的軟件源
如果你安裝了第三方的軟件源,你需要先啟用該軟件源才能從其安裝軟件,輸入下面的命令啟用EPEL軟件源: yum --enablerepo=epel install rsnapshot
使用YUM禁用軟件源
如果你安裝了第三方軟件源但不想從其安裝軟件,可以用下面的命令禁用: yum --disablerepo=epel install 軟件名稱
YUM軟件集合
YUM軟件集合是指多個共同協作的軟件統稱,比如“Development Tools”(開發工具)。 下面介紹下怎么用yum groupinstall命令來查看/安裝/卸載yum軟件集合
安裝yum軟件集合
yum groupinstall 'Development Tools'
卸載yum軟件集合
yum groupremove 'Development Tools'
升級yum軟件集合
yum groupupdate 'Development Tools'
查看yum軟件集合信息
yum groupinfo 'Development Tools'
查看有哪些軟件集合
yum grouplist | more
使用YUM輸出已安裝軟件包列表
該命令適用所有使用YUM為軟件管理器的linux版本,如CentOS, Fedora, RHEL: yum list installed
GeoIP.i686 .4.8-.el6 @epel
MAKEDEV.i686 3.24-6.el6 installed
apr.i686 .3.9-5.el6_2 @updates
apr-util.i686 .3.9-3.el6_0. installed
apr-util-ldap.i686 .3.9-3.el6_0. installed
aspell.i686 2:0.60.6-2.el6 installed
audit-libs.i686 2.2-2.el6 @base
authconfig.i686 6..2-0.el6 @base
avahi-libs.i686 0.6.25-.el6 @base
basesystem.noarch 0.0-4.el6 installed
bash.i686 4..2-9.el6_2 @base
bind.i686 32:9.8.2-0.0.rc.el6_3.6 @updates
bind-libs.i686 32:9.8.2-0.0.rc.el6_3.6 @updates
binutils.i686 2.20.5.0.2-5.34.el6 @base
bzip2.i686 .0.5-7.el6_0 installed
bzip2-libs.i686 .0.5-7.el6_0 installed
ca-certificates.noarch 200.63-3.el6_.5 @base
centos-indexhtml.noarch 6-.el6.centos installed
centos-release.i686 6-3.el6.centos.9 @base
chkconfig.i686 .3.49.3-2.el6 @base
compat-mysql5.i686 5..54-.el6.remi @remi
轉自http://www.zhetenger.com/
Getting Started
- Download and Install Oracle Linux
- Download and copy the appropriate yum configuration file in place, by running the following commands as root:
Oracle Linux 4, Update 6 or Newer
# cd /etc/yum.repos.d # mv Oracle-Base.repo Oracle-Base.repo.disabled # wget http://public-yum.oracle.com/public-yum-el4.repo
Oracle Linux 5
# cd /etc/yum.repos.d # wget http://public-yum.oracle.com/public-yum-el5.repo
Oracle Linux 6
# cd /etc/yum.repos.d # wget http://public-yum.oracle.com/public-yum-ol6.repo
Oracle VM 2
# cd /etc/yum.repos.d # wget http://public-yum.oracle.com/public-yum-ovm2.repo
- Enable the appropriate repository by editing the yum configuration file
- Open the yum configuration file in a text editor
- Locate the section in the file for the repository you plan to update from, e.g. [el4_u6_base]
- Change enabled=0 to enabled=1
- Begin using yum, for example:yum listyum install firefox
You may be prompted to confirm the import of the Oracle OSS Group GPG key.
by http://public-yum.oracle.com/
Oracle Linux有兩種內核:兼容Red Hat Enterprise Linux的內核(使用RHEL源代碼編譯)和Oracle自己的Unbreakable Enterprise內核。Oracle聲明Unbreakable Enterprise內核兼容RHEL,Oracle中間件和經過RHEL認證的第三方應用程序可以不經過修改的在Unbreakable Enterprise內核上運行。

浙公網安備 33010602011771號