eth0

Setting up CentOS with no X Window Manager

For a nice VM I needed a Linux server, but no need for a GUI, so went for CentOS.

Installed fine, but no networking. How do I install that? Turns out, it is installed, just disabled by default:

vi /etc/sysconfig/network-scripts/ifcfg-eth0

Find the line ONBOOT and change to yes:

DEVICE=eth0
HWADDR=00:00:00:00:00:00:00 TYPE=ETHERNET
UUID=some guid string
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=dhcp

Then just restart networking at you should be up and running:

service network restart

Test by entering ifconfig and you should see the loopback address.

If you need to install Guest Additions on VirtualBox:

yum update
yum install gcc make kernel-devel
mkdir /media/cdrom
mount /dev/scd0 /media/cdrom
sh /media/cdrom/VBoxLinuxAdditions.run

New install of Centos – No network

If you have just set up a new Centos server and found that the network isn’t functioning, and you have no IP address for it then fear not, its a ‘secure’ default for Centos to not enable networking until you are ready to do so.

cd /etc/sysconfig/network-scripts/ 
sed -i -e 's@^ONBOOT="no@ONBOOT="yes@' ifcfg-eth0

Then reboot.

If this doesn’t help, then double check the filename in that folder. You may have ifcfg-lo instead.

More help here: http://wiki.centos.org/FAQ/CentOS6#head-b67e85d98f0e9f1b599358105c551632c6ff7c90