在CentOS 7上更新yum源,可以按照以下步驟進(jìn)行操作:
打開(kāi)終端,以root用戶身份登錄。
備份原始的yum源配置文件:
cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
編輯CentOS-Base.repo文件:
vi /etc/yum.repos.d/CentOS-Base.repo
在文件中,將[base]、[updates]、[extras]、[centosplus]等節(jié)的baseurl
和mirrorlist
行注釋掉(在行首添加#符號(hào)),然后將以下內(nèi)容添加到每個(gè)節(jié)的末尾:
baseurl=http://mirrors.163.com/centos/$releasever/os/$basearch/
保存并退出vi編輯器。
清理yum緩存:
yum clean all
更新yum源:
yum makecache
現(xiàn)在,您的CentOS 7系統(tǒng)的yum源已經(jīng)成功更新為163.com的鏡像源。您可以使用yum命令來(lái)安裝、更新和刪除軟件包。