天天學五分鐘 Liunx 0010 | 軟件篇: RPM 和 YUM

1. RPM
RPM(RedHat Package Manager),顧名思義是 RedHat 的軟件包管理器。它遵循 GPL 規則且功能強大好用,從而逐漸運用到其它 Liunx 發行版中,包括 Fedora,CentOS 等。經過 RPM 能夠很方便的查詢,升級和安裝軟件包。
 
廠商提供軟件時,會預先將軟件編譯打包成 RPM 包,其中包含預先檢測系統和依賴軟件的腳本等。用戶使用對應的 RPM 包安裝軟件,在安裝時 RPM 首先檢測用戶環境,依賴軟件是否安裝等信息,檢測經過即開始安裝軟件。軟件安裝完成後,軟件的相關信息會寫到 /var/lib/rpm 目錄下的數據庫文件中,之後對軟件的操做都會先到這個數據庫文件中查詢。
 
2. RPM 命令
以安裝 xterm 軟件爲例,介紹 RPM 命令。
 
RPM 查詢:
[root@test packages]# rpm -q[a|i|l|c|R|f]
# a: 列出全部已經安裝的軟件
# i: 列出軟件的詳細信息
# l: 列出軟件全部的文件與目錄所在的完整文件名
# c: 列出軟件的設置文件
# R:列出軟件有關的依賴軟件所包含的文件
# f: 列出該文件屬於哪一個軟件
 
[root@test packages]# rpm -qa | grep xterm
 
RPM 安裝:
[root@test packages]# rpm -ivh package_name
# i: install
# v: 打印詳細的安裝信息
# h: 安裝信息欄的方式顯示安裝進度
[root@test packages]# rpm -ivh xterm-295-3.el7.x86_64.rpm
Preparing...                          ################################# [100%]
Updating / installing...
   1:xterm-295-3.el7                  ################################# [100%]

 

RPM 驗證:
前面提到軟件完成以後,軟件信息會記錄到 /var/lib/rpm 目錄下的數據庫文件中。若是更改軟件相關文件或者刪除軟件相關配置文件時,經過 RPM 命令的 -V 選項便可驗證軟件的哪些文件改動了,驗證的方式就是將當前系統軟件文件與數據庫文件進行比較。
[root@test packages]# rpm -V[a|f]
# V: 後接軟件名稱,若是有文件改動則列出
# a: 列出系統全部可能被改動過的文件
# f: 後接文件,列出該文件是否被改動過
[root@test packages]# rpm -ql xterm
...
/usr/share/doc/xterm-295/THANKS
...
 
[root@test packages]# echo "thanks for you, xterm" >> /usr/share/doc/xterm-295/THANKS
[root@test packages]# rpm -V xterm
S.5....T  d /usr/share/doc/xterm-295/THANKS

 

能夠看到,驗證的輸出有 S.5....T. 8 個字符,其中每一個字符表示的意思是:
S: 文件的容量被改變;
M: 文件的類型被改變;
5: MD5 碼被改變;
D: 設備的主/次碼被改變;
L: Link 路徑被改變;
U: 文件的全部者被改變;
G: 文件的所屬用戶組被改變;
T: 文件的建立時間被改變;
 
另外,第二項的 d 表示文件的類型是文檔,除了 d 還有 c 表示配置文件,l license 文件,r readme 文件, g ghost 文件。
 
 
除了上面驗證文件更改的方式,還有一種用數字證書 (gpg-key) 驗證 rpm 包的方式。廠商發佈 RPM 包時,會將 RPM 包的公鑰提供給用戶,用戶在安裝 RPM 包時, rpm 命令會將此公鑰與 RPM 包的密鑰信息做對比,若是一致,則予如下載,反之則給予警告並中止安裝。
[root@test packages]# cd /etc/pki/rpm-gpg/
[root@test rpm-gpg]# ls
RPM-GPG-KEY-redhat-beta  RPM-GPG-KEY-redhat-legacy-former  RPM-GPG-KEY-redhat-legacy-release  RPM-GPG-KEY-redhat-legacy-rhx  RPM-GPG-KEY-redhat-release
[root@test rpm-gpg]# ll RPM-GPG-KEY-redhat-beta
-rw-r--r--. 1 root root 3375 Sep 27  2016 RPM-GPG-KEY-redhat-beta
[root@test rpm-gpg]# cat RPM-GPG-KEY-redhat-beta
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.2.6 (GNU/Linux)
 
