Linux 學習之RPM包管理-yum線上管理-yum命令
yum常用命令:
注:yum線上管理
1、查詢:查詢所有可用軟體包列表
yum list
用法,連線網路的情況下,任何地方都可以執行該命令進行查詢
2、yum search 關鍵字
搜尋伺服器上所有和關鍵字相關的包
3)yum 安裝:
yum -y install 包名
選項:
install 安裝
-y 自動回答yes
如果不加-y ,則每次安裝一個檔案都會詢問是否安裝。
示例:安裝gcc
[[email protected] ~]#
[[email protected] ~]# yum -y install gcc
已載入外掛:fastestmirror, refresh-packagekit, security
設定安裝程序
Loading mirror speeds from cached hostfile
* base: mirrors.huaweicloud.com
* extras: mirrors.aliyun.com
* updates: mirrors.huaweicloud.com
解決依賴關係
--> 執行事務檢查
---> Package gcc.x86_64 0:4.4.7-23.el6 will be 安裝
--> 處理依賴關係 cpp = 4.4.7-23.el6,它被軟體包 gcc-4.4.7-23.el6.x86_64 需要
--> 處理依賴關係 cloog-ppl >= 0.15,它被軟體包 gcc-4.4.7-23.el6.x86_64 需要
--> 執行事務檢查
---> Package cloog-ppl.x86_64 0:0.15.7-1.2.el6 will be 安裝
--> 處理依賴關係 libppl_c.so.2()(64bit),它被軟體包 cloog-ppl-0.15.7-1.2.el6.x86_64 需要
--> 處理依賴關係 libppl.so.7()(64bit),它被軟體包 cloog-ppl-0.15.7-1.2.el6.x86_64 需要
---> Package cpp.x86_64 0:4.4.7-23.el6 will be 安裝
--> 處理依賴關係 libmpfr.so.1()(64bit),它被軟體包 cpp-4.4.7-23.el6.x86_64 需要
--> 執行事務檢查
---> Package mpfr.x86_64 0:2.4.1-6.el6 will be 安裝
---> Package ppl.x86_64 0:0.10.2-11.el6 will be 安裝
--> 完成依賴關係計算
依賴關係解決
===============================================================================================================
軟體包 架構 版本 倉庫 大小
===============================================================================================================
正在安裝:
gcc x86_64 4.4.7-23.el6 base 10 M
為依賴而安裝:
cloog-ppl x86_64 0.15.7-1.2.el6 base 93 k
cpp x86_64 4.4.7-23.el6 base 3.7 M
mpfr x86_64 2.4.1-6.el6 base 157 k
ppl x86_64 0.10.2-11.el6 base 1.3 M
事務概要
===============================================================================================================
Install 5 Package(s)
總下載量:15 M
Installed size: 33 M
下載軟體包:
(1/5): cloog-ppl-0.15.7-1.2.el6.x86_64.rpm | 93 kB 00:00
(2/5): cpp-4.4.7-23.el6.x86_64.rpm | 3.7 MB 00:01
(3/5): gcc-4.4.7-23.el6.x86_64.rpm | 10 MB 00:03
(4/5): mpfr-2.4.1-6.el6.x86_64.rpm | 157 kB 00:00
(5/5): ppl-0.10.2-11.el6.x86_64.rpm | 1.3 MB 00:00
---------------------------------------------------------------------------------------------------------------
總計 2.8 MB/s | 15 MB 00:05
warning: rpmts_HdrFromFdno: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
Importing GPG key 0xC105B9DE:
Userid : CentOS-6 Key (CentOS 6 Official Signing Key) < [email protected]>
Package: centos-release-6-10.el6.centos.12.3.x86_64 (@anaconda-CentOS-201806291108.x86_64/6.10)
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
執行 rpm_check_debug
執行事務測試
事務測試成功
執行事務
Warning: RPMDB altered outside of yum.
正在安裝 : mpfr-2.4.1-6.el6.x86_64 1/5
正在安裝 : cpp-4.4.7-23.el6.x86_64 2/5
正在安裝 : ppl-0.10.2-11.el6.x86_64 3/5
正在安裝 : cloog-ppl-0.15.7-1.2.el6.x86_64 4/5
正在安裝 : gcc-4.4.7-23.el6.x86_64 5/5
Verifying : cpp-4.4.7-23.el6.x86_64 1/5
Verifying : ppl-0.10.2-11.el6.x86_64 2/5
Verifying : cloog-ppl-0.15.7-1.2.el6.x86_64 3/5
Verifying : mpfr-2.4.1-6.el6.x86_64 4/5
Verifying : gcc-4.4.7-23.el6.x86_64 5/5
已安裝:
gcc.x86_64 0:4.4.7-23.el6
作為依賴被安裝:
cloog-ppl.x86_64 0:0.15.7-1.2.el6 cpp.x86_64 0:4.4.7-23.el6 mpfr.x86_64 0:2.4.1-6.el6
ppl.x86_64 0:0.10.2-11.el6
完畢!
[ [email protected] ~]#
[[email protected] ~]# rpm -q gcc
gcc-4.4.7-23.el6.x86_64
[[email protected] ~]#
4) 升級
yum -y update 包名
選項:
update 升級
-y 自動回答yes
注意:避免不寫包名的情況,因為如果不加包名,Linux核心也有更新升級的可能,Linux核心升級,可能會造成系統崩潰
5) 解除安裝
yum -y remove 包名
選項:
remove 解除安裝
-y 自動回答yes
特別注意:該項也特別注意,不能省略包名。另外,生產伺服器的安裝解除安裝原則:
a、最小化安裝;
b、儘量不解除安裝,儘量不要使用yum解除安裝軟體,用yum解除安裝軟體極易導致系統崩潰
所以:儘量不要使用該yum 解除安裝命令!!!!!!!!!!!!!!!
2、yum 軟體組管理命令:
1) yum grouplist
列出所有可用的軟體組列表
2)yum groupinstall 軟體組名
安裝指定軟體組,組名可以由grouplist 查詢出來
3)yum groupremove 軟體組名
解除安裝指定軟體組
[[email protected] ~]# yum grouplist
已載入外掛:fastestmirror, refresh-packagekit, security
設定組程序
Loading mirror speeds from cached hostfile
* base: mirrors.huaweicloud.com
* extras: mirrors.aliyun.com
* updates: mirrors.huaweicloud.com
已安裝的組:
Java 平臺
NFS 檔案伺服器
Perl 支援
X 視窗系統
全球資訊網伺服器
網際網路應用程式
網際網路瀏覽器
相容程式庫
辦公套件和生產率
圖形管理工具
基本
字型
安全性工具
效能工具
列印客戶端
列印伺服器
撥號網路支援
伺服器平臺
桌面
桌面平臺
桌面除錯和執行工具
電子郵件伺服器
目錄客戶端
硬體監控工具
繼承 UNIX 相容性
繼承 X Windows 系統的相容性
網路基礎設施伺服器
網路檔案系統客戶端
聯網工具
除錯工具
輸入法
通用桌面
附加開發
Installed Language Groups:
不丹語支援 [dz]
中文支援 [zh]
烏爾都語支援 [ur]
亞美尼亞語支援 [hy]
以上為安裝組的列表,這裡因為遠端終端支援中文,在實際伺服器上,虛擬機器本身,查出的可能是英文
軟體包組安裝,可以將一個組中的軟體都安裝成功。實質該功能等同於在初始安裝Linux時,選擇安裝選項一樣。