美文网首页
红帽系统更换CentOS源

红帽系统更换CentOS源

作者: 丑小雕 | 来源:发表于2017-03-15 15:27 被阅读0次

1. 首先到 http://mirrors.163.com/centos 下载软件包

i386地址:http://mirrors.163.com/centos/6/os/i386/Packages/
x86_64地址:http://mirrors.163.com/centos/6/os/x86_64/Packages/
必需要下载的软件包有(以64位系统为例):

python-iniparse-0.3.1-2.1.el6.noarch.rpm
yum-3.2.29-69.el6.centos.noarch.rpm
yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
yum-plugin-fastestmirror-1.1.30-30.el6.noarch.rpm

下载命令(以下仅前两个有效):

wget http://mirrors.163.com/centos/6/os/x86_64/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm
wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-3.2.29-69.el6.centos.noarch.rpm
wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.30-30.el6.noarch.rpm

经测试,以上命令仅仅前两个有效,后两个软件包需在http://mirrors.163.com/centos/6/os/x86_64/Packages手工下载下来,再安装。

2. 卸载RedHat自带的yum

rpm -qa | grepyum | xargs rpm -e --nodeps

3. 安装下载的centos的rpm包:

rpm -ivh python-iniparse-0.3.1-2.1.el6.noarch.rpm
rpm -ivh yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
rpm -ivhyum-3.2.29-69.el6.centos.noarch.rpm yum-plugin-fastestmirror-1.1.30-30.el6.noarch.rpm

4. 下载CentOS6-Base-163.repo文件

http://mirrors.163.com的centos帮助文档中下载CentOS6-Base-163.repo文件,存放到/etc/yum.repos.d中:

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

5. 编辑CentOS6-Base-163.repo文件

将 CentOS6-Base-163.repo 文件其中的 $releasever 更改为centos的版本号。
以下是修改好的(文件夹中有修改好的CentOS6-Base-163.repo,可直接替换后使用):

#CentOS-Base.repo
# Themirror system uses the connecting IP address of the client and the
# updatestatus of each mirror to pick mirrors that are updated to and
#geographically close to the client.  You should use this for CentOSupdates
#unless you are manually picking other mirrors.
# Ifthe mirrorlist= does not work for you, as a fall back you can try the
#remarked out baseurl= line instead.
[base]
name=CentOS-6- Base - 163.com
baseurl=http://mirrors.163.com/centos/6/os/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=os
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

#releasedupdates
[updates]
name=CentOS-6- Updates - 163.com
baseurl=http://mirrors.163.com/centos/6/updates/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=updates
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

#additionalpackages that may be useful
[extras]
name=CentOS-6- Extras - 163.com
baseurl=http://mirrors.163.com/centos/6/extras/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=extras
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

#additionalpackages that extend functionality of existing packages
[centosplus]
name=CentOS-6- Plus - 163.com
baseurl=http://mirrors.163.com/centos/6/centosplus/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=centosplus
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

#contrib- packages by Centos Users
[contrib]
name=CentOS-6- Contrib - 163.com
baseurl=http://mirrors.163.com/centos/6/contrib/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=contrib
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

6. 清除原有缓存

yum clean all

如果提示yum源被另一个进程锁住了错误,使用一下命令解锁:

rm -rf /var/run/yum.pid

7. 获取yum列表

yum makecache

出现下面提示,表示yum更改完成:
Metadata CacheCreated

相关文章

  • Rdhat红帽系统yum源更换centos源

    红帽yum源更换centos源 1卸载红帽yum源[root@localhost ~]# yum repolist...

  • 红帽系统更换CentOS源

    1. 首先到 http://mirrors.163.com/centos 下载软件包 i386地址:http://...

  • Centos7/8更换YUM阿里云源

    Centos 7 更换源: ** 备份 ** 下载Repo文件 ** 完成后执行** Centos 8 更换源: ...

  • 更换CENTOS 系统YUM源

    网易(163)yum源是国内最好的yum源之一 ,无论是速度还是软件版本,都非常的不错,将yum源设置为163yu...

  • ks8集群搭建

    .准备前工作 我们这里采用三台主机 系统CentOS 7.6 源更换为国内阿里源(这样下载速度更快)备份源 运行 ...

  • ansible EPRL源

    红帽(CentOS)需要配置EPEL源 RHEL/CentOS 6 yum installhttps://dl.f...

  • Django+Nginx+uwsgi+MySQL部署blog

    1.系统准备 centos7.5 python3的安装 升级 系统源及安装如下所需工具及环境 更换PIP源 编译安...

  • Windows CentOS Linux anaconda的国内

    Windows CentOS6/7 CentOS更换国内阿里下载源 Linux 换回默认conda源

  • linux学习笔记1

    开源系统:红帽RedHat、CentOS、Fedora、Debian、Ubuntu红帽认证:RHCSA系统管理员、...

  • 修改yum源

    1.系统版本 2.问题:yum安装报错 3.解决办法:更换yum源 3.1 下载163安装源CentOS6-Bas...

网友评论

      本文标题:红帽系统更换CentOS源

      本文链接:https://www.haomeiwen.com/subject/uwwlnttx.html