作者:个阖家团圆 | 来源:互联网 | 2023-12-11 16:09
1. 备份现在的源文件
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
2. 下载163源
cd /etc/yum.repos.d/
wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
3. 把下载文件改成源文件
mv CentOS6-Base-163.repo CentOS-Base.repo
4. 更新列表
yum makecache
5. 更新系统
yum update
执行如下命令:
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.old
vim /etc/yum.repos.d/CentOS-Base.repo (粘贴下面的更新源地址,[小提示]vim粘贴方法:首先选中更新源地址内容,然后在vim中按下字母i进入编辑模式,然后点击鼠标中间,即可粘贴刚才选中的内容)
yum update
更新源地址如下:
[base]
name=CentOS-6 - Base
repo=os
baseurl=http://mirrors.163.com/centos/6.4/os/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
#released updates
[update]
name=CentOS-6 - Updates
baseurl=http://mirrors.163.com/centos/6.4/updates/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
#packages used/produced in the build but not released
#[addons]
#name=CentOS-6 - Addons
#baseurl=http://mirrors.163.com/centos/6.4/addons/$basearch/
#gpgcheck=1
#gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
#additional packages that may be useful
[extras]
name=CentOS-6 - Extras
baseurl=http://mirrors.163.com/centos/6.4/extras/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-6 - Plus
baseurl=http://mirrors.163.com/centos/6.4/centosplus/$basearch/
gpgcheck=1
enabled=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
#contrib - packages by Centos Users
[contrib]
name=CentOS-6 - Contrib
baseurl=http://mirrors.163.com/centos/6.4/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6