您现在的位置是:首页 > 文章详情

把默认的CentOS yum源修改成国内的aliyun yum源

日期:2017-12-02点击:790

阿里云官方教程:http://mirrors.aliyun.com/help/centos

1.安装Centos后默认的yum源如下

 [root@kangvcar ~]# ll /etc/yum.repos.d/ total 32 -rw-r--r--. 1 root root 1664 Dec 9 2015 CentOS-Base.repo -rw-r--r--. 1 root root 1309 Dec 9 2015 CentOS-CR.repo -rw-r--r--. 1 root root 649 Dec 9 2015 CentOS-Debuginfo.repo -rw-r--r--. 1 root root 290 Dec 9 2015 CentOS-fasttrack.repo -rw-r--r--. 1 root root 630 Dec 9 2015 CentOS-Media.repo -rw-r--r--. 1 root root 1331 Dec 9 2015 CentOS-Sources.repo -rw-r--r--. 1 root root 1952 Dec 9 2015 CentOS-Vault.repo

2.把默认yum源备份(可选)

 [root@kangvcar ~]# mkdir /opt/centos-yum.bak [root@kangvcar ~]# mv /etc/yum.repos.d/* /opt/centos-yum.bak/

3.下载aliyun yum源repo文件(对应自己的系统版本下载即可)

 #各系统版本repo文件对应的下载操作 CentOS 5 wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo CentOS 6 wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo CentOS 7 wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

 [root@kangvcar ~]# cat /etc/redhat-release //查看系统的版本 CentOS Linux release 7.2.1511 (Core) [root@kangvcar ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo --2017-06-20 06:43:08-- http://mirrors.aliyun.com/repo/Centos-7.repo Resolving mirrors.aliyun.com (mirrors.aliyun.com)... 112.124.140.210, 115.28.122.210 Connecting to mirrors.aliyun.com (mirrors.aliyun.com)|112.124.140.210|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 2573 (2.5K) [application/octet-stream] Saving to: ‘/etc/yum.repos.d/CentOS-Base.repo’ 100%[=======================================================================================================>] 2,573 --.-K/s in 0s 2017-06-20 06:43:08 (118 MB/s) - ‘/etc/yum.repos.d/CentOS-Base.repo’ saved [2573/2573]

4.清除缓存

 [root@kangvcar ~]# yum clean all Loaded plugins: fastestmirror Cleaning repos: base extras updates Cleaning up everything Cleaning up list of fastest mirrors [root@kangvcar ~]# yum makecache //把yum源缓存到本地,加快软件的搜索好安装速度 [root@kangvcar ~]# yum list //总共列出了9954个包
原文链接:https://www.centoschina.cn/course/config-centos/9361.html
关注公众号

低调大师中文资讯倾力打造互联网数据资讯、行业资源、电子商务、移动互联网、网络营销平台。

持续更新报道IT业界、互联网、市场资讯、驱动更新,是最及时权威的产业资讯及硬件资讯报道平台。

转载内容版权归作者及来源网站所有,本站原创内容转载请注明来源。

文章评论

共有0条评论来说两句吧...

文章二维码

扫描即可查看该文章

点击排行

推荐阅读

最新文章