1. Check whether you can access the Internet
ping www.baidu.com
2. If you cannot access the Internet:
1. cd to /etc/sysconfig/network -scripts/
cd /etc/sysconfig/network-scripts/
(Recommended tutorial: centos tutorial)
2. ls finds ifcfg-**** (the asterisk part is random) and open it with vi
3. Change ONBOOT=no to yes
4. :wq Save and exit
5. Restart the network service
service network restart
3. If possible The network is connected, but the installation of yum install links (example) fails. The reason is that the speed is too slow, just change the mirror source. As follows:
1. Back up your original image file so that you can restore it after making an error.
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
If you can’t find the original one, just use the new source directly.
2. Download the new CentOS-Base.repo to /etc/yum.repos.d/
CentOS 7:
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
or
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
3. Run yum makecache to generate cache
Recommended related video tutorials: linux video tutorial
The above is the detailed content of What to do if yum installation fails under centos. For more information, please follow other related articles on the PHP Chinese website!