redhat系統中,若是你想要更新yum倉庫,它會提示讓你註冊才能更新,由於centos和redhat基本相同,因此我把yum這一套全換成centos的。node
cd /etc/rpm/
rm -rf ./m*
複製代碼
22 wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
24 wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-utils-1.1.31-40.el7.noarch.rpm
25 wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-3.4.3-158.el7.centos.noarch.rpm
26 wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-45.el7.noarch.rpm
28 wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/python-urlgrabber-3.10-8.el7.noarch.rpm
複製代碼
若是出現404錯誤,請去https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/搜索關鍵詞查詢最新rpm包的連接。python
--force --nodeps爲忽略依賴檢測的強制安裝shell
rpm -ivh python-urlgrabber-3.10-8.el7.noarch.rpm --force --nodeps
rpm -ivh yum* --force --nodeps
複製代碼
[root@localhost yum.repos.d]# rpm -qa |grep yum
yum-metadata-parser-1.1.4-10.el7.x86_64
yum-utils-1.1.31-45.el7.noarch
yum-3.4.3-158.el7.centos.noarch
yum-plugin-fastestmirror-1.1.31-45.el7.noarch
複製代碼
下載源文件vim
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
複製代碼
須要把Centos-7.repo文件中的$releasever所有替換爲7centos
67 cd /etc/yum.repos.d/
68 ls
69 vim CentOS-Base.repo
複製代碼
在vim中執行:%s/$releasever/7/g
快速替換。保存退出。bash
yum clean all
yum update
# 最後查看一下yum列表
yum list
複製代碼