小白自学Linux虚拟机RHEL7.0重装yum日志

初学Linux,用Vim写了一个C语言程序,但是在编译的过程中却发现了gcc未安装,于是我便使用yum对其进行了安装,可是却出现了这样的结果
This system is not registered to Red Hat Subscription Management.You can use subscription-manager to register.
后来我参考下面这一篇博客初步知道了如何重装Linux
下载yum包我是小白,而且我当时的REHL里的Weget命令执行不了,就只用此博客里的链接下载了最新的yum包(对yum的操作需要管理员权限,使用用shell命令sudo su先进行管理员登录)嫌下载麻烦的可以加我企鹅2607566935我发给你
由于我是用虚拟机运行的RHEL,所以下载的文件还需要传到虚拟机上,这里我下载了XFTP5,此软件在百度上搜索就可以下载,我就不说安装的过程了,用XFTP5传输文件的参照博客传文件,里面需要用到虚拟机的ip,只需要用shell命令ifconfig查看即可,就在inet后面的就是虚拟机的ip
(https://img-blog.csdnimg.cn/20200520145811874.png)同时,在查IP的时候需要确保网络端口最好是这样的,不然可能查到的ip链接会失败在这里插入图片描述把几个yum包传到虚拟机里面你便可以开始对yum包的安装了
首先你需要打开我们传送的yum包的位置(具体看XFTP5你填的用户名)
这里我填的是2Y我就直接执行 ls /home/2Y,后面你传输的5个yum包便出现了
在这里插入图片描述在这里插入图片描述
然后执行: rpm -ivh *.rpm --force --nodeps 一次性执行依赖包,因为包之间会相互依赖。
在这里插入图片描述最后出现这个界面就代表安装成功了在这里插入图片描述下一步你需要新建一个配置.repo 文件
vim /etc/yum.repos.d/CentOS-Base.repo
内容如下:(可以在Windows复制弄好传在相应目录下,由于我是小白我是自己慢慢打的…)

#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

最后一步:yum clear all
此时yum已经弄好了,此时你就只需要输入SHELL命令yum -y install gcc就可以成功安装gcc,下面是成功安装gcc和编译程序的截图在这里插入图片描述在这里插入图片描述在这里插入图片描述第一次发布文章,还希望大家支持

猜你喜欢

转载自blog.csdn.net/Aisran/article/details/106235872
今日推荐