Loading

CentOS7 配置阿里云yum源

首先把selinux给禁用掉,不禁用有时候会各种各样的错误

 

查看

[root@localhost ~]# getenforce
Enforcing

 

永久关闭

[root@localhost ~]# vi /etc/selinux/config

 

 

修改

SELINUX=disabled 

 

设置后需要重启才能生效

[root@localhost ~]# reboot

 

先执行

[root@localhost ~]# curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
[root@localhost ~]# yum -y install yum-utils
[root@localhost ~]# yum install wget

 

备份

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

 

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

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

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

[root@localhost yum.repos.d]# yum clean all
[root@localhost yum.repos.d]# yum makecache

 

posted @ 2019-07-06 18:57  Reasonzzy  阅读(16627)  评论(2编辑  收藏  举报