Redhat7 更換Centos 7 yum源
6、卸載redhat自帶的yum
| rpm -qa | grep yum | xargs rpm -e –nodeps |
註:a、xargs是一條Unix和類Unix操作系統的常用命令。它的作用是將參數列錶轉換成小塊分段傳遞給其他命令,以避免參數列表過長的問題
b、–nodeps 強制卸載,不管依賴性
7、下載centos的yum安裝包,路徑同2,可以直接使用下列鏈接
需要下載python-urlgrabber-3.10-8.el7.noarch.rpm
卸載原先的python-urlgrabber-3.10-4.el7.noarch.rpm
| wget http://mirrors.163.com/centos/7/os/x86_64/Packages/python-iniparse-0.4-9.el7.noarch.rpm
wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-3.4.3-125.el7.centos.noarch.rpm wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-29.el7.noarch.rpm |
注意:安裝包都在不斷更新,請按照包名自己匹配.
8、安裝以上下載包
| rpm -ivh python-iniparse-0.4-9.el7.noarch.rpm
rpm -ivh yum-metadata-parser-1.1.4-10.el7.x86_64.rpm rpm -ivh yum-3.4.3-125.el7.centos.noarch.rpm yum-plugin-fastestmirror-1.1.31-29.el7.noarch.rpm |
[注] :最後2個需要一起安裝,否則會出現依賴性錯誤
9、下載repo文件,注意切換目錄
當然你可以簡單點,直接將10中的repo複製,並在yum.repos.d目錄新建*******.repo文件
| cd /etc/yum.repos.d/
wget http://mirrors.163.com/.help/CentOS7-Base-163.repo |
10、編輯CentOS7-Base-163.repo文件,將其中的$releasever更改為centos的版本號7
repo參考:
| # CentOS-Base.repo
# # The mirror system uses the connecting IP address of the client and the # update status of each mirror to pick mirrors that are updated to and # geographically close to the client. You should use this for CentOS updates # unless you are manually picking other mirrors. # # If the mirrorlist= does not work for you, as a fall back you can try the # remarked out baseurl= line instead. # # [base] name=CentOS-7 – Base – 163.com #mirrorlist=http://mirrorlist.centos.org/?release=7&arch=$basearch&repo=os baseurl=http://mirrors.163.com/centos/7/os/$basearch/ gpgcheck=1 gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7 #released updates [updates] name=CentOS-7 – Updates – 163.com #mirrorlist=http://mirrorlist.centos.org/?release=7&arch=$basearch&repo=updates baseurl=http://mirrors.163.com/centos/7/updates/$basearch/ gpgcheck=1 gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7 #additional packages that may be useful [extras] name=CentOS-7 – Extras – 163.com #mirrorlist=http://mirrorlist.centos.org/?release=7&arch=$basearch&repo=extras baseurl=http://mirrors.163.com/centos/7/extras/$basearch/ gpgcheck=1 gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7 #additional packages that extend functionality of existing packages [centosplus] name=CentOS-7 – Plus – 163.com baseurl=http://mirrors.163.com/centos/7/centosplus/$basearch/ gpgcheck=1 enabled=0 gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7 |
11、yum clean all 清除原有緩存
12、yum makecache 獲取yum列表
出現下面提示,表示yum更改完成:
Metadata Cache Created
以下文章點擊率最高
Loading…