redhat7.4修改yum 源为CentOS网易yum源

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了redhat7.4修改yum 源为CentOS网易yum源相关的知识,希望对你有一定的参考价值。

# 创建目录 

mkdir /data/tools/centos_yum

cd /data/tools/centos_yum


# 下载软件包,若地址不对,到此网站上找http://mirrors.163.com/centos/7/os/x86_64/Packages/

wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-3.4.3-154.el7.centos.noarch.rpm

wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-cron-3.4.3-154.el7.centos.noarch.rpm

wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm

wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-42.el7.noarch.rpm

wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-utils-1.1.31-42.el7.noarch.rpm

wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-updateonboot-1.1.31-42.el7.noarch.rpm


# 查看系统中已安装的软件包

rpm -qa | grep yum


# 卸载系统中已有的yum 软件,此处后面跟的软件为上条命令查询的结果,不要忘记最后的 --nodeps

rpm -e yum-langpacks-0.4.2-7.el7.noarch yum-3.4.3-154.el7.noarch yum-metadata-parser-1.1.4-10.el7.x86_64 yum-rhn-plugin-2.0.1-9.el7.noarch yum-utils-1.1.31-42.el7.noarch --nodeps


# 安装

rpm -ivh yum-*


# 写 yum 配置文件

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-$7 - Base - 163.com

#mirrorlist=http://mirrorlist.centos.org/?release=$7&arch=$basearch&repo=os

baseurl=http://mirrors.163.com/centos/7/os/$basearch/

gpgcheck=1

gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7


#released updates

[updates]

name=CentOS-$7 - Updates - 163.com

#mirrorlist=http://mirrorlist.centos.org/?release=$7&arch=$basearch&repo=updates

baseurl=http://mirrors.163.com/centos/7/updates/$basearch/

gpgcheck=1

gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7


#additional packages that may be useful

[extras]

name=CentOS-$7 - Extras - 163.com

#mirrorlist=http://mirrorlist.centos.org/?release=$7&arch=$basearch&repo=extras

baseurl=http://mirrors.163.com/centos/7/extras/$basearch/

gpgcheck=1

gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7


#additional packages that extend functionality of existing packages

[centosplus]

name=CentOS-$7 - Plus - 163.com

baseurl=http://mirrors.163.com/centos/7/centosplus/$basearch/

gpgcheck=1

enabled=0

gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7


*********************************************************************

yum clean all


以上是关于redhat7.4修改yum 源为CentOS网易yum源的主要内容,如果未能解决你的问题,请参考以下文章

修改CentOS默认yum源为国内yum镜像源

Linux修改yum源为阿里云网易中国科技大学

修改CentOS默认yum源为国内镜像

Linux(CentOS7.1)修改默认yum源为国内的阿里云yum源

Linux(CentOS7.1)修改默认yum源为国内的阿里云yum源

修改CentOS的yum源为国内yum镜像源