1. 程式人生 > >Linux程式包管理 rpm/yum

Linux程式包管理 rpm/yum

Linux程式包管理

rpm

rpm命令是RPM軟體包的管理工具。rpm原本是Red Hat Linux發行版專門用來管理Linux各項套件的程式

語法

rpm(選項)(引數)
    rpm {-i|--install} [install-options] PACKAGE_FILE ...
    rpm {-U|--upgrade} [install-options] PACKAGE_FILE ...
    rpm {-F|--freshen} [install-options] PACKAGE_FILE ...
    rpm {-e|--erase} [--allmatches] [--nodeps] [--noscripts] [--test] PACKAGE_NAME ...
    rpm {-q|--query} [select-options] [query-options]
    rpm {-V|--verify} [select-options] [verify-options]

選項

-i, --install :安裝
    -h:hash marks輸出進度條;每個#表示2%的進度;
    --test:測試安裝,檢查並報告依賴關係及衝突訊息等;
    --nodeps:忽略依賴關係;不建議;
    --replacepkgs:重新安裝;
    --nosignature:不檢查包簽名信息,不檢查來源合法性;
    --nodigest:不檢查包完整性資訊;
    --foce:強制安裝

-U, --update:升級或安裝
-F, --freshen :升級
    -oldpackage:降級;
    --force:強制升級;

-e, --erase:解除安裝
    --allmatches:解除安裝所有匹配指定名稱的程式包的各版本;
    --nodeps:忽略依賴關係;
    --test:測試解除安裝,dry run模式;

-q, --query:查詢
    [select-options]
        PACKAGE_NAME:查詢指定的程式包是否已經安裝,及其版本;
        -a, --all:查詢所有已經安裝過的包;
        -f  FILE:查詢指定的檔案由哪個程式包安裝生成;         
        -p, --package PACKAGE_FILE:用於實現對未安裝的程式包執行查詢操作;
        --whatprovides CAPABILITY:查詢指定的CAPABILITY由哪個程式包提供;
        --whatrequires CAPABILITY:查詢指定的CAPABILITY被哪個包所依賴;
    [query-options]
        --changelog:查詢rpm包的changlog;
        -l, --list:程式安裝生成的所有檔案列表;
        -i, --info:程式包相關的資訊,版本號、大小、所屬的包組,等;
        -c, --configfiles:查詢指定的程式包提供的配置檔案;
        -d, --docfiles:查詢指定的程式包提供的文件;
        --provides:列出指定的程式包提供的所有的CAPABILITY;
        -R, --requires:查詢指定的程式包的依賴關係;
        --scripts:檢視程式包自帶的指令碼片斷;

-V, --verify:校驗
    S file Size differs(檔案大小是否改變)
    M Mode differs (includes permissions and file type)(檔案的型別或檔案的許可權(rwx)是否被改變)
    5 digest (formerly MD5 sum) differs(檔案MD5校驗和是否改變(可看成檔案內容是否改變))
    D Device major/minor number mismatch(裝置的中,從程式碼是否改變)
    L readLink(2) path mismatch(檔案路徑是否改變)
    U User ownership differs(檔案的屬主(所有者)是否改變)
    G Group ownership differs(檔案的屬組是否改變)
    T mTime differs(檔案的修改時間是否改變)
    P caPabilities differ

--initdb:初始化資料庫,當前無任何資料庫可實始化建立一個新的;當前有時不執行任何操作;
--rebuilddb:重新構建,通過讀取當前系統上所有已經安裝過的程式包進行重新建立;

引數

  • 程式
  • 安裝檔案

例項

安裝檔案

  • 安裝檔案顯示程序和詳情 -ivh

    [[email protected] zabbix]# rpm -ivh zabbix-release-3.4-2.el7.noarch.rpm
    warning: zabbix-release-3.4-2.el7.noarch.rpm: Header V4 RSA/SHA512 Signature, key ID a14fe591: NOKEY
    Preparing...                          ################################# [100%]
    Updating / installing...
       1:zabbix-release-3.4-2.el7         ################################# [100%]
    
  • 強制安裝,忽略依賴包 -ivh --force -- nodeps

    [[email protected] zabbix]# rpm -ivh --force --nodeps zabbix-release-3.4-2.el7.noarch.rpm
    warning: zabbix-release-3.4-2.el7.noarch.rpm: Header V4 RSA/SHA512 Signature, key ID a14fe591: NOKEY
    Preparing...                          ################################# [100%]
    Updating / installing...
       1:zabbix-rele
    
  • 測試安裝 --test

    [[email protected] ~]# rpm -ivh --test /tmp/zabbix/zabbix-release-3.4-2.el7.noarch.rpm 
    warning: /tmp/zabbix/zabbix-release-3.4-2.el7.noarch.rpm: Header V4 RSA/SHA512 Signature, key ID a14fe591: NOKEY
    Preparing...                          ################################# [100%]
    [[email protected] ~]# rpm -qa | grep zabbix
    [[email protected] ~]#
    

