首先把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