mQINBEmkAzABEAC2/c7bP1lHQ3XScxbIk0LQWe1YOiibQBRLwf8Si5PktgtuPibT
kKpZjw8p4D+fM7jD1WUzUE0X7tXg2l/eUlMM4dw6XJAQ1AmEOtlwSg7rrMtTvM0A
BEtI7Km6fC6sU6RtBMdcqD1cH/6dbsfh8muznVA7UlX+PRBHVzdWzj6y8h84dBjo
gzcbYu9Hezqgj/lLzicqsSZPz9UdXiRTRAIhp8V30BD8uRaaa0KDDnD6IzJv3D9P
xQWbFM4Z12GN9LyeZqmD7bpKzZmXG/3drvfXVisXaXp3M07t3NlBa3Dt8NFIKZ0D
FRXBz5bvzxRVmdH6DtkDWXDPOt+Wdm1rZrCOrySFpBZQRpHw12eo1M1lirANIov7
**********************************************************************
-----END PGP PUBLIC KEY BLOCK-----
[root@test rpm-gpg]#
[root@test rpm-gpg]# rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-beta # 導入公鑰到 RPM
 
RPM 卸載:
[root@test packages]# rpm -e
# e: erase
 
[root@test packages]# rpm -qa | grep xterm
xterm-295-3.el7.x86_64
[root@test packages]# rpm -e xterm
[root@test packages]# rpm -qa | grep xterm
[root@test packages]#
RPM 卸載要注意考慮軟件依賴性問題,從上到下依次卸載!
 
 
固然,RPM 的缺點也是很明顯的,如前說述,安裝 RPM 包時,RPM 會去檢查軟件的依賴 rpm 包,若是依賴包沒有安裝則中止安裝軟件。須要將依賴的軟件包事先裝好,而後才能安裝,很麻煩。爲了解決這種依賴包安裝的問題,YUM 在線升級安裝的機制就應運而生。
 
 
3. YUM
YUM(Yellow dog Updater,Modified),是基於 rpm 包的軟件管理器,它能夠從指定服務器下載 rpm 包而且安裝,並且它能夠自動處理軟件依賴關係,也能夠方便的對軟件進行查詢,更新等操做。
 
4. YUM 工做原理
客戶端在下載軟件時,根據自帶的 repo 文件到指定的 YUM 服務器下載清單列表,清單列表記錄了軟件的信息以及軟件依賴關係等。清單列表和實際軟件組成了軟件倉庫 repository。客戶端將清單列表下到本地,再和本地 rpm 的數據庫比較,若是發現須要下載的軟件不在本地或者本地沒有依賴包時會到 YUM 服務器中下載相應的軟件包。同時,由於有了本地數據庫和清單列表,也就知道哪些軟件能夠作 update 了。
 
5. YUM 命令
Individual packages
list
List package names from repositories
 yum list available
 List all available packages
 yum list installed
 List all installed packages
 yum list all
 List installed and available packages
 yum list kernel
 List installed and available packages
info
Dispaly information about a package
 yum info vsftpd
 List info about vsftpd package
deplist
Display dependencies for a package
 yum deplist nfs-utils
 List dependencies and packages providing them
