当前位置:   article > 正文

redhat7.6配置网络yum源_rhel7.6 yum的yum仓库的网络源地址

rhel7.6 yum的yum仓库的网络源地址

删除系统自带yum软件包

查看系统版本
[root@localhost ~]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.6 (Maipo)
查看自带yum软件包
[root@localhost ~]# rpm -qa|grep yum
yum-utils-1.1.31-50.el7.noarch
yum-rhn-plugin-2.0.1-10.el7.noarch
yum-metadata-parser-1.1.4-10.el7.x86_64
yum-3.4.3-161.el7.noarch
PackageKit-yum-1.1.10-1.el7.x86_64
yum-langpacks-0.4.2-7.el7.noarch
删除自带yum软件包
[root@localhost ~]# rpm -qa|grep yum|xargs rpm -e --nodeps
警告:/etc/yum/pluginconf.d/langpacks.conf 已另存为 /etc/yum/pluginconf.d/langpacks.conf.rpmsave
[root@localhost ~]# rpm -qa | grep python-urlgrabber | xargs rpm -e --nodeps
查看
[root@localhost ~]# rpm -qa|grep yum
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17

下载开源rpm包

我使用的是网易的

wget http://mirrors.163.com/centos/7/os/x86_64/Packages/python-urlgrabber-3.10-10.el7.noarch.rpm
wget http://mirrors.163.com/centos/7/os/x86_64/Packages/rpm-4.11.3-45.el7.x86_64.rpm 
wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-3.4.3-168.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-54.el7_8.noarch.rpm
  • 1
  • 2
  • 3
  • 4
  • 5

安装rpm包

[root@localhost ~]# rpm -ivh yum-*
警告:yum-3.4.3-168.el7.centos.noarch.rpm:V3 RSA/SHA256 Signature, 密钥 ID f4a80eb5: NOKEY
警告:软件包 yum-3.4.3-168.el7.centos.noarch 已被加入,跳过 yum-3.4.3-168.el7.centos.noarch
错误:依赖检测失败:
	python-urlgrabber >= 3.10-8 被 yum-3.4.3-168.el7.centos.noarch 需要
  • 1
  • 2
  • 3
  • 4
  • 5

发现报错,缺少依赖,重新下载所缺依赖
下载后发现依旧没有改变,仍然报错
于是我选择强制安装所缺少的依赖
[root@localhost ~]# rpm -ivh --force python-urlgrabber-3.10-10.el7.noarch.rpm
警告:python-urlgrabber-3.10-10.el7.noarch.rpm: 头V3 RSA/SHA256 Signature, 密钥 ID f4a80eb5: NOKEY
准备中… ################################# [100%]
正在升级/安装…
1:python-urlgrabber-3.10-10.el7 ################################# [100%]
安装rpm包
[root@localhost ~]# rpm -ivh yum-*
警告:yum-3.4.3-168.el7.centos.noarch.rpm: 头V3 RSA/SHA256 Signature, 密钥 ID f4a80eb5: NOKEY
警告:软件包 yum-3.4.3-168.el7.centos.noarch 已被加入,跳过 yum-3.4.3-168.el7.centos.noarch
准备中… ################################# [100%]
正在升级/安装…
1:yum-metadata-parser-1.1.4-10.el7 ################################# [ 33%]
2:yum-plugin-fastestmirror-1.1.31-5################################# [ 67%]
3:yum-3.4.3-168.el7.centos ################################# [100%]
发现安装成功

下载并修改配置文件

进入配置文件目录

[root@localhost ~]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# ls
redhat.repo
  • 1
  • 2
  • 3

下载配置文件

[root@localhost yum.repos.d]# wget http://mirrors.163.com/.help/CentOS7-Base-163.repo
--2021-12-20 17:48:04--  http://mirrors.163.com/.help/CentOS7-Base-163.repo
正在解析主机 mirrors.163.com (mirrors.163.com)... 59.111.0.251
正在连接 mirrors.163.com (mirrors.163.com)|59.111.0.251|:80... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:1572 (1.5K) [application/octet-stream]
正在保存至: “CentOS7-Base-163.repo”

100%[===============================================================>] 1,572       --.-K/s 用时 0s      

2021-12-20 17:48:29 (186 MB/s) - 已保存 “CentOS7-Base-163.repo” [1572/1572])

[root@localhost yum.repos.d]# ls
CentOS7-Base-163.repo  redhat.repo
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14

移动或者备份原yum配置文件

[root@localhost yum.repos.d]# mv redhat.repo /etc/repo1
[root@localhost yum.repos.d]# ls
CentOS7-Base-163.repo
  • 1
  • 2
  • 3

修改配置文件

[base]
name=CentOS-$releasever - Base - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
baseurl=http://mirrors.163.com/centos/7/os/$basearch/
enabled=1
gpgcheck=0
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7

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

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
baseurl=http://mirrors.163.com/centos/7/os/$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-$releasever - Plus - 163.com
baseurl=http://mirrors.163.com/centos/7/os/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31

清除原缓存,并更新

清除缓存

[root@localhost yum.repos.d]# yum clean all 
已加载插件:fastestmirror, product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
正在清理软件源: base extras updates
Cleaning up list of fastest mirrors
  • 1
  • 2
  • 3
  • 4
  • 5

建立缓存

[root@localhost yum.repos.d]# yum makecache
已加载插件:fastestmirror, product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
Determining fastest mirrors
base                                                                            | 3.6 kB  00:00:00     
extras                                                                          | 3.6 kB  00:00:00     
updates                                                                         | 3.6 kB  00:00:00     
(1/12): base/x86_64/group_gz                                                    | 153 kB  00:00:26     
(2/12): base/x86_64/filelists_db                                                | 7.2 MB  00:00:29     
(3/12): base/x86_64/other_db                                                    | 2.6 MB  00:00:01     
(4/12): extras/x86_64/group_gz                                                  | 153 kB  00:00:00     
(5/12): extras/x86_64/filelists_db                                              | 7.2 MB  00:00:04     
(6/12): base/x86_64/primary_db                                                  | 6.1 MB  00:00:09     
(7/12): extras/x86_64/other_db                                                  | 2.6 MB  00:00:03     
(8/12): extras/x86_64/primary_db                                                | 6.1 MB  00:00:03     
(9/12): updates/x86_64/group_gz                                                 | 153 kB  00:00:00     
(10/12): updates/x86_64/filelists_db                                            | 7.2 MB  00:00:03     
(11/12): updates/x86_64/other_db                                                | 2.6 MB  00:00:01     
(12/12): updates/x86_64/primary_db                                              | 6.1 MB  00:00:06     
元数据缓存已建立
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20

此时yum源就配置完成啦

测试

[root@localhost /]# yum install -y ipvsadm
已加载插件:fastestmirror, product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
Loading mirror speeds from cached hostfile
正在解决依赖关系
--> 正在检查事务
---> 软件包 ipvsadm.x86_64.0.1.27-8.el7 将被 安装
--> 解决依赖关系完成

依赖关系解决
.
.
.
  正在安装    : ipvsadm-1.27-8.el7.x86_64                                                          1/1 
  验证中      : ipvsadm-1.27-8.el7.x86_64                                                          1/1 

已安装:
  ipvsadm.x86_64 0:1.27-8.el7                                                                          

完毕!
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/Monodyee/article/detail/595977
推荐阅读
相关标签
  

闽ICP备14008679号