最詳細的Linux YUM命令使用教程

 

YUM(Yellow dog Updater, Modified)爲多個Linux發行版的前端軟件包管理器,例如 Redhat RHEL, CentOS & Fedora.  YUM經過調用RPM的軟件包信息讓用戶更方便地進行軟件安裝,升級,卸載等軟件包管理操做。php

這篇教程適用全部使用YUM管理軟件包的Linux發行版,包括CentOS, RHEL or Fedora.html

怎麼使用YUM命令升級全部RPM軟件包?

yum update前端

怎麼使用YUM命令升級單個RPM軟件包

yum update 軟件名稱mysql

使用YUM安裝RPM軟件包

yum install 軟件名稱linux

使用YUM升級所有軟件時怎麼排除個別軟件

假如你想升級全部軟件包,但不想升級內核,就能夠用下面的命令: yum --exclude=package kernel* updatenginx

怎麼使用YUM來肯定某個軟件須要升級

下面的命令會檢測 Fedora/CentOS/RHEL上的全部軟件是否須要升級web

check-updatesql

使用YUM卸載軟件

yum remove 軟件名稱 或者 yum erase 軟件名稱數據庫

使用YUM查看軟件包相關信息

yum list可讓你獲取軟件包相關信息,後面不指定軟件包名的話,它會列出全部軟件包的信息。 yum list 軟件名稱windows

使用yum瞭解軟件的主要功能

好比你想知道httpd這個軟件是幹嘛的,能夠輸入下面的的命令: yum provides httpd

[root@ zhetenger ~]# yum provides nginx
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

而後會顯示下面的信息:

Loaded plugins: priorities
============================== 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查看軟件包的基本信息

>[ root@zhetenger ~]#  yum info samba
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

  1. Download and Install Oracle Linux
  2. 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 
  3. 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
  4. 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內核上運行。

相關文章
相關標籤/搜索