provides
Find packages that provide the queried file
yum provides "*bin/top"
Show package that contains top command
yum provides "*/README.top"
Show package containing README.top file
search
Search package names and descriptions for a term
yum search samba
Find packages with samba in name or description
updateinfo
Get information about available package updates
yum updateinfo security
Get into on available security updates
Grups of packages
grouplist
List names of installed and available package groups
groupinfo 
Display description and contents of a package group
yum groupinfo "Web Server"
See packages in Web Server group
check-update
Query repositories for available package updates
groupinstall
install all packages in the selected group
yum groupinstall "Web Server"
Install Web Server packages
YUM repositories
repolist
Display enabled software repositories
repoinfo
Display information about enabled yum repositories
yum repoinfo rhel-7-server-rpms
see info on rhel-7-server-rpms repo
makecache
Download yum repository data to cache
Install/Remove/Update packages with YUM
install
Install a package from a repo to system
yum install vsftpd
install the vsftpd package
update
update one or all packages on system
yum update
update all packages with available updates
yum update httpd
update the httpd package(if available)
update-to
update package to a particular version
upgrade
update packages taking obsoletes into account
localinstall
install a package from a local file,http,or ftp
yum localinstall abc.i386.rpm
install abc package from local directory
yum localinstall http://myrepo/abc.i386.rpm
install abc from FTP site
downgrade
Downgrade a package to an earlier version
yum downgrade abc
Downgrade the abc package to an earlier version
reinstall
reinstall the current version of a package
yum reinstall util-liunx
reinstall util-liunx
swap
remove one package and install another
yum swap ftp lftp
remove ftp package and install lftp
erase
Erase a package
yum remove vsftpd
remove the vsftpd package and dependencies
remove 
same with erase
Troubleshooting
check
Check the local RPM database for problems
history
View and use yum transactions
yum history list
List all yum install,update and erase actions
yum history info 3
show details of yum transaction 3
clean
clear out cached package data
yum clean packages
Delete packages saved in cache
yum clean all
Clean out all packages and meta data from cache
YUM related command(install yum-utils)
reposync
Synchronize yum repositories to a local directory
reposync -r rhel-atomic-host-beta-rpms
Get packages from repo
options for YUM commands
-y
Assume yes if prompted
-v
produce extra debugging output
--downloadonly
Download to /var/cache/yum/arch/prod/repo/packages/,but dot't install
yum install --downlaodonly vsftpd
Download vsftpd package to cache
 
 
6. YUM 實踐
 
同使用 RPM 安裝 xterm 軟件的方式相似,這裏使用 yum 的方式安裝軟件 xterm:
[root@test ~]# yum repolist all
Loaded plugins: product-id, search-disabled-repos, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
repo id                                             repo name                                                                                  status
osp7_server                                         Red Hat Enterprise Linux Open Stack 7 Packages                                             enabled:    954
osp_optools_server                                  Red Hat Enterprise Linux Open Stack Tools Packages                                         disabled
osp_tools_server                                    Red Hat Enterprise Linux Open Stack Tools Packages                                         disabled
rhel-common                                         Red Hat Enterprise Linux 7.3 X86_64 Server Extra Packages                                  enabled:    228
rhel-extras                                         Red Hat Enterprise Linux 7.3 X86_64 Server Extra Packages                                  enabled:    465
rhel-optional                                       Red Hat Enterprise Linux 7.3 X86_64 Server Extra Packages                                  disabled
rhel-server                                         Red Hat Enterprise Linux 7.3 X86_64 Server Packages                                        enabled: 14,275
repolist: 15,922
 
[root@test ~]# yum list installed | grep xterm
[root@test ~]# yum list available | grep xterm
xterm.x86_64                             295-3.el7                   rhel-server
 
[root@test ~]# yum clean all
Loaded plugins: product-id, search-disabled-repos, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Cleaning repos: osp7_server rhel-common rhel-extras rhel-server
Cleaning up everything
 
