Home >Operation and Maintenance >CentOS >How to solve the problem that centos yum cannot be used

How to solve the problem that centos yum cannot be used

尚
Original
2020-03-25 16:47:583368browse

How to solve the problem that centos yum cannot be used

When using yum to install gcc, an error was reported:

[root@001 ~]#yum -y install gcc gcc-c++ kernel-devel
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
There are no enabled repos.
 Run "yum repolist all" to see the repos you have.
 To enable Red Hat Subscription Management repositories:
     subscription-manager repos --enable <repo>
 To enable custom repositories:
     yum-config-manager --enable <repo>

1. Check whether the network is disconnected

ping www.baidu.com

2. If the network is not disconnected , it means that the yum mirror is gone and you need to download one:

cd /etc/yum.repos.d
 
mv CentOS-Base.repo CentOS-Base.repo.backup
 
wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
 
mv CentOS6-Base-163.repo CentOS-Base.repo
 
yum clean all

Related video tutorial recommendations: linux video tutorial

The above is the detailed content of How to solve the problem that centos yum cannot be used. 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