You may receive a problem with yum not being able to resolve hosts when you try to install a yum package. I’m using CentOS 7.

yum install wget

If you already have Internet connection and can ping 8.8.8.8, the likely problem is that you don’t have nameservers in your /etc/resolv.conf.

vi /etc/resolv.conf

If /etc/resolv.conf does not have any nameservers, you can add this line somewhere in the file:

nameserver 8.8.8.8

Note: if you have used dhclient command, you should have a few nameservers like the following. However, you can just add the nameserver 8.8.8.8 to get yum working like I did above. The following is just a sample of what a /etc/resolv.conf would be generated by dhclient.

; generated by /usr/sbin/dhclient-script
 search bu.edu
 nameserver 128.197.253.183
 nameserver 128.197.253.120
 nameserver 128.197.253.254

After saving the file with at least one nameserver, restart the network.

systemctl restart network
yum install wget

You should be able to install your yum packages now!