[root@test ~]# yum install xterm
Loaded plugins: product-id, search-disabled-repos, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Bad id for repo: <repo_file_name>, byte = < 0
osp7_server                                                                                                                            | 2.9 kB  00:00:00
rhel-common                                                                                                                            | 2.9 kB  00:00:00
rhel-extras                                                                                                                            | 2.9 kB  00:00:00
rhel-server                                                                                                                            | 2.9 kB  00:00:00
(1/4): rhel-common/primary_db                                                                                                          | 102 kB  00:00:01
(2/4): rhel-extras/primary_db                                                                                                          | 184 kB  00:00:01
(3/4): osp7_server/primary_db                                                                                                          | 427 kB  00:00:02
(4/4): rhel-server/primary_db                                                                                                          |  27 MB  00:00:37
Resolving Dependencies
--> Running transaction check
---> Package xterm.x86_64 0:295-3.el7 will be installed
--> Processing Dependency: libXt.so.6()(64bit) for package: xterm-295-3.el7.x86_64
--> Processing Dependency: libXmu.so.6()(64bit) for package: xterm-295-3.el7.x86_64
--> Processing Dependency: libXaw.so.7()(64bit) for package: xterm-295-3.el7.x86_64
--> Running transaction check
---> Package libXaw.x86_64 0:1.0.12-5.el7 will be installed
---> Package libXmu.x86_64 0:1.1.2-2.el7 will be installed
---> Package libXt.x86_64 0:1.1.4-6.1.el7 will be installed
--> Finished Dependency Resolution
 
Dependencies Resolved
 
==============================================================================================================================================================
Package                           Arch                              Version                                     Repository                              Size
==============================================================================================================================================================
Installing:
xterm                             x86_64                            295-3.el7                                   rhel-server                            455 k
Installing for dependencies:
libXaw                            x86_64                            1.0.12-5.el7                                rhel-server                            190 k
libXmu                            x86_64                            1.1.2-2.el7                                 rhel-server                             71 k
libXt                             x86_64                            1.1.4-6.1.el7                               rhel-server                            173 k
 
Transaction Summary
==============================================================================================================================================================
Install  1 Package (+3 Dependent packages)
 
Total download size: 889 k
Installed size: 2.3 M
Is this ok [y/d/N]: y
Downloading packages:
(1/4): libXaw-1.0.12-5.el7.x86_64.rpm                                                                                                  | 190 kB  00:00:01
(2/4): libXt-1.1.4-6.1.el7.x86_64.rpm                                                                                                  | 173 kB  00:00:00
(3/4): libXmu-1.1.2-2.el7.x86_64.rpm                                                                                                   |  71 kB  00:00:01
(4/4): xterm-295-3.el7.x86_64.rpm                                                                                                      | 455 kB  00:00:00
--------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                         329 kB/s | 889 kB  00:00:02
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : libXt-1.1.4-6.1.el7.x86_64                                                                                                                 1/4
  Installing : libXmu-1.1.2-2.el7.x86_64                                                                                                                  2/4
  Installing : libXaw-1.0.12-5.el7.x86_64                                                                                                                 3/4
  Installing : xterm-295-3.el7.x86_64                                                                                                                     4/4
  Verifying  : libXaw-1.0.12-5.el7.x86_64                                                                                                                 1/4
  Verifying  : libXmu-1.1.2-2.el7.x86_64                                                                                                                  2/4
  Verifying  : libXt-1.1.4-6.1.el7.x86_64                                                                                                                 3/4
  Verifying  : xterm-295-3.el7.x86_64                                                                                                                     4/4
 
Installed:
  xterm.x86_64 0:295-3.el7
 
Dependency Installed:
  libXaw.x86_64 0:1.0.12-5.el7                        libXmu.x86_64 0:1.1.2-2.el7                        libXt.x86_64 0:1.1.4-6.1.el7
 
Complete!
[root@test ~]# yum remove xterm
Loaded plugins: product-id, search-disabled-repos, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Bad id for repo: <repo_file_name>, byte = < 0
Resolving Dependencies
--> Running transaction check
---> Package xterm.x86_64 0:295-3.el7 will be erased
--> Finished Dependency Resolution
 
Dependencies Resolved
 
==============================================================================================================================================================
Package                           Arch                               Version                                  Repository                                Size
==============================================================================================================================================================
Removing:
xterm                             x86_64                             295-3.el7                                @rhel-server                             1.2 M
 
Transaction Summary
==============================================================================================================================================================
Remove  1 Package
 
