[setup] centos配置yum源
yum是一种管理软件的工具,好比360软件管家一样,yum会从不同的reposity去搜索你想要下载的软件,然后挑选一个速度最快的来下载
[root@centos6 etc]# ls -l yum.repos.d
total 24
-rw-r--r--. 1 root root 1991 Oct 23 2014 CentOS-Base.repo
-rw-r--r--. 1 root root 647 Oct 23 2014 CentOS-Debuginfo.repo
-rw-r--r--. 1 root root 289 Oct 23 2014 CentOS-fasttrack.repo
-rw-r--r--. 1 root root 630 Oct 23 2014 CentOS-Media.repo
-rw-r--r--. 1 root root 5394 Oct 23 2014 CentOS-Vault.repo
目前linux的版本是centos6,现在一共有5个repo,当然可以配置更多的repo,比如centos7就有很多个
[root@centos7 etc]# ls -ls yum.repos.d
total 56
4 -rw-r--r--. 1 root root 1664 Dec 9 17:59 CentOS-Base.repo
4 -rw-r--r--. 1 root root 1309 Dec 9 17:59 CentOS-CR.repo
4 -rw-r--r--. 1 root root 649 Dec 9 17:59 CentOS-Debuginfo.repo
4 -rw-r--r--. 1 root root 290 Dec 9 17:59 CentOS-fasttrack.repo
4 -rw-r--r--. 1 root root 630 Dec 9 17:59 CentOS-Media.repo
4 -rw-r--r--. 1 root root 1331 Dec 9 17:59 CentOS-Sources.repo
4 -rw-r--r--. 1 root root 1952 Dec 9 17:59 CentOS-Vault.repo
4 -rw-r--r--. 1 root root 209 Jan 7 17:32 dag.repo
4 -rw-r--r--. 1 root root 957 Nov 26 2014 epel.repo
4 -rw-r--r--. 1 root root 1056 Nov 26 2014 epel-testing.repo
4 -rw-r--r--. 1 root root 739 Jun 12 2014 mirrors-rpmforge
4 -rw-r--r--. 1 root root 717 Jun 12 2014 mirrors-rpmforge-extras
4 -rw-r--r--. 1 root root 728 Jun 12 2014 mirrors-rpmforge-testing
4 -rw-r--r--. 1 root root 1128 Dec 18 09:34 rpmforge.repo
每个repo里面存放着mirrorlist
[root@centos6 yum.repos.d]# cat CentOS-Base.repo # 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 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-6 #released updates [updates] name=CentOS-$releasever - Updates mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra #baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6 #additional packages that may be useful [extras] name=CentOS-$releasever - Extras mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra #baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6 #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-6 #contrib - packages by Centos Users [contrib] name=CentOS-$releasever - Contrib mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib&infra=$infra #baseurl=http://mirror.centos.org/centos/$releasever/contrib/$basearch/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
如果要添加更多的repo,只需要一行命令就可以了,比如这样
[root@centos6 yum.repos.d]# rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
Retrieving http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
warning: /var/tmp/rpm-tmp.efj7yh: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Preparing... ########################################### [100%]
1:epel-release ########################################### [100%]
其他repo有如下推荐:Top 5 Yum Repositories for CentOS/RHEL 7/6/5 and Fedora