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
[root@localhost 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
[root@localhost 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
[root@localhost ~]# 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%] [root@localhost ~]# rpm -qa | grep zabbix [root@localhost ~]#
查詢
- 根據軟件名查詢安裝包版本信息 -q
[root@localhost ~]# rpm -q wget wget-1.14-15.el7_4.1.x86_64
- 查詢所有安裝的軟件 -qa
[root@localhost ~]# 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
[root@localhost ~]# 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
[root@localhost ~]# rpm -qf /usr/share/doc/zabbix-release-3.4 zabbix-release-3.4-2.el7.noarch
- 根據軟件名查詢所有的安裝路徑 -ql
[root@localhost ~]# 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
[root@localhost ~]# rpm -qc wget /etc/wgetrc
- 根據軟件名查詢說明文檔 -qd
[root@localhost ~]# 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
[root@localhost ~]# rpm -q --changelog wget | less * Tue Oct 24 2017 Tomas Hozza <thozza@redhat.com> - 1.14-15.1 - Fixed various security flaws (CVE-2017-13089, CVE-2017-13090) * Fri May 05 2017 Tomas Hozza <thozza@redhat.com> - 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 <thozza@redhat.com> - 1.14-14 - TLS v1.1 and v1.2 can now be specified with --secure-protocol option (#1439811)
- 根據軟件名查詢軟件包提供的能力
[root@localhost ~]# 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
- 根據安裝包查詢程序詳細信息
[root@localhost 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 .........
- 根據安裝包查詢程序所有的安裝的路徑
[root@localhost 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
[root@localhost 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
- 只升級
root@localhost 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
卸載
[root@localhost ~]# rpm -evh zabbix-release
Preparing... ################################# [100%]
Cleaning up / removing...
1:zabbix-release-3.4-2.el7 ################################# [100%]
軟件校驗
- 修改wget配置文件,后進行校驗
[root@localhost zabbix]# rpm -V wget S.5....T. c /etc/wgetrc
包來源合法性驗正和完整性驗正CentOS發行版
導入證書:
[root@localhost ~]# rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
驗證:
(1) 安裝此組織簽名的程序時,會自動執行驗正;
(2) 手動驗正:rpm -K PACKAGE_FILE
重建數據路
- rpm數據庫路徑 /var/lib/rpm/
[root@localhost ~]# 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
- 初始化數據庫
[root@localhost ~]# rpm --initdb
- 重構數據庫
[root@localhost ~]# 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:為倉庫的指向提供配置
倉庫指向的定義
[root@localhost ~]# 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
[root@localhost ~]# 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就是系統版本號
[root@localhost ~]# arch
x86_64
[root@localhost ~]# rpm -q --qf %{version} centos-release;echo
7
[root@localhost ~]# rpm -q --qf %{arch} centos-release;echo
x86_64
實例
- 顯示倉庫列表 -repolist[all|enabled|disabled]
[root@localhost ~]# 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 //顯示可安裝的程序包 [root@localhost ~]# 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
[root@localhost ~]# 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
[root@localhost ~]# 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
[root@localhost ~]# yum clean all Loaded plugins: fastestmirror Cleaning repos: base extras updates Cleaning up everything Cleaning up list of fastest mirrors
- 構建緩存 makecache
yum makecache
- 根據程序查詢程序包名稱 search
[root@localhost ~]# 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
[root@localhost ~]# 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事務歷史
[root@localhost ~]# 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
[root@localhost ~]# 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
[root@localhost ~]# 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源
[root@localhost 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 [root@localhost 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為源文件
[root@localhost 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 [root@localhost 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 [root@localhost 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 [root@localhost os]# cat /etc/yum.repos.d/Centos-Local.repo [local] name=CentOS-$releasever - local baseurl=file:///tmp/os enabled=1 gpgcheck=0 [root@localhost 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 [root@localhost os]#
本文來自投稿,不代表Linux運維部落立場,如若轉載,請注明出處:http://www.www58058.com/94812