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

Release: 2020-03-25 16:47:58
Original
3369 people have browsed it

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>
Copy after login

1. Check whether the network is disconnected

ping www.baidu.com
Copy after login

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
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template