1500字范文,内容丰富有趣,写作好帮手!
1500字范文 > Redhat7更改网易yum源

Redhat7更改网易yum源

时间:2022-03-23 20:19:35

相关推荐

Redhat7更改网易yum源

说明

之前写了一篇关于Redhat6更换Yum源的文章,时隔已久很多包都变了,正好最近搭建环境需要用到Redhat7.3所以就再记录一下如何更换为国内最新最常用的yum源。

操作步骤

1.卸载系统自带包

[root@rhl73 ~]# rpm -qa | grep yum

查出以下包:

yum-utils-1.1.31-40.el7.noarchyum-langpacks-0.4.2-7.el7.noarchyum-rhn-plugin-2.0.1-6.el7.noarchyum-metadata-parser-1.1.4-10.el7.x86_64yum-3.4.3-150.el7.noarch

执行卸载

rpm -e yum-utils-1.1.31-40.el7.noarch --nodepsrpm -e yum-langpacks-0.4.2-7.el7.noarch --nodepsrpm -e yum-metadata-parser-1.1.4-10.el7.x86_64 --nodepsrpm -e yum-rhn-plugin-2.0.1-6.el7.noarch --nodepsrpm -e yum-3.4.3-150.el7.noarch --nodeps# 或者执行rpm -qa | grep yum | xargs rpm -e --nodeps rpm -qa | grep python-urlgrabber|xargs rpm -e --nodeps

注意:涉及到版本号的地方以你实际环境为准。

2.下载新的 yum 软件包

此处我就下载到repo目录下了。

# 进入repo目录cd /etc/yum.repos.d# 备份一下旧的repomv redhat.repo redhat.repo.bak# 下载 yum 的相关安装包wget /centos/7/os/x86_64/Packages/yum-3.4.3-168.el7.centos.noarch.rpmwget /centos/7/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpmwget /centos/7/os/x86_64/Packages/yum-utils-1.1.31-54.el7_8.noarch.rpmwget /centos/7/os/x86_64/Packages/yum-updateonboot-1.1.31-54.el7_8.noarch.rpmwget /centos/7/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-54.el7_8.noarch.rpm# 下载 yum 安装包相关的依赖包wget /centos/7/os/x86_64/Packages/python-urlgrabber-3.10-10.el7.noarch.rpmwget /centos/7/os/x86_64/Packages/rpm-4.11.3-45.el7.x86_64.rpm

3.安装新yum

注意先装2个依赖包:

rpm -ivh python-urlgrabber-3.10-10.el7.noarch.rpmrpm -ivh rpm-4.11.3-45.el7.x86_64.rpm --force

接下来装其他:

rpm -ivh yum*

4.创建新的repo文件

还是在repo目录/etc/yum.repos.d下,创建:CentOS-Base.repo

vim 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 - #mirrorlist=/?release=$7&arch=$basearch&repo=osbaseurl=/centos/7/os/$basearch/gpgcheck=1gpgkey=/centos/RPM-GPG-KEY-CentOS-7#released updates[updates]name=CentOS-$7 - Updates - #mirrorlist=/?release=$7&arch=$basearch&repo=updatesbaseurl=/centos/7/updates/$basearch/gpgcheck=1gpgkey=/centos/RPM-GPG-KEY-CentOS-7#additional packages that may be useful[extras]name=CentOS-$7 - Extras - #mirrorlist=/?release=$7&arch=$basearch&repo=extrasbaseurl=/centos/7/extras/$basearch/gpgcheck=1gpgkey=/centos/RPM-GPG-KEY-CentOS-7#additional packages that extend functionality of existing packages[centosplus]name=CentOS-$7 - Plus - baseurl=/centos/7/centosplus/$basearch/gpgcheck=1enabled=0gpgkey=/centos/RPM-GPG-KEY-CentOS-7

5.生成缓存

依次执行命令:

yum clean allyum makecache

测试更新wget

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。