1. 在修改前先备份该文件
cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
2. 修改更新源配置文件(CentOS6地址,其他版本类似)
vim打开配置文件:
vim /etc/yum.repos.d/CentOS-Base.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-$releasever - Base
baseurl=http://mirrors.oschina.com/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
[updates]
name=CentOS-$releasever - Updates
baseurl=http://mirrors.oschina.com/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
[addons]
name=CentOS-$releasever - Addons
baseurl=http://mirrors.oschina.com/centos/$releasever/addons/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
[extras]
name=CentOS-$releasever - Extras
baseurl=http://mirrors.oschina.com/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
[centosplus]
name=CentOS-$releasever - Plus
baseurl=http://mirrors.oschina.com/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
最后保存配置文件。
3. 更新yum源配置
yum update
尽管CentOS系统的yum源是免费的,但是由于其源内的软件更新较慢,所以国内一般使用163的yum源居多。启动CentOS系统,打开火狐浏览器
登录mirrors.163
点击centos后面的“centos使用帮助”
可以看到设置和使用163的yum源的方法步骤都说的一清二楚,按照说明 *** 作即可,特别值得注意的是“4小时更新一次”
根据自己的CentOS系统的版本下载相应的repo文件
火狐浏览器下载的文件默认保存在用户主目录的 Downloads文件夹中。
备份系统自带的repo文件:
指令如下: sudo mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
把163的repo文件移动到【/etc/yum.repos.d/】目录下。
指令如下:sudo mv Downloads/CentOS6-Base-163.repo /etc/yum.repos.d/
验证163的repo是否正确配置。
指令如下: yum repolist all
使用【yum clean all】清理旧包信息后就可以用163的yum源更新软件了
CentOS系统自带的更新源的速度实在是慢,为了让CentOS6使用速度更快的YUM更新源,可以选择163(网易)的更新源。1.下载repo文件
wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
2.备份并替换系统的repo文件
[root@localhost ~]# cd /etc/yum.repos.d/
[root@localhost ~]# mv CentOS-Base.repo CentOS-Base.repo.bak
[root@localhost ~]# mv CentOS6-Base-163.repo CentOS-Base.repo
3.执行yum源更新
[root@localhost ~]# yum clean all
[root@localhost ~]# yum makecache
[root@localhost ~]# yum update
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)