本次安装的RedHat7.4是安装在Oracle VM VirtualBox5.2.8虚拟机上面的,本文不对安装虚拟机步骤做详细说明。

工具准备:

  Oracle VM VirtualBox5.2.8

  rhel-server-7.4-x86_64-dvd.iso

安装平台;

  win10_x86_64

解决办法:

1、修改网络配置

在RedHat7之后ifconfig命令查看网络命令受限,在登录系统后,可以使用下面的命令查看当前的一些ip地址等网络信息

[root@localhost ~]# ip addr

如果要修改网络配置,使用下面的命令

[root@localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-enp0s3 

修改BOOTPRTO=static,ONBOOT=yes,然后在最下面加入下面的配置

IPADDR=192.168.3.210
PREFIXO=
GATEWAY=192.168.3.1
DNS1=114.114.114.114

修改之后的配置文件内容如下图所示:

保存并退出之后,使用命令

[root@localhost ~]# service network restart
Restarting network (via systemctl):                        [  OK  ]

测试外网能否请求:

[root@localhost ~]# ping www.baidu.com
PING www.a.shifen.com (61.135.169.121) () bytes of data.
bytes from 61.135.169.121 (61.135.169.121): icmp_seq= ttl= time=42.8 ms
bytes from 61.135.169.121 (61.135.169.121): icmp_seq= ttl= time=40.9 ms
bytes from 61.135.169.121 (61.135.169.121): icmp_seq= ttl= time=41.6 ms
bytes from 61.135.169.121 (61.135.169.121): icmp_seq= ttl= time=40.6 ms
^Z
[]+ Stopped ping www.baidu.com

此时,使用yum命令会出现问题

[root@localhost ~]# yum install lrzsz
Loaded plugins: product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.

2、查看系统中的yum,如果有进行卸载

[root@localhost ~]# rpm -qa |grep yum
yum-metadata-parser-1.1.-.el7.x86_64
yum-rhn-plugin-2.0.-.el7.noarch
yum-3.4.-.el7.noarch

删除redhat自带的yum包

[root@localhost ~]# rpm -qa|grep yum|xargs rpm -e --nodeps

再进行检查,确认卸载完成

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

3、下载163的yum安装包

在网站:http://mirrors.163.com/有相关的许多开源包下载,我们这儿需要的安装包在路径:http://mirrors.163.com/centos/7.4.1708/os/x86_64/Packages/ 中,需要下载的有下面的内容:

http://mirrors.163.com/centos/7.4.1708/os/x86_64/RPM-GPG-KEY-CentOS-7
http://mirrors.163.com/centos/7.4.1708/os/x86_64/Packages/yum-3.4.3-154.el7.centos.noarch.rpm
http://mirrors.163.com/centos/7.4.1708/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
http://mirrors.163.com/centos/7.4.1708/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-42.el7.noarch.rpm
http://mirrors.163.com/centos/7.4.1708/os/x86_64/Packages/python-iniparse-0.4-9.el7.noarch.rpm

除了上述文件之外,还需要一个CentOS6-Base-163.repo文件,可以通过百度云盘进行搜索下载,在下载完成后通过WinSCP上传到操作系统中。还需要将CentOS6-Base-163.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.4.1708 - Base - 163.com
baseurl=http://mirrors.163.com/centos/7.4.1708/os/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=7.4.1708&arch=$basearch&repo=os
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-7 #released updates
[updates]
name=CentOS-7.4.1708 - Updates - 163.com
baseurl=http://mirrors.163.com/centos/7.4.1708/updates/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=7.4.1708&arch=$basearch&repo=updates
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-7 #additional packages that may be useful
[extras]
name=CentOS-7.4.1708 - Extras - 163.com
baseurl=http://mirrors.163.com/centos/7.4.1708/extras/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=7.4.1708&arch=$basearch&repo=extras
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-7 #additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-7.4.1708 - Plus - 163.com
baseurl=http://mirrors.163.com/centos/7.4.1708/centosplus/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=7.4.1708&arch=$basearch&repo=centosplus
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-7 #contrib - packages by Centos Users
[contrib]
name=CentOS-7.4.1708 - Contrib - 163.com
baseurl=http://mirrors.163.com/centos/7.4.1708/cr/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=7.4.1708&arch=$basearch&repo=contrib
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-7

使用下面的命令开始yum源的安装,本人安装的时候两个都用了,有的资料上只使用了其中的一个,本人安装使用第一个只安装了python相关的包,而且提示有警告,再使用第二个命令之后才安装完yum-抬头的相关包。

[root@localhost ~]# rpm -ivh *.rpm
[root@localhost ~]# rpm -ivh yum-*

如果安装时出现依赖包的问题,有可能会出现Python包安装冲突的问题。所以在此处命令可以加上两个参数强制安装:

  1. --force 即使覆盖属于其它包的文件也强迫安装
  2. --nodeps 如果该RPM包的安装依赖其它包,即使其它包没装,也强迫安装。

安装完成之后需要将上传的CentOS6-Base-163.repo文件以及RPM-GPG-KEY-CentOS-7文件移动到相应的位置中。

[root@localhost ~]# mv CentOS6-Base-163.repo /etc/yum.repos.d/
[root@localhost ~]# mv RPM-GPG-KEY-CentOS-7 /etc/pki/rpm-gpg/

经过这步之后经测试可以使用yum的相关命令的,可以安装SecureCRT上传下载相关的组件

[root@localhost yum.repos.d]# yum install lrzsz

但是既然有RPM-GPG-KEY-CentOS-7文档,我们应该将它也转入相关的目录下面,虽然现在测试不转好像也没有影响。根据百度查找RPM-GPG-KEY-CentOS-7文件应当放入目录/etc/pki/rpm-gpg/中。查看/etc/pki/rpm-gpg/中的内容并将RPM-GPG-KEY-CentOS-7文件移动到该目录中。

[root@localhost yum.repos.d]# cd
[root@localhost ~]# cd /etc/pki/rpm-gpg/
[root@localhost rpm-gpg]# ls
RPM-GPG-KEY-redhat-beta RPM-GPG-KEY-redhat-legacy-rhx
RPM-GPG-KEY-redhat-legacy-former RPM-GPG-KEY-redhat-release
RPM-GPG-KEY-redhat-legacy-release
[root@localhost rpm-gpg]# cd
[root@localhost ~]# mv RPM-GPG-KEY-CentOS-7 /etc/pki/rpm-gpg/
[root@localhost ~]# cd /etc/pki/rpm-gpg/
[root@localhost rpm-gpg]# ls
RPM-GPG-KEY-CentOS-7              RPM-GPG-KEY-redhat-legacy-release
RPM-GPG-KEY-redhat-beta           RPM-GPG-KEY-redhat-legacy-rhx
RPM-GPG-KEY-redhat-legacy-former  RPM-GPG-KEY-redhat-release

在上述完成之后

[root@localhost ~]# yum clear all
[root@localhost ~]# yum makecache

至此所有的配置完成。

最新文章

  1. 彻底解决“从客户端中检测到有潜在危险的Request.Form值”
  2. Elasticsearch 的坑爹事——记录一次mapping field修改过程
  3. js未定义判断
  4. windows与linux之间传输文件
  5. 微信开发——OAuth2.0授权
  6. PHP实现Restful风格的API
  7. linux前景到底怎么样啊?
  8. Spring Cloud Eureka Server例子程序
  9. php中对MYSQL操作之批量运行,与获取批量结果
  10. 给Notepad++ 加右键菜单带图标
  11. SQLSERVER 的联接查询写法
  12. JDK8 指南(译)
  13. 【转载】mysql主键的缺少导致备库hang
  14. Android开发 PopupWindow弹窗调用第三方地图(百度,高德)实现导航功能
  15. DSB
  16. [LeetCode] 566. Reshape the Matrix_Easy
  17. JS获取系统时间--JavaScript基础
  18. Java内部类的一些注意事项
  19. spring测试junit事务管理及spring面向接口注入和实现类单独注入(无实现接口),实现类实现接口而实现类单独注入否则会报错。
  20. R画图

热门文章

  1. flume jetty 进程关系 flume jetty 跨域问题 jetty 源码分析
  2. [LeetCode] 1.Two Sum - Swift
  3. 重装系统后Myeclipse遇到的项目配置问题--一个菜鸟的经历!
  4. SpringCloud 入门
  5. 图解Python可以做些什么
  6. 两台Linux系统之间传输文件
  7. Springboot+shiro配置笔记+错误小结
  8. UVA10100:Longest Match(最长公共子序列)&&HDU1458Common Subsequence ( LCS)
  9. JPG PNG GIF 的优缺点
  10. python爬虫中文乱码解决方法