Installed size: 1.2 M
Is this ok [y/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Erasing    : xterm-295-3.el7.x86_64                                                                                                                     1/1
  Verifying  : xterm-295-3.el7.x86_64                                                                                                                     1/1
 
Removed:
  xterm.x86_64 0:295-3.el7
 
Complete!
 
[root@test ~]# yum install -y xterm
Loaded plugins: product-id, search-disabled-repos, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Resolving Dependencies
--> Running transaction check
---> Package xterm.x86_64 0:295-3.el7 will be installed
--> Finished Dependency Resolution
 
Dependencies Resolved
 
==============================================================================================================================================================
Package                            Arch                                Version                                Repository                                Size
==============================================================================================================================================================
Installing:
xterm                              x86_64                              295-3.el7                              rhel-server                              455 k
 
Transaction Summary
==============================================================================================================================================================
Install  1 Package
 
Total download size: 455 k
Installed size: 1.2 M
Downloading packages:
xterm-295-3.el7.x86_64.rpm                                                                                                             | 455 kB  00:00:01
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : xterm-295-3.el7.x86_64                                                                                                                     1/1
  Verifying  : xterm-295-3.el7.x86_64                                                                                                                     1/1
 
Installed:
  xterm.x86_64 0:295-3.el7
 
Complete!
yum clean all 以後再下載軟件包速度會變慢,由於緩存被清掉了。第二次再下載 xterm 包的時候速度就會快不少,由於這時候有緩存了。同時,第一次下載軟件包的時候,相應的依賴包也會下載,remove 軟件包 xterm 時,依賴包並無 remove,因此第二次安裝時只須要安裝一個 xterm rpm 包便可。 
 
7. YUM 配置 
前面 yum repolist 列了好幾個 repo,那麼這些 repo 是在哪裏配置的呢?
YUM 的 repo 配置是在 /etc/yum.repos.d/ 文件夾下配置的,文件下的 repo 文件以 .repo 結尾:
[root@test yum.repos.d]# ll /etc/yum.repos.d/
total 12
-rw-r--r--. 1 root root 1563 Mar 30  2019 lianhuasheng.repo
-rw-r--r--. 1 root root  358 Mar 30  2019 redhat.repo
 
打開文件 lianhuasheng.repo 看看裏面的內容:
## RHEL ###
[rhel-server]
name=Red Hat Enterprise Linux 7.3 X86_64 Server Packages
# mirrorlist = http://apt.sw.be/redhat/el5/en/mirrors-rpmforge
baseurl=http://10.57.0.1:80/rhel-7/rhel-x86_64-server-7
        http://10.57.217.11:80/rhel-7/rhel-x86_64-server-7
gpgcheck=0
enabled=1
failovermethod=priority
 
[rhel-extras]
name=Red Hat Enterprise Linux 7.3 X86_64 Server Extra Packages
# mirrorlist = http://apt.sw.be/redhat/$releasever/en/mirrors-rpmforge
baseurl=http://10.57.0.1:80/rhel-7/rhel-x86_64-server-extras-7/
gpgcheck=1
enabled=1
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY
exclude=cfengine nx-libs nxproxy nxagent libNX* libXcomp* perl-App-Daemon
...
 
各參數的意義以下:
rhel-server: repo 的 id,中括號不能少。id 是惟一的,不然 yum 不知道該用哪一個 id 下載軟件包和清單列表。
name: repo 的名字。
baseurl: 後接的是固定的 repo 地址,baseurl 能夠接多個 url 地址,參數 failovermethod 設置多個 url 的策略,它有兩個值 priority 和 roundrobin,priority 表示根據 url 順序從第一個開始選,roundrobin 則是隨機選擇 url,若是鏈接失敗了則選下一個。
enable: repo 是啓動的,讓 repo不啓動可將 enable 設爲 0。
gpgcheck: 是否驗證 RPM 證書,設爲 0 表示不驗證,設爲 1 則表示驗證證書,同時使用 gpgkey 參數指明須要驗證的證書位置。
mirrorlist: 列出容器使用的鏡像網址,yum 會自行取找鏡像網址。
exclude: 指定的軟件不能升級和安裝,* 表示通配符。
 
 
除了 repo 的配置文件以外,還有一個 YUM 的配置文件 yum.conf,在 /etc/ 目錄下:
[root@test yum.repos.d]$ cat /etc/yum.conf
[main]
cachedir=/var/cache/yum/$basearch/$releasever
keepcache=1
debuglevel=2
logfile=/var/log/yum.log
exactarch=1
obsoletes=1
gpgcheck=1
plugins=1
installonly_limit=5
pkgpolicy=newest
proxy=http://10.0.0.1:8080/
 
主要參數意義以下:
cachedir: yum 緩存的目錄,在此目錄下存下載的 rpm 包和數據庫(yum 的數據庫和 rpm 的數據庫是有關聯的,yum 下載的軟件包使用 rpm 命令也能夠 list 出來)。默認配置爲 /var/cache/yum。
keepcache: 安裝完成是否保留軟件包,0 爲不保留,1 爲保留。
exactarch: 值爲 1,則 yum 只會安裝和系統架構匹配的軟件包。例如,yum 不會將 i686 的軟件包安裝在 i386 的系統架構中。反之設爲 0 則會安裝。
logfile: yum 日誌文件位置。
obsoleters: 設爲 1 則表示容許更新老的 RPM 包。
gpgcheck: 作證書驗證。
plugins: 是否啓用插件, 1 表示啓用。
pkgpolicy:若是設置了多個 repository,而同一軟件在不一樣的 repository 中同時存在,yum 應該安裝哪個。可經過 pkgpolicy 指定,它有兩個值 newest 和 last,newest 表示 yum 會安裝最新的版本。若是是 last 的話,yum 會將服務器 id 以字母表順序排序,而後選擇最後的那個服務器上的軟件安裝。若是軟件的版本在多個 repo 中都是同樣的,yum 只會列出一個 repo 的軟件。
 
 
YUM 中的變量:
$releasever: 表明發行版的版本,從 [main] 部分的 distroverpkg 獲取(yum.conf 文件),若是沒有,則根據 redhat-release 包進行判斷。
$arch:cpu 架構,如 i686,athlon 等
$basearch:cpu 基本架構組,如 i686 和 athlon 同屬 i386,alpha 和 alphaev6 同屬 alpha。
 
 
8. 配置國內 YUM 源
配置官方的 yum 源須要向訂閱註冊(收費的),同時還會有下載不穩定的問題。能夠配置國內的 YUM 源快速安裝軟件。
中國科學技術大學 YUM 源:
# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#
 
[base]
name=CentOS-$releasever - Base - mirrors.ustc.edu.cn
baseurl=http://mirrors.ustc.edu.cn/centos/$releasever/os/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
gpgcheck=1
gpgkey=http://mirrors.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5
 
#released updates
[updates]
name=CentOS-$releasever - Updates - mirrors.ustc.edu.cn
baseurl=http://mirrors.ustc.edu.cn/centos/$releasever/updates/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
gpgcheck=1
gpgkey=http://mirrors.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5
 
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras - mirrors.ustc.edu.cn
baseurl=http://mirrors.ustc.edu.cn/centos/$releasever/extras/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
gpgcheck=1
gpgkey=http://mirrors.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5
 
#packages used/produced in the build but not released
[addons]
name=CentOS-$releasever - Addons - mirrors.ustc.edu.cn
baseurl=http://mirrors.ustc.edu.cn/centos/$releasever/addons/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=addons
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
 
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus - mirrors.ustc.edu.cn
baseurl=http://mirrors.ustc.edu.cn/centos/$releasever/centosplus/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
gpgcheck=1
enabled=0
gpgkey=http://mirrors.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5
 
#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib - mirrors.ustc.edu.cn
baseurl=http://mirrors.ustc.edu.cn/centos/$releasever/contrib/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib
gpgcheck=1
enabled=0
gpgkey=http://mirrors.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5
 
若是鏈接不上須要注意檢查是否是代理的問題,中科大源地址可點這裏
 
 
 
(完)
相關文章
相關標籤/搜索