前言
最近工作關係開始玩 CentOS 了,本次實作環境中採用的是 CentOS 7.3 x86-64 (Kernel version 3.10.0-514.el7.x86_64)映像檔,也就是新版 CentOS 7.3最小化安裝版本 (Minimal Install),那麼開始來玩玩吧。💪實作環境
- Windows Server 2016 Hyper-V
- CentOS 7.3 x86-64 (Kernel version 3.10.0-514.el7.x86_64)
- epel-release-7-9.noarch
- elrepo-release-7.0-2.el7.elrepo.noarch
擴充 YUM 套件管理工具 RPM 數量
雖然在上一篇文章中,我們已經將 YUM 套件管理工具的鏡像站台,設定為台灣鏡像站台來加快套件下載速度。然而,儘管官方的 YUM 套件管理工具中套件數量已經不少,但目前官方套件數量中僅包含必要套件,例如,常常用來管理 MySQL 資料庫的 PhpMyAdmin 套件,就未包含在內建的 YUM 軟體套件庫 (RPM Repository)當中。雖然我們可以自行下載 PhpMyAdmin 套件並手動安裝到系統上,但個人的主機管理習慣,是盡量使用 YUM 套件管理工具來處理 RPM 套件的安裝、移除、升級…等作業。因此,我們可以透過第 3 方且獲社群認可的軟體套件庫,在安裝後擴充 YUM 套件管理工具中的套件數量。首先,我們可以執行「yum repolist」指令,查詢目前 CentOS 主機軟體套件庫中所支援的套件數量,從查詢結果中可以看到目前套件總數為「11,346」。
# yum repolist
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: ftp.tc.edu.tw
* extras: ftp.tc.edu.tw
* updates: ftp.tc.edu.tw
repo id repo name status
base/7/x86_64 CentOS-7 - Base 9,363
extras/7/x86_64 CentOS-7 - Extras 337
updates/7/x86_64 CentOS-7 - Updates 1,646
repolist: 11,346
圖、目前 YUM 管理工具套件總數量
在本文中,我們將會安裝「EPEL (Extra Packages for Enterprise Linux)」及「ELRepo (The Community Enterprise Linux Repository)」,獲社群認可的第 3 方軟體套件庫。在下列操作中,可以看到當系統尚未安裝 EPEL 軟體套件庫以前,透過 YUM 管理工具套件庫 (RPM Repository) 是搜尋不到 PhpMyAdmin套件的。
# yum search phpmyadmin
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: ftp.tc.edu.tw
* extras: ftp.tc.edu.tw
* updates: ftp.tc.edu.tw
Warning: No matches found for: phpmyadmin
No matches found
圖、無法搜尋到 phpmyadmin 套件
安裝 EPEL 第 3 方軟體套件庫
請執行「yum -y install epel-release」指令安裝 EPEL 第 3 方軟體套件庫。# yum -y install epel-release
Loaded plugins: fastestmirror
base | 3.6 kB 00:00:00
extras | 3.4 kB 00:00:00
updates | 3.4 kB 00:00:00
Loading mirror speeds from cached hostfile
* base: ftp.tc.edu.tw
* extras: ftp.tc.edu.tw
* updates: ftp.tc.edu.tw
Resolving Dependencies
--> Running transaction check
---> Package epel-release.noarch 0:7-9 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
==================================================================================================================================
Package Arch Version Repository Size
==================================================================================================================================
Installing:
epel-release noarch 7-9 extras 14 k
Transaction Summary
==================================================================================================================================
Install 1 Package
Total download size: 14 k
Installed size: 24 k
Downloading packages:
epel-release-7-9.noarch.rpm | 14 kB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : epel-release-7-9.noarch 1/1
Verifying : epel-release-7-9.noarch 1/1
Installed:
epel-release.noarch 0:7-9
Complete!
圖、安裝 EPEL 軟件庫
順利安裝 EPEL 軟體套件庫後,便可以順利找到 phpmyadmin 套件,當然後續也可以透過 yum 指令進行下載及安裝等套件管理作業。
# yum search phpmyadmin
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: ftp.tc.edu.tw
* epel: mirrors.ustc.edu.cn
* extras: ftp.tc.edu.tw
* updates: ftp.tc.edu.tw
================================ N/S matched: phpmyadmin ================================
php-phpmyadmin-motranslator.noarch : Translation API for PHP using Gettext MO files
php-phpmyadmin-shapefile.noarch : ESRI ShapeFile library for PHP
phpMyAdmin.noarch : Handle the administration of MySQL over the World Wide Web
Name and summary matches only, use "search all" for everything.
圖、順利找到 phpmyadmin 套件
此時,可以執行「yum repolist」指令,從查詢結果中可以看到原本套件總數只有「11,346」,在安裝EPEL 軟體套件庫後增加了「11,670」個套件,所以套件總數提升為「23,016」。
# yum repolist
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: ftp.tc.edu.tw
* epel: ftp.riken.jp
* extras: ftp.tc.edu.tw
* updates: ftp.tc.edu.tw
repo id repo name status
base/7/x86_64 CentOS-7 - Base 9,363
*epel/x86_64 Extra Packages for Enterprise Linux 7 - x86_64 11,670
extras/7/x86_64 CentOS-7 - Extras 337
updates/7/x86_64 CentOS-7 - Updates 1,646
repolist: 23,016
圖、EPEL 軟件庫增加 11,670 個套件
安裝 ELRepo 第 3 方軟體套件庫
接著,我們執行相關指令來安裝 ELRepo 軟件庫。然後,再次執行「yum repolist」指令,查詢目前 CentOS 主機軟件庫中所支援的套件數量,從查詢結果中可以看到安裝 ELRepo 軟體套件庫後增加了「184」個套件,所以套件總數提升為「23,207」。# rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
# rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm
Retrieving http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm
Preparing... ################################# [100%]
Updating / installing...
1:elrepo-release-7.0-2.el7.elrepo ################################# [100%]
[root@centos73 weithenn]# yum repolist
Loaded plugins: fastestmirror
base | 3.6 kB 00:00:00
elrepo | 2.9 kB 00:00:00
epel/x86_64/metalink | 5.4 kB 00:00:00
epel | 4.3 kB 00:00:00
extras | 3.4 kB 00:00:00
updates | 3.4 kB 00:00:00
(1/4): extras/7/x86_64/primary_db | 151 kB 00:00:00
(2/4): epel/x86_64/updateinfo | 799 kB 00:00:00
(3/4): elrepo/primary_db | 413 kB 00:00:03
(4/4): epel/x86_64/primary_db | 4.7 MB 00:00:06
Loading mirror speeds from cached hostfile
* base: ftp.tc.edu.tw
* elrepo: ftp.yz.yamagata-u.ac.jp
* epel: ftp.riken.jp
* extras: ftp.tc.edu.tw
* updates: ftp.tc.edu.tw
repo id repo name status
base/7/x86_64 CentOS-7 - Base 9,363
elrepo ELRepo.org Community Enterprise Linux Repository - el7 184
epel/x86_64 Extra Packages for Enterprise Linux 7 - x86_64 11,674
extras/7/x86_64 CentOS-7 - Extras 340
updates/7/x86_64 CentOS-7 - Updates 1,646
repolist: 23,207
圖、ELRepo 軟體庫增加 184 個套件