Rumah  >  Artikel  >  Operasi dan penyelenggaraan  >  linux中yum命令不能用怎么办

linux中yum命令不能用怎么办

WBOY
WBOYasal
2022-08-11 16:47:1411558semak imbas

解决方法:1、给linux redhat安装Centos镜像,并且利用“mv repo文件”,替换repo文件中的“$releasever”;2、清除所有缓存,并利用“yum makecache”获取yum列表;3、利用“yum -y install gcc”安装gcc后即可。

linux中yum命令不能用怎么办

本教程操作环境:linux7.3系统、Dell G3电脑。

linux中yum命令不能用怎么办

 [root@localhost ~]# yum -y install gccLoaded plugins: katello, product-id, security, subscription-manager
Updating certificate-based repositories.
Unable to read consumer identity
Setting up Install Process
No package gcc available.
Nothing to do

对于习惯使用CentOS的人来说,不能使用这个命令,简直是种折磨

解决过程:

1、给linux redhat安装Centos镜像

15.png

修改repo文件

[root@localhost~]# mv CentOS6-Base-163.repo /etc/yum.repos.d/

*** 把$releasever替换成6

[root@localhost yum.repos.d]# sed -i 's#$releasever#6#g' ./CentOS6-Base-163.repo

2、清除所有缓存

[root@localhost yum.repos.d]# yum clean all
Loaded plugins: katello, product-id, security, subscription-manager
Updating certificate-based repositories.
Unable to read consumer identity
Cleaning up Everything

获取yum列表

17.png

3、搜索安装

16.png

安装gcc

[root@localhost yum.repos.d]# yum -y install gcc

至此,gcc安装完成,并且对于其他的编译环境也可以使用yum安装了。

推荐学习:Linux视频教程

Atas ialah kandungan terperinci linux中yum命令不能用怎么办. Untuk maklumat lanjut, sila ikut artikel berkaitan lain di laman web China PHP!

Kenyataan:
Kandungan artikel ini disumbangkan secara sukarela oleh netizen, dan hak cipta adalah milik pengarang asal. Laman web ini tidak memikul tanggungjawab undang-undang yang sepadan. Jika anda menemui sebarang kandungan yang disyaki plagiarisme atau pelanggaran, sila hubungi admin@php.cn
Artikel sebelumnya:linux找不到my.cnf怎么办Artikel seterusnya:linux自带yum吗