查詢

  • 根據軟體名查詢安裝包版本資訊 -q

    [[email protected] ~]# rpm -q wget
    wget-1.14-15.el7_4.1.x86_64
    
  • 查詢所有安裝的軟體 -qa

    [[email protected] ~]# rpm -qa
    pciutils-3.5.1-1.el7.x86_64
    centos-release-7-3.1611.el7.centos.x86_64
    dracut-network-033-463.el7.x86_64
    filesystem-3.2-21.el7.x86_64
    lvm2-libs-2.02.166-1.el7.x86_64
    tzdata-2016g-2.el7.noarch
    ......
    
  • 根據軟體名查詢詳細資訊 -qi

    [[email protected] ~]# rpm -qi wget
    Name        : wget
    Version     : 1.14
    Release     : 15.el7_4.1
    Architecture: x86_64
    Install Date: Thu 29 Mar 2018 10:19:23 PM CST
    Group       : Applications/Internet
    Size        : 2055533
    ............
    
  • 根據檔案查詢軟體包 -qf

    [[email protected] ~]# rpm -qf /usr/share/doc/zabbix-release-3.4
    zabbix-release-3.4-2.el7.noarch
    
  • 根據軟體名查詢所有的安裝路徑 -ql

    [[email protected] ~]# rpm -ql wget
    /etc/wgetrc
    /usr/bin/wget
    /usr/share/doc/wget-1.14
    /usr/share/doc/wget-1.14/AUTHORS
    /usr/share/doc/wget-1.14/COPYING
    /usr/share/doc/wget-1.14/MAILING-LIST
    /usr/share/doc/wget-1.14/NEWS
    /usr/share/doc/wget-1.14/README
    /usr/share/doc/wget-1.14/sample.wgetrc
    ........
    
  • 查詢包的依賴關係 -qR or -q --requiress

    rpm -qR wget
    /bin/sh
    /bin/sh
    /sbin/install-info
    /sbin/install-info
    config(wget) = 1.14-15.el7_4.1
    libc.so.6()(64bit)
    libc.so.6(GLIBC_2.11)(64bit)
    libc.so.6(GLIBC_2.14)(64bit)
    libc.so.6(GLIBC_2.15)(64bit)
    libc.so.6(GLIBC_2.17)(64bit)
    libc.so.6(GLIBC_2.2.5)(64bit)
    libc.so.6(GLIBC_2.3)(64bit)
    libc.so.6(GLIBC_2.3.4)(64bit)
    ......
    
  • 根據軟體名查詢配置檔案 -qc

    [[email protected] ~]# rpm -qc wget
    /etc/wgetrc
    
  • 根據軟體名查詢說明文件 -qd

    [[email protected] ~]# rpm -qd wget
    /usr/share/doc/wget-1.14/AUTHORS
    /usr/share/doc/wget-1.14/COPYING
    /usr/share/doc/wget-1.14/MAILING-LIST
    /usr/share/doc/wget-1.14/NEWS
    /usr/share/doc/wget-1.14/README
    /usr/share/doc/wget-1.14/sample.wgetrc
    /usr/share/info/wget.info.gz
    /usr/share/man/man1/wget.1.gz
    
  • 根據軟體名查詢版本更新日誌 -q --changelog

    [[email protected] ~]# rpm -q --changelog wget | less
    * Tue Oct 24 2017 Tomas Hozza <[email protected]> - 1.14-15.1
    - Fixed various security flaws (CVE-2017-13089, CVE-2017-13090)
    
    * Fri May 05 2017 Tomas Hozza <[email protected]> - 1.14-15
    - Added TLSv1_1 and TLSv1_2 as secure-protocol values to help (#1439811)
    - Fixed synchronization in randomly failing unit test Test-proxied-https-auth (#1448440)
    
    * Wed Apr 12 2017 Tomas Hozza <[email protected]> - 1.14-14
    - TLS v1.1 and v1.2 can now be specified with --secure-protocol option (#1439811)
    
  • 根據軟體名查詢軟體包提供的能力

    [[email protected] ~]# rpm -q --provides wget
    bundled(gnulib)
    config(wget) = 1.14-15.el7_4.1
    webclient
    wget = 1.14-15.el7_4.1
    wget(x86-64) = 1.14-15.el7_4.1
    
  • 根據安裝包查詢程式詳細資訊

    [[email protected] zabbix]# rpm -qpi zabbix-release-3.4-2.el7.noarch.rpm
    warning: zabbix-release-3.4-2.el7.noarch.rpm: Header V4 RSA/SHA512 Signature, key ID a14fe591: NOKEY
    Name        : zabbix-release
    Version     : 3.4
    Release     : 2.el7
    Architecture: noarch
    Install Date: (not installed)
    Group       : System Environment/Base
    .........
    
  • 根據安裝包查詢程式所有的安裝的路徑

    [[email protected] zabbix]# rpm -qpl zabbix-release-3.4-2.el7.noarch.rpm
    warning: zabbix-release-3.4-2.el7.noarch.rpm: Header V4 RSA/SHA512 Signature, key ID a14fe591: NOKEY
    /etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX
    /etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591
    /etc/yum.repos.d/zabbix.repo
    /usr/share/doc/zabbix-release-3.4
    /usr/share/doc/zabbix-release-3.4/GPL
    

升級

  • 升級安裝,覆蓋安裝 -Uvh

    [[email protected] zabbix]# rpm -Uvh zabbix-release-3.4-2.el7.noarch.rpm
    warning: zabbix-release-3.4-2.el7.noarch.rpm: Header V4 RSA/SHA512 Signature, key ID a14fe591: NOKEY
    Preparing...                          ################################# [100%]
            package zabbix-release-3.4-2.el7.noarch is already installed
    
  • 只升級

    [email protected] zabbix]# rpm -Fvh zabbix-release-3.4-2.el7.noarch.rpm
    warning: zabbix-release-3.4-2.el7.noarch.rpm: Header V4 RSA/SHA512 Signature, key ID a14fe591: NOKEY
    

解除安裝

    [[email protected] ~]# rpm -evh zabbix-release 
    Preparing...                          ################################# [100%]
    Cleaning up / removing...
       1:zabbix-release-3.4-2.el7         ################################# [100%]

軟體校驗

  • 修改wget配置檔案,後進行校驗

    [[email protected] zabbix]# rpm -V wget
    S.5....T.  c /etc/wgetrc
    

包來源合法性驗正和完整性驗正CentOS發行版

    匯入證書:
    [[email protected] ~]# rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
    驗證:
    (1) 安裝此組織簽名的程式時,會自動執行驗正;
    (2) 手動驗正:rpm -K PACKAGE_FILE

重建資料路

  • rpm資料庫路徑 /var/lib/rpm/

    [[email protected] ~]# ll /var/lib/rpm
    total 37792
    -rw-r--r--. 1 root root  1261568 Mar 30 02:08 Basenames
    -rw-r--r--. 1 root root     8192 Mar 28 07:14 Conflictname
    -rw-r--r--. 1 root root   270336 Mar 30 02:48 __db.001
    -rw-r--r--. 1 root root    81920 Mar 30 02:48 __db.002
    -rw-r--r--. 1 root root  1318912 Mar 30 02:48 __db.003
    -rw-r--r--. 1 root root   425984 Mar 30 02:08 Dirnames
    -rw-r--r--. 1 root root    12288 Mar 30 02:08 Group
    -rw-r--r--. 1 root root    12288 Mar 30 02:08 Installtid
    -rw-r--r--. 1 root root    24576 Mar 30 02:08 Name
    -rw-r--r--. 1 root root    16384 Mar 28 07:14 Obsoletename
    -rw-r--r--. 1 root root 33591296 Mar 30 02:08 Packages
    -rw-r--r--. 1 root root  1609728 Mar 30 02:08 Providename
    -rw-r--r--. 1 root root   131072 Mar 29 22:19 Requirename
    -rw-r--r--. 1 root root    40960 Mar 30 02:08 Sha1header
    -rw-r--r--. 1 root root    24576 Mar 30 02:08 Sigmd5
    -rw-r--r--. 1 root root     8192 Mar 28 07:14 Triggername
    
  • 初始化資料庫

    [[email protected] ~]# rpm --initdb
    
  • 重構資料庫

    [[email protected] ~]# rpm --rebuilddb
    

yum

yum命令是在Fedora和RedHat以及SUSE中基於rpm的軟體包管理器,它可以使系統管理人員互動和自動化地更細與管理RPM軟體包,能夠從指定的伺服器自動下載RPM包並且安裝,可以自動處理依賴性關係,並且一次安裝所有依賴的軟體包,無須繁瑣地一次次下載、安裝。

語法

yum(選項)(引數)

選項

-y:對所有的提問都回答“yes”;
-c:指定配置檔案;
-q:安靜模式;
-v:詳細模式;
-C:完全從快取中執行,而不去下載或者更新任何標頭檔案。

引數

install:安裝rpm軟體包;
update:更新rpm軟體包;
check-update:檢查是否有可用的更新rpm軟體包;
remove:刪除指定的rpm軟體包;
list:顯示軟體包的資訊;
search:檢查軟體包的資訊;
info:顯示指定的rpm軟體包的描述資訊和概要資訊;
clean:清理yum過期的快取;
shell:進入yum的shell提示符;
resolvedep:顯示rpm軟體包的依賴關係;
localinstall:安裝本地的rpm軟體包;
localupdate:顯示本地rpm軟體包進行更新;
deplist:顯示rpm軟體包的所有依賴關係。
repolist[all|enabled|disabled]:顯示倉庫列表

配置檔案

/etc/yum.conf:為所有倉庫提供公共配置
/etc/yum.repos.d/*.repo:為倉庫的指向提供配置

倉庫指向的定義

[[email protected] ~]# cat  /etc/yum.repos.d/CentOS-Base.repo 

[base]
name=CentOS-$releasever - Base
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

......

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

......

定義如下:
    [repositoryID]
    name=Some name for this repository
    baseurl=url://path/to/repository/
    enabled={1|0} :啟用
    gpgcheck={1|0}:校驗
    gpgkey=URL:校驗key地址
    enablegroups={1|0}
    failovermethod={roundrobin|priority}
        預設為:roundrobin,意為隨機挑選;
    cost=
        預設為1000


baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/

    $releasever:表示當前系統的發行版本,可以通過rpm -qi centos-release 或 rpm -q --qf %{version} centos-release;echo
    $basearch:系統硬體架構,使用命令arch得到 或rpm -q --qf %{arch} centos-release;echo

        [[email protected] ~]# rpm -qi centos-release
        Name        : centos-release
        Version     : 7
        Release     : 3.1611.el7.centos
        Architecture: x86_64
        Install Date: Wed 28 Mar 2018 06:44:22 AM CST
        Group       : System Environment/Base
        Size        : 37000
        License     : GPLv2
        Signature   : RSA/SHA256, Wed 30 Nov 2016 02:57:12 AM CST, Key ID 24c6a8a7f4a80eb5
        Source RPM  : centos-release-7-3.1611.el7.centos.src.rpm
        Build Date  : Wed 30 Nov 2016 02:12:59 AM CST
        Build Host  : c1bm.rdu2.centos.org
        Relocations : (not relocatable)
        Packager    : CentOS BuildSystem <http://bugs.centos.org>
        Vendor      : CentOS
        Summary     : CentOS Linux release file
        Description :
        CentOS Linux release files

        其中Version     : 7就是系統版本號

        [[email protected] ~]# arch
        x86_64

        [[email protected] ~]# rpm -q --qf %{version} centos-release;echo
        7
        [[email protected]st ~]# rpm -q --qf %{arch} centos-release;echo
        x86_64

例項

  • 顯示倉庫列表 -repolist[all|enabled|disabled]

    [[email protected] ~]# yum repolist
    Loaded plugins: fastestmirror
    Loading mirror speeds from cached hostfile
     * base: mirrors.aliyun.com
     * extras: mirrors.aliyun.com
     * updates: mirrors.aliyun.com
    repo id                                   repo name                                                        status
    base/7/x86_64                             CentOS-7 - Base - mirrors.aliyun.com                             9,591
    extras/7/x86_64                           CentOS-7 - Extras - mirrors.aliyun.com                             446
    updates/7/x86_64                          CentOS-7 - Updates - mirrors.aliyun.com                          2,416
    
  • 顯示程式包 -list

    yum list all        //顯示所有程式包
    yum list installed  //顯示已安裝的程式包
    yum list updates    //顯示已升級的程式包
    yum list available  //顯示可安裝的程式包
    
    
    [[email protected] ~]# yum list avaiable httpd
    Loaded plugins: fastestmirror
    Loading mirror speeds from cached hostfile
     * base: mirrors.aliyun.com
     * extras: mirrors.aliyun.com
     * updates: mirrors.aliyun.com
    Available Packages
    httpd.x86_64                                    2.4.6-67.el7.centos.6                                     updates
    
  • 安裝程式 install

    yum install -y httpd
    
  • 重新安裝 reinstall

    yum reinstall -y httpd
    
  • 升級程式包 update

    yum update httpd
    
  • 降級程式包 downgrade

    yum downgrade httpd
    
  • 檢查可用升級 check-update

    yum check-update
    
  • 解除安裝程式包 remove

    yum remove httpd
    
  • 檢視程式詳細資訊 info

    [[email protected] ~]# yum info wget
    Loaded plugins: fastestmirror
    Loading mirror speeds from cached hostfile
     * base: mirrors.aliyun.com
     * extras: mirrors.aliyun.com
     * updates: mirrors.aliyun.com
    Installed Packages
    Name        : wget
    Arch        : x86_64
    Version     : 1.14
    Release     : 15.el7_4.1
    Size        : 2.0 M
    Repo        : installed
    From repo   : updates
    Summary     : A utility for retrieving files using the HTTP or FTP protocols
    URL         : http://www.gnu.org/software/wget/
    License     : GPLv3+
    Description : GNU Wget is a file retrieval utility which can use either the HTTP or
                : FTP protocols. Wget features include the ability to work in the
                : background while you are logged out, recursive retrieval of
                : directories, file name wildcard matching, remote file timestamp
                : storage and comparison, use of Rest with FTP servers and Range with
                : HTTP servers to retrieve files over slow or unstable connections,
                : support for Proxy servers, and configurability.
    
  • 檢視指定的特性是由哪些程式包提供的 provides

    [[email protected] ~]# yum provides httpd
    Loaded plugins: fastestmirror
    Loading mirror speeds from cached hostfile
     * base: mirrors.aliyun.com
     * extras: mirrors.aliyun.com
     * updates: mirrors.aliyun.com
    httpd-2.4.6-67.el7.centos.x86_64 : Apache HTTP Server
    Repo        : base
    
    
    
    httpd-2.4.6-67.el7.centos.2.x86_64 : Apache HTTP Server
    Repo        : updates
    
    
    
    httpd-2.4.6-67.el7.centos.5.x86_64 : Apache HTTP Server
    Repo        : updates
    
    
    
    httpd-2.4.6-67.el7.centos.6.x86_64 : Apache HTTP Server
    Repo        : updates
    
  • 清理本地快取 clean

    [[email protected] ~]# yum clean all
    Loaded plugins: fastestmirror
    Cleaning repos: base extras updates
    Cleaning up everything
    Cleaning up list of fastest mirrors
    
  • 構建快取 makecache

    yum makecache
    
  • 根據程式查詢程式包名稱 search

    [[email protected] ~]# yum search httpd
    Loaded plugins: fastestmirror
    Loading mirror speeds from cached hostfile
     * base: mirrors.aliyun.com
     * extras: mirrors.aliyun.com
     * updates: mirrors.aliyun.com
    ============================================== N/S matched: httpd ===============================================
    keycloak-httpd-client-install.noarch : Tools to configure Apache HTTPD as Keycloak client
    libmicrohttpd-devel.i686 : Development files for libmicrohttpd
    libmicrohttpd-devel.x86_64 : Development files for libmicrohttpd
    libmicrohttpd-doc.noarch : Documentation for libmicrohttpd
    python2-keycloak-httpd-client-install.noarch : Tools to configure Apache HTTPD as Keycloak client
    httpd.x86_64 : Apache HTTP Server
    httpd-devel.x86_64 : Development interfaces for the Apache HTTP server
    httpd-manual.noarch : Documentation for the Apache HTTP server
    httpd-tools.x86_64 : Tools for use with the Apache HTTP Server
    libmicrohttpd.i686 : Lightweight library for embedding a webserver in applications
    libmicrohttpd.x86_64 : Lightweight library for embedding a webserver in applications
    mod_auth_mellon.x86_64 : A SAML 2.0 authentication module for the Apache Httpd Server
    mod_dav_svn.x86_64 : Apache httpd module for Subversion server
    
  • 檢視指定包所依賴的capabilities:deplist

    [[email protected] ~]# yum deplist wget
    Loaded plugins: fastestmirror
    Loading mirror speeds from cached hostfile
     * base: mirrors.aliyun.com
     * extras: mirrors.aliyun.com
     * updates: mirrors.aliyun.com
    package: wget.x86_64 1.14-15.el7_4.1
      dependency: /bin/sh
       provider: bash.x86_64 4.2.46-29.el7_4
      dependency: /sbin/install-info
       provider: info.x86_64 5.1-4.el7
      dependency: libc.so.6(GLIBC_2.17)(64bit)
       provider: glibc.x86_64 2.17-196.el7_4.2
      dependency: libcrypto.so.10()(64bit)
       provider: openssl-libs.x86_64 1:1.0.2k-8.el7
      dependency: libcrypto.so.10(libcrypto.so.10)(64bit)
       provider: openssl-libs.x86_64 1:1.0.2k-8.el7
      dependency: libdl.so.2()(64bit)
       provider: glibc.x86_64 2.17-196.el7_4.2
      dependency: libidn.so.11()(64bit)
       provider: libidn.x86_64 1.28-4.el7
      dependency: libidn.so.11(LIBIDN_1.0)(64bit)
       provider: libidn.x86_64 1.28-4.el7
      dependency: libpcre.so.1()(64bit)
       provider: pcre.x86_64 8.32-17.el7
      dependency: libssl.so.10()(64bit)
       provider: openssl-libs.x86_64 1:1.0.2k-8.el7
      dependency: libssl.so.10(libssl.so.10)(64bit)
       provider: openssl-libs.x86_64 1:1.0.2k-8.el7
      dependency: libuuid.so.1()(64bit)
       provider: libuuid.x86_64 2.23.2-43.el7_4.2
      dependency: libuuid.so.1(UUID_1.0)(64bit)
       provider: libuuid.x86_64 2.23.2-43.el7_4.2
      dependency: libz.so.1()(64bit)
       provider: zlib.x86_64 1.2.7-17.el7
      dependency: rtld(GNU_HASH)
       provider: glibc.x86_64 2.17-196.el7_4.2
       provider: glibc.i686 2.17-196.el7_4.2    
    
  • 檢視yum事務歷史

    [[email protected] ~]# yum history
    Loaded plugins: fastestmirror
    ID     | Login user               | Date and time    | Action(s)      | Altered
    -------------------------------------------------------------------------------
         8 | root <root>              | 2018-04-01 18:28 | Erase          |    1   
         7 | root <root>              | 2018-04-01 18:06 | Reinstall      |    1   
         6 | root <root>              | 2018-04-01 17:47 | Install        |    5   
         5 | root <root>              | 2017-12-31 19:17 | Install        |    1   
         4 | root <root>              | 2017-12-26 22:31 | Install        |   31   
         3 | root <root>              | 2017-12-25 22:30 | I, U           |   25   
         2 | root <root>              | 2017-12-25 21:58 | Install        |    1   
         1 | System <unset>           | 2017-12-23 22:03 | Install        |  356   
    

包組相關命令

  • 顯示包組 grouplist

    [[email protected] ~]# yum grouplist 
    Loaded plugins: fastestmirror
    There is no installed groups file.
    Maybe run: yum groups mark convert (see man yum)
    Loading mirror speeds from cached hostfile
     * base: mirrors.aliyun.com
     * extras: mirrors.aliyun.com
     * updates: mirrors.aliyun.com
    Available Environment Groups:
       Minimal Install
       Compute Node
       Infrastructure Server
       File and Print Server
       Basic Web Server
       Virtualization Host
       Server with GUI
       GNOME Desktop
       KDE Plasma Workspaces
       Development and Creative Workstation
    Available Groups:
       Compatibility Libraries
       Console Internet Tools
       Development Tools
       Graphical Administration Tools
       Legacy UNIX Compatibility
       Scientific Support
       Security Tools
       Smart Card Support
       System Administration Tools
       System Management
    Done
    
  • 檢視包組資訊 groupinfo

    [[email protected] ~]# yum groupinfo Development Tools
    Loaded plugins: fastestmirror
    There is no installed groups file.
    Maybe run: yum groups mark convert (see man yum)
    Loading mirror speeds from cached hostfile
     * base: mirrors.aliyun.com
     * extras: mirrors.aliyun.com
     * updates: mirrors.aliyun.com
    
    Group: Development Tools
     Group-Id: development
     Description: A basic development environment.
     Mandatory Packages:
       +autoconf
       +automake
        binutils
       +bison
       +flex
       +gcc
       +gcc-c++
        gettext
       +libtool
        make
       +patch
        pkgconfig
       +redhat-rpm-config
       +rpm-build
       +rpm-sign
     Default Packages:
       +byacc
    ......
    
  • 安裝包組 groupinstall

    yum groupinstall Development Tools
    
  • 更新包組 groupupdate

    yum groupupdate Development Tools
    
  • 移除包組 groupremove

    yum groupremove Development Tools
    

綜合例項

  • 配置阿里雲epel源

    [[email protected] yum.repos.d]# cat Centos-epel.repo
    [epel]
    name=CentOS-$releasever - epel - mirrors.aliyun.com
    baseurl=http://mirrors.aliyun.com/epel/$releasever/$basearch/
    gpgcheck=0
    enalbed=1
    
    [[email protected] yum.repos.d]# yum repolist
    Loaded plugins: fastestmirror
    Loading mirror speeds from cached hostfile
     * base: mirrors.aliyun.com
     * extras: mirrors.aliyun.com
     * updates: mirrors.aliyun.com
    repo id                                   repo name                                                        status
    base/7/x86_64                             CentOS-7 - Base - mirrors.aliyun.com                              9,591
    epel/7/x86_64                             CentOS-7 - epel - mirrors.aliyun.com                             12,454
    extras/7/x86_64                           CentOS-7 - Extras - mirrors.aliyun.com                              446
    updates/7/x86_64                          CentOS-7 - Updates - mirrors.aliyun.com                           2,416
    
  • 配置本地yum源,以/tmp/os為原始檔

    [[email protected] os]# ll
    total 42964
    -rw-r--r--. 1 root root 43988984 Jan 13  2017 java-1.6.0-openjdk-1.6.0.41-1.13.13.1.el7_3.x86_64.rpm
    
    [[email protected] os]# createrepo /tmp/os         //建立repodata
    Spawning worker 0 with 1 pkgs
    Workers Finished
    Saving Primary metadata
    Saving file lists metadata
    Saving other metadata
    Generating sqlite DBs
    Sqlite DBs complete
    
    [[email protected] os]# ll
    total 42964
    -rw-r--r--. 1 root root 43988984 Jan 13  2017 java-1.6.0-openjdk-1.6.0.41-1.13.13.1.el7_3.x86_64.rpm
    drwxr-xr-x. 2 root root     4096 Apr  1 20:04 repodata
    
    [[email protected] os]# cat /etc/yum.repos.d/Centos-Local.repo 
    [local]
    name=CentOS-$releasever - local
    baseurl=file:///tmp/os
    enabled=1
    gpgcheck=0
    
    [[email protected] os]# yum repolist
    Loaded plugins: fastestmirror
    Loading mirror speeds from cached hostfile
     * base: mirrors.aliyun.com
     * extras: mirrors.aliyun.com
     * updates: mirrors.aliyun.com
    repo id                                   repo name                                                        status
    base/7/x86_64                             CentOS-7 - Base - mirrors.aliyun.com                              9,591
    epel/7/x86_64                             CentOS-7 - epel - mirrors.aliyun.com                             12,454
    extras/7/x86_64                           CentOS-7 - Extras - mirrors.aliyun.com                              446
    local                                     CentOS-7 - local                                                      1
    updates/7/x86_64                          CentOS-7 - Updates - mirrors.aliyun.com                           2,416
    repolist: 24,908
    [[email protected] os]# 

相關推薦

Linux程式管理 rpm/yum

Linux程式包管理rpmrpm命令是RPM軟體包的管理工具。rpm原本是Red Hat Linux發行版專門用來管理Linux各項套件的程式語法rpm(選項)(引數) rpm {-i|--install} [install-options] PACKAGE_FILE ... rpm {-U|

程式管理rpmyum

Linux程式包管理: API:Application Programming Interface原始碼包 POSIX:Portable OS 程式原始碼 --> 預處理 --> 編譯 --> 彙編 --> 連結 靜態編譯: 共享編譯:.so A

linux安裝管理yumrpm 文本處理:sed

repos rpm -e 偶數 匹配 usr ip地址 rpm查詢 att 替代 1.每12小時備份並壓縮/etc/目錄到/data中,並保存文件格式為“etc-年-月-日-時-分.tar.gz” 編寫腳本用來備份 文件/root/etcback.sh #!/bin/

2018-3-14Linux系統管理(12) Linux程序管理(2)yum前端管理工具

Linux 系統管理 我們在之前的章節中講到了Linux的程序包管理的基礎與實現,後面也講述了RPM包的管理命令實現了管理包的功能,主要用的是rpm命令,那麽rpm實現程序管理總結如下: rpm命令實現程序管理: 安裝:-ivh, --nodeps, --replacepkgs

Linux程序管理yum源安裝

文件夾 ide IT update 事務 lob dde 重新安裝 顯示 yum源安裝是我們工作中常用的一種方式,它是在Fedora和RedHat以及SUSE中基於rpm的軟件包管理器,它可以使系統管理人員交互和自動化地更細與管理RPM軟件包,能夠從指定的服務器自動下載RP

week---3 Linux程式管理及if語句

一、Linux程式包管理 RPM(軟體包管理器) YUM(軟體倉庫) 二、計算數字 例如 var1=10.46var1=10.46 var2=43.67 var3=33.2 var4=71 result=**(bc&lt;&lt;EOF∗

Linux程式管理及sed命令簡述

1、簡述rpm與yum命令的常見選項,並舉例rpm即RedHat系列發行版的程式包管理工具,即為RPM package Manager。yum是RedHat系列RPM的前端管理工具,其主要是解決程式在安裝或解除安裝過程中RPM包的依賴關係,為其使用者更方便快捷的安裝程式。rp

軟件管理(rpm,yum)

dpt 重命名 asf adb rebuild prior upgrade failover ada 軟件包管理相關軟件: 軟件包管理器的核心功能: 1.制作軟件包 2.安裝,卸載,升級,查詢,效驗 Redhat ,SUSE

linux學習第二周;rpm管理yum管理;定制yum

develop baseurl href 互聯 rpm -ivh 軟件包 .com 操作 步驟 rpm安裝(無法解決包之間依賴性問題): rpm -ivh # 安裝包(需要給出包絕對路徑) rpm -V #用作包校驗,包無變化則不執行操作,包被改變則顯示包改變的屬性 rpm

Linux-軟體管理-wget,rpm,yum,apt-get

wget 類似於迅雷,是一種下載工具, 通過HTTP、HTTPS、FTP三個最常見的TCP/IP協議下載,並可以使用HTTP代理 名字是World Wide Web”與“get”的結合。 rpm,軟體管理,redhat的軟體格式rpm,r=redhat,

Linux 入門記錄:二十、Linux 管理工具 YUM

倉庫 清理 bug entos 需要 tro eat 參數 基於組 一、YUM(Yellowdog Updater, Modified) 1. yum 簡介 RPM 軟件包形式管理軟件雖然方便,但是需要手動解決軟件包的依賴問題。很多時候安裝一個軟件首先需要安裝 1 個或

Linux程序管理rpm

ont 版本 查詢 bsp 自己 軟件包 詳解 manage IT rpm簡介 rpm( Red Hat Package Manager )是一個開放的軟件包管理系統。它工作於Red Hat Linux及其他Linux系統,成為Linux中公認的軟件包管理標準。

軟件管理rpmyum及編譯安裝

glib 設定 不出 命令行選項 save rpm -ivh 詳細 強制安裝 參數 庫文件 查看二進制程序所依賴的庫文件 ldd /PATH/TO/BINARY_FILE 管理及查看本機裝載的庫文件 ldconfig 加載庫文件 /sbin/ldconfig -p:

RPM軟體管理Yum軟體倉庫

目錄 什麼是RPM和Yum? 配置Yum倉庫的配置檔案 修改yum源 什麼是RPM和Yum? rpm是Linux的一種軟體包,以.rpm結尾,安裝的時候使用rpm -ivh 在沒有RPM之前,Linux中軟體的安裝只能使用原始碼的方式安裝,需要程式設計師自己解決軟體包

程序管理rpmyum

rpm use and amd64 校驗碼 amd sbin glog base Linux程序包管理: API:Application Programming Interface源碼包 POSIX:Portable OS 程序源代碼 --> 預處理

14-軟體管理 rpmyum使用

一,RPM 命令管理 1.1 RPM 基礎原理 rpm命令是RPM軟體包的管理工具。rpm原本是Red Hat Linux發行版專門用來管理Linux各項套件的程式,由於它遵循GPL規則且功能強大方便,因而廣受歡迎。逐漸受到其他發行版的採用。RPM套件管理方式

Linux學習之軟體管理--rpm命令管理

1.rpm包命名規則   對於Linux系統來說,所有的rpm包都在光盤裡的Packages資料夾裡。對於rpm包的命名規則,可以舉例說明,如下面一個包:     httpd-2.2.15-15.el6.centos.1.i686.rpm   httpd        軟體包名   2.2.15   

Linux學習之軟件管理--rpm命令管理

數字 詳細信息 rpm命令管理 軟件版本 語法 entos rpm -ivh 匹配 .rpm 1.rpm包命名規則   對於Linux系統來說,所有的rpm包都在光盤裏的Packages文件夾裏。對於rpm包的命名規則,可以舉例說明,如下面一個包:     httpd-2.

軟體管理rpm,yum

=========================================rpm軟體管理(裝二進位制包,依賴關係很糟心) 軟體包 nginx.tar.gz(檔案是原始碼):編譯(原始碼翻譯成二進位制)安裝 rpm:紅帽軟體包管理(檔案就是二進位制) 版本號最後一位是奇數說明是測試版本不穩定

第六週作業 rpm管理yum配置、sed用法、備份任務等

1、 每12小時備份並壓縮/etc/目錄至/backup目錄中,儲存檔名稱格式為,“etc-年-月-日-時-分.tar.gz”  • tar:o 打包:tar -cf something.tar somethingo 解包:tar -xf something.taro -c:建立 .tar 格式的