rhel7配置yum本地源和网络源

redhat 的更新包只对注册的用户生效,所以我们自己手动更改成CentOS 的更新包,CentOS几乎和redhat是一样的,所以无需担心软件包是否可安装,安装之后是否有问题,另外CentOS公司去年已经被Redhat 收购了,不说费话了,我们还是来操作吧! 
1、首先查看redhat 7.3系统本身所安装的那些yum 软件包:

[a@localhost]$ rpm -qa | grep yum
PackageKit-yum-1.0.7-6.el7.x86_64
yum-3.4.3-150.el7.noarch
yum-metadata-parser-1.1.4-10.el7.x86_64
yum-rhn-plugin-2.0.1-6.el7.noarch
yum-langpacks-0.4.2-7.el7.noarch
yum-utils-1.1.31-40.el7.noarch
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7

注意权限!! 
删除yum包

[root@localhost]# rpm -e PackageKit-yum-1.0.7-6.el7.x86_64 --nodeps
[root@localhost]# rpm -e yum-3.4.3-150.el7.noarch --nodeps
[root@localhost]# rpm -e yum-metadata-parser-1.1.4-10.el7.x86_64 --nodeps
[root@localhost]# rpm -e yum-rhn-plugin-2.0.1-6.el7.noarch --nodeps
[root@localhost]# rpm -e yum-langpacks-0.4.2-7.el7.noarch --nodeps
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

右上角选择上网,保证可以联网,火狐+百度的测试

网易163网络源地址:http://mirrors.163.com/ 
这里寻找你要的包, 
1,选centos 
2,选择系统版本7.3.1611/ 
3,选择包类型(系统) os/ 
4,系统位数 x86_64/ 
5,包 Packages/ 
6,ctrl+f 搜索yum 
7,一般需要如下的几个包 
yum-plugin-fastestmirror 
yum-updateonboot 
yum-utils 
yum-metadata-parser 
yum-3.4.3-150.el7

[root@localhost]# wget http://mirrors.163.com/centos/7.3.1611/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-40.el7.noarch.rpm
[root@localhost]#wget http://mirrors.163.com/centos/7.3.1611/os/x86_64/Packages/yum-updateonboot-1.1.31-40.el7.noarch.rpm
[root@localhost]#wget http://mirrors.163.com/centos/7.3.1611/os/x86_64/Packages/yum-utils-1.1.31-40.el7.noarch.rpm
[root@localhost]#wget http://mirrors.163.com/centos/7.3.1611/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
[root@localhost]#wget http://mirrors.163.com/centos/7.3.1611/os/x86_64/Packages/yum-3.4.3-150.el7.centos.noarch.rpm
  • 1
  • 2
  • 3
  • 4
  • 5

安装

[root@localhost]# rpm -ivh yum-*
警告:yum-3.4.3-150.el7.centos.noarch.rpm: 头V3 RSA/SHA256 Signature, 密钥 ID f4a80eb5: NOKEY
准备中...                          ################################# [100%]
正在升级/安装...
   1:yum-metadata-parser-1.1.4-10.el7 ################################# [ 20%]
   2:yum-plugin-fastestmirror-1.1.31-4################################# [ 40%]
   3:yum-3.4.3-150.el7.centos         ################################# [ 60%]
   4:yum-updateonboot-1.1.31-40.el7   ################################# [ 80%]
   5:yum-utils-1.1.31-40.el7          ################################# [100%]
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10

配置 
[root@localhost ~]# vim /etc/yum.repos.d/CentOS-Base.repo 
将版本号那里改为你之前选择的那个版本

[base]
name=CentOS-$releasever -Base
baseurl=http://mirrors.163.com/centos/7.3.1611/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/7.3.1611/os/x86_64/RPM-GPG-KEY-CentOS-7

#released updates
[updates]
name=CentOS-$releasever - Updates
baseurl=http://mirrors.163.com/centos/7.3.1611/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/7.3.1611/os/x86_64/RPM-GPG-KEY-CentOS-7

[extras]
name=CentOS-$releasever - Extras
baseurl=http://mirrors.163.com/centos/7.3.1611/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/7.3.1611/os/x86_64/RPM-GPG-KEY-CentOS-7
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
baseurl=http://mirrors.163.com/centos/7.3.1611/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.163.com/centos/7.3.1611/os/x86_64/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

清理之前源,保证只有一个配置文件

[root@localhost]# yum clean all
[root@localhost]# ls /etc/yum.repos.d/
CentOS-Base.repo
  • 1
  • 2
  • 3
  • 4

安装你需要的软件测试是否正常使用


转载:https://blog.csdn.net/w1573007/article/details/66968944?utm_source=itdadao&utm_medium=referral

你可能感兴趣的:(yum,rhel,Linux)