Linux更换yum源

Linux更换yum源,第1张

有时候CentOS默认的yum源不一定是国内镜像,导致yum在线安装及更新速度不是很理想。这时候需要将yum源设置为国内镜像站点。国内主要开源的开源镜像站点应该是网易和阿里云了。

[wujiahao@47.98.32.222 ~]# mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

[wujiahao@47.98.32.222 ~]]# cd /etc/yum.repos.d/

[wujiahao@47.98.32.222 yum.repos.d]# wget http://mirrors.163.com/.help/CentOS7-Base-163.repo

[wujiahao@47.98.32.222 yum.repos.d]# wget http://mirrors.163.com/.help/CentOS6-Base-163.repo

[wujiahao@47.98.32.222 yum.repos.d]# wget http://mirrors.163.com/.help/CentOS5-Base-163.repo

[wujiahao@47.98.32.222 yum.repos.d]# yum makecache

[wujiahao@47.98.32.222 yum.repos.d]# yum -y update

[wujiahao@47.98.32.222 ~]# mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

[wujiahao@47.98.32.222 ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

[wujiahao@47.98.32.222 ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo

[wujiahao@47.98.32.222 ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo

[wujiahao@47.98.32.222 ~]# yum makecache

[wujiahao@47.98.32.222 ~]# yum -y update

更改linux YUM源方法:

第一步:进入yum配置文件目录:

cd /etc/yum.repos.d/

第二步:备份配置文件:

mv CentOS-Base.repo CentOS-Base.repo.bak

第三步:下载网易的配置(或其他源配置文件):

wget http://mirrors.163.com/.help/CentOS6-Base-163.repo

下载下来的文件名为 CentOS6-Base-163.repo

第四步:重命名(重命名成配置文件中要求的文件名)

mv CentOS6-Base-163.repo CentOS-Base.repo

第五步:更新:

几个国内速度最快的centos yum(更新源)

2014-01-09

中国科技大学源

cd /etc/yum.repos.d mv CentOS-Base.repo CentOS-Base.repo.save

wget http://centos.ustc.edu.cn/CentOS-Base.repo.5

mv CentOS-Base.repo.5 CentOS-Base.repo

yum update

PS:如果在配置YUM源后,第一次运行yum update命令,出现如下错误。

warning: rpmts_HdrFromFdno: Header V3 DSA signature: NOKEY, key ID*****

这是由于yum安装了旧版本的GPG keys造成的,解决办法就是

rpm –import /etc/pki/rpm-gpg/RPM-GPG-KEY*

网易源 mirrors.163.com

先关闭 fastestmirror

“vi /etc/yum/pluginconf.d/fastestmirror.conf” and set “enable=0″

cd /etc/yum.repos.d/

wget http://mirrors.163.com/.help/CentOS-Base-163.repo

yum makecache //生成缓存

yum update

搜狐源 mirrors.sohu.com

步骤同上,只是源链接修改为:

http://mirrors.sohu.com/help/CentOS-Base-sohu.repo

CentOS 官方镜像列表

http://www.centos.org/modules/tinycontent/index.php?id=32

CentOS 国内镜像

http://mirrors.163.com/centos/(浙江省杭州市电信,武汉电信访问快)

http://mirrors.sohu.com/centos/(山东省联通)

http:://mirrors.shlug.org/centos/(上海市电信真如IDC机房,武汉电信访问慢)

http://mirrors.ta139.com/centos/(移动线路,武汉电信访问快)

http://centos.ustc.edu.cn/centos/(中国科学技术大学,教育网线路 -官方镜像)

http://mirror.centos.net.cn/(北京市网通,-官方镜像)


欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/yw/7405786.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-04-05
下一篇2023-04-05

发表评论

登录后才能评论

评论列表(0条)

    保存