redHat版本选择及yum源替换

LINUX 新手历程

版本选择:
介于公司使用的Linux版本为redHat7,本人也从redHat7入手。然后redHat7小版本之间也是有差别的(自己使用的体会),7.2版本没有ifconfig的命令,同时也没有除了回环lo以外其他网卡的配置文件,导致复制了lo的配置文件后无法重新启动network,至于原因就是网卡MAC地址和网卡设备uuid的问题。 由于众多弊端,本人比较了几款redHat7版本,最终决定用7.4,此版本有自带的配置文件不需要进行繁琐的配置,只需要为其设置静态IP就可以正常连接。

由于redHat的yum源是收费的,对于大部分的需求当然是能替换绝对不去付费。接下来就是替换为CentOS的免费yum源的过程:
1、删除redHat自带yum软件包。
2、下载所需的软件包。
3、根据依赖项安装。
4.新建repo配置文件。
对于本人实现需要附加其他的依赖也一并说一下。

流程

1、删除redHat自带yum软件包

1>rpm -qa | grep yum //查看自带软件
2>rpm -qa | grep yum | xargs rpm -e - -nodeps //卸载安装包

2、下载对应rpm包(使用win系统下载,基本为5个,耐心往下看)

redHat7依赖包list
<1>yum-3.4.3-158.el7.centos.noarch.rpm
<2>yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
<3>yum-utils-1.1.31-45.el7.noarch.rpm
<4>yum-updateonboot-1.1.31-45.el7.noarch.rpm
<5>yum-plugin-fastestmirror-1.1.31-45.el7.noarch.rpm

下载地址:
阿里云网络源地址:https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/
网易163网络源地址:http://mirrors.163.com/
CentOS网络源地址:http://centos.ustc.edu.cn/centos/
使用CTRL+F输入关键字查找对应的安装包即可

如果大家在想我yum无法使用,也没有rz这个命令我该如何去将文件上传到我的Linux上呢?那么答案来了,我们可以使用XSHELL自带的xftp文件传输工具(ctrl+alt+F)打开直接拖动文件j就会将文件上传到你的Linux当前目录下。
可以先 mkdir /home/yum 新建一个文件夹把5个安装包拷贝到 yum 这个文件下面

3、执行: rpm -ivh *.rpm 一次性执行依赖包

如果提示下列错误,说明缺少依赖(针对不同系统可能缺少的依赖不同):
警告:yum-3.4.3-158.el7.centos.noarch.rpm: 头V3 RSA/SHA256 Signature, 密钥 ID f4a80eb5: NOKEY
错误:依赖检测失败:
python-urlgrabber >= 3.10-8 被 yum-3.4.3-158.el7.centos.noarch 需要
python-kitchen 被 yum-utils-1.1.31-45.el7.noarch 需要

翻译:python-urlgrabber 3.10-8 和python-kitchen 被yum-3.4.3-158.el7.centos.noarch需要,

从下载rpm包的地址中找到被需要的俩个rpm包,上传到Linux系统中,更新rpm包
rpm -Uvh python-kitchen-1.1.1-5.el7.noarch.rpm –nodeps
rpm -Uvh python-urlgrabber-3.10-8.el7.noarch.rpm –nodeps
再次运行rpm -ivh *.rpm即可。

4、新建配置 .repo 的文件
vi /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

5、yum源替换成功,测试一下即可。
测试的前提条件是你的Linux可以上网。

Linux联网:转载可用方法

猜你喜欢

转载自blog.csdn.net/qq_39354083/article/details/82453725