Home  >  Article  >  Operation and Maintenance  >  What should I do if the yum command cannot be used in Linux?

What should I do if the yum command cannot be used in Linux?

WBOY
WBOYOriginal
2022-08-11 16:47:1411619browse

Solution: 1. Install Centos image for linux redhat, and use "mv repo file" to replace "$releasever" in the repo file; 2. Clear all caches and use "yum makecache" to obtain yum List; 3. Use "yum -y install gcc" to install gcc.

What should I do if the yum command cannot be used in Linux?

#The operating environment of this tutorial: linux7.3 system, Dell G3 computer.

What to do if the yum command cannot be used in Linux

 [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

For people who are used to using CentOS, it is a torture to not be able to use this command

Solution process:

1. Install the Centos image for linux redhat

What should I do if the yum command cannot be used in Linux?

Modify the repo file

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

*** Replace $releasever with 6

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

2. Clear all caches

[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

Get the yum list

What should I do if the yum command cannot be used in Linux?

3. Search and install

What should I do if the yum command cannot be used in Linux?

Install gcc

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

At this point, the gcc installation is completed, and for other The compilation environment can also be installed using yum.

Recommended learning: Linux video tutorial

The above is the detailed content of What should I do if the yum command cannot be used in Linux?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn