-
因为 redhat 的 yum 是收费,所以需要换成 Centos 的 yum 才可以
-
首先,卸载 redhat 的 yum 软件
sudo rpm -qa|grep yum
-
其次,下载 Centos yum rpm 包, 并安装
sudo wget http://vault.centos.org/7.5.1804/os/x86_64/Packages/yum-3.4.3-158.el7.centos.noarch.rpm
sudo wget http://vault.centos.org/7.5.1804/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
sudo wget http://vault.centos.org/7.5.1804/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-45.el7.noarch.rpm
sudo wget http://vault.centos.org/7.5.1804/os/x86_64/Packages/python-iniparse-0.4-9.el7.noarch.rpm
sudo wget http://vault.centos.org/7.5.1804/os/x86_64/Packages/python-urlgrabber-3.10-8.el7.noarch.rpm
sudo rpm -ivh python-iniparse-0.4-9.el7.noarch.rpm
sudo rpm -ivh python-urlgrabber-3.10-8.el7.noarch.rpm
sudo rpm -ivh yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
sudo rpm -ivh yum-plugin-fastestmirror-1.1.31-45.el7.noarch.rpm yum-3.4.3-158.el7.centos.noarch.rpm
-
运行查看 yum 版本
yum -v
-
下载一个 Centos7 repo 模板
sudo wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
-
修改这个模板的内容 如下:
[base]
name=CentOS-$releasever - Base
baseurl=http://vault.centos.org/7.5.1804/os/$basearch/
gpgcheck=1
gpgkey=http://vault.centos.org/7.5.1804/os/x86_64/RPM-GPG-KEY-CentOS-7
#released updates
[updates]
name=CentOS-$releasever - Updates
baseurl=http://vault.centos.org/7.5.1804/updates/$basearch/
gpgcheck=1
gpgkey=http://vault.centos.org/7.5.1804//os/x86_64/RPM-GPG-KEY-CentOS-7
[extras]
name=CentOS-$releasever - Extras
baseurl=http://vault.centos.org/7.5.1804//extras//$basearch/
gpgcheck=1
gpgkey=http://vault.centos.org/7.5.1804/os/x86_64/RPM-GPG-KEY-CentOS-7
[centosplus]
name=CentOS-$releasever - Plus
baseurl=http://vault.centos.org/7.5.1804/centosplus//$basearch/
gpgcheck=1
enabled=0
-
执行更新源的操作
sudo yum clean all && yum makecache
-
注释:
一开始我本来想使用 163 或者是清华或者是阿里的,但是找了一下,这三个 7.5的源都没有文件了。后面找了一下 http://vault.centos.org/ 这个网站才有
后面有更换源的操作,可以参考上面,只要把版本换一下就可以了。