开源是一种精神,分享是一种美德!

centos7配置阿里云源

Linux W•X 434℃

1、备份

[root@bogon ~]# cd /etc/yum.repos.d/
[root@bogon yum.repos.d]# mkdir repo_bak
[root@bogon yum.repos.d]# mv *.repo repo_bak/
[root@bogon yum.repos.d]# ls
repo_bak

2、下载新的CentOS-Base.repo 到/etc/yum.repos.d/

[root@bogon yum.repos.d]# wget -O /etc/yum.repos.d/CentOS-Base.repo 
                          http://mirrors.aliyun.com/repo/Centos-7.repo

3、之后运行yum clean all 清除缓存,运行 yum makecache 生成新的缓存

[root@bogon yum.repos.d]# yum clean all
[root@bogon yum.repos.d]# yum makecache                                                                     | 166 kB  00:00:02   

安装EPEL(Extra Packages for Enterprise Linux )源

4、安装EPEL源

[root@bogon yum.repos.d]# yum list | grep epel-release
[root@bogon yum.repos.d]# yum install -y epel-release
[root@bogon yum.repos.d]# ls                     

5、再次运行yum clean all 清除缓存,运行 yum makecache 生成新的缓存

6、查看启用的yum源和所有的yum源

[root@bogon yum.repos.d]# yum repolist enabled               #查看启用的仓库
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * epel: mirrors.ustc.edu.cn
 * 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/x86_64                                    Extra Packages for Enterprise Linux 7 - x86_64                               12,277
extras/7/x86_64                                CentOS-7 - Extras - mirrors.aliyun.com                                          388
updates/7/x86_64                               CentOS-7 - Updates - mirrors.aliyun.com                                       1,929
repolist: 24,185
[root@bogon yum.repos.d]# yum repolist all                          #查看所有的仓库
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * epel: mirrors.ustc.edu.cn
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
repo id                                repo name                                                                   status
base/7/x86_64                          CentOS-7 - Base - mirrors.aliyun.com                                        enabled:  9,591
centosplus/7/x86_64                    CentOS-7 - Plus - mirrors.aliyun.com                                        disabled
contrib/7/x86_64                       CentOS-7 - Contrib - mirrors.aliyun.com                                     disabled
epel/x86_64                            Extra Packages for Enterprise Linux 7 - x86_64                              enabled: 12,277
epel-debuginfo/x86_64                  Extra Packages for Enterprise Linux 7 - x86_64 - Debug                      disabled
epel-source/x86_64                     Extra Packages for Enterprise Linux 7 - x86_64 - Source                     disabled
epel-testing/x86_64                    Extra Packages for Enterprise Linux 7 - Testing - x86_64                    disabled
epel-testing-debuginfo/x86_64          Extra Packages for Enterprise Linux 7 - Testing - x86_64 - Debug            disabled
epel-testing-source/x86_64             Extra Packages for Enterprise Linux 7 - Testing - x86_64 - Source           disabled
extras/7/x86_64                        CentOS-7 - Extras - mirrors.aliyun.com                                      enabled:    388
updates/7/x86_64                       CentOS-7 - Updates - mirrors.aliyun.com                                     enabled:  1,929
repolist: 24,185

转载请注明:LINUX! » centos7配置阿里云源

喜欢 (0)