第一步:替换源
方式一:使用国内的阿里云镜像
把/etc/yum.repos.d/下面所有的源给删除掉了
下载镜像
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
方式二:使用官网的镜像
(1)把/etc/yum.repos.d/下面所有的源给删除掉了
(2)执行下面的命令,重新生成镜像
//执行这个命令之后
rpm -Uvh --force http://mirror.centos.org/centos-7/7/os/x86_64/Packages/centos-release-7-4.1708.el7.centos.x86_64.rpm
第二步:更新yum
rpm -e rpmforge-release --nodeps
yum clean all
yum update
第三步:执行yum install
如出现:如下错误
Loaded plugins: fastestmirror, refresh-packagekit, security
执行以下操作:
vi /etc/yum/pluginconf.d/fastestmirror.conf
把enabled=1改为0
vi /etc/yum.conf
把plugins=1改为0
yum>sed -i “s/plugins=1/plugins=0” /etc/yum.conf
yum clean all