Installing CentOS 6.4 from a Net Install Image on a Virtual Host

An Opportunity To Play Around with CentOS

One of the personal projects that I’ve always had itching away at the back of my mind was the urge to revamp my home network monitoring and security.  One of the tools that I love using for network monitoring is Xymon.  However, this gives me an opportunity to do things slightly different.  I have decided to give CentOS a go instead of my typical choice of Debian for a Linux distro in a server environment.  I am curious to see what advancements have been made in the RPM world, and I’d like to keep my Red Hat skills up to date.  What better way to do so than to set up a CentOS server with some production tools and services on it :)

Pre-installation Setup

So here we are, I have the CentOS Netinst (Net Install) image loaded into a VM, and I boot up the guest.

Since this is a fresh install on a 20GB virtual disk, I’m going to select “Install or upgrade an existing system” here.

I press “enter” and lots of console logging and scrolling action takes place.

Eventually I am prompted to “test the media”.  Usually this is referring to a physical CD typically used to install the OS on a physical server.  To me the phrasing feels a bit antiquated in this day of cloud services.

In any case, I still say yes, hoping that it will catch any errors in the ISO image file before I run into a bug during the installation process.  Better safe than sorry.

After the virtual disk is “successfully verified” to be OK, I try to move forward with the installation.

Be sure to note that after your virtual disk is verified OK, that the installer may decide to eject your CD media, in order to give you an opportunity to test other media.

Since I have no other media to test, this is actually kind of annoying. In order to continue with the installation, I have to go into the VM settings and re-connect the CDROM to the VM.

Select your language and keyboard options if the defaults are not suitable.  Otherwise, just  move past these dialogues by selecting “OK”, or hitting enter.

 

When you are asked “What type of media contains the installation image?”, select “URL”.

 

At this stage you will be asked about your TCP/IP configuration settings.  If you have DHCP services on your network, select “Dynamic IP Configuration”, or configure your network settings manually.

 

The installer will eventually ask you for the URL containing the CentOS installation image.      Select the URL from this list.  Select a mirror that is closest to your geographical location in order to benefit from faster download times.

 

If the installer retrieves the installation image successfully, you will be presented with the welcome note in the following screen:

 

CentOS Installation

If you are installing CentOS on to a VM (in a virtualized environment), you may come across a nasty error like the following:

This “Error processing drive” shows up because the installer is detecting a drive with no valid partition table.  This is expected, since there was no OS previously installed on this VM.   After you have confirmed that this is the physical or virtual disk you want to use, select “Re-initialize” to format the disk for installation of CentOS.

 

After you have initialized your disk, select the time-zone that you want the guest to be running on.  Many system administrators may want to set this to their local time-zone.  In this case, because this will be a server running at home, I will do the same.  However in a professional environment, I would try to keep all my server time-zones set to UTC, as it makes life much easier when trying to analyse and compare log files across multiple hosts in different time-zones.

You will then be asked to specify a root password.  Make sure its a good one.

 

After you specify your root password, you will be prompted with a question on how you would like to organize your hard-drive partitions.  In my case, since this is a VM, I plan to use the entire virtual disk, and let CentOS apply default partition settings automatically.

At this point, the installation process beings installing files to disk.

 

And if all goes well and all files are installed successfully..

 

Post-Installation:  Initial CentOS Configuration

After you reboot the VM,  CentOS will start-up, and you will be presented with the following login prompt:

Log in with the root password you had specified earlier in the installation.

 

You should be able to log in as root successfully, and do some quick checks to make sure everything is as expected for your hard-disk utilization.

Since I would like to start accessing this VM via SSH for ongoing maintenance, the first thing I want to do is confirm that the SSH service is installed and running, and if it isn’t I need to get it up and running.

With regard to SSH, I noticed is that CentOS comes with an inverse default installation contrary to a typical modern Debian install.  In Debian the SSH client is installed by default, and the SSH service  usually needs to be specified explicitly for installation by the administrator.

In CentOS, the SSH service comes installed by default, and the administrator has to explicitly install an SSH client for out-going connections.  I must say that from a security and best practices standpoint, I agree more with the Debian way of doing things.  

However I understand why the CentOS team did it this way. One of the the first things I do when when install a new system is get the SSH service up and running so that I can get back to my desk and configure the rest of the system from there. It’s a convenience thing.

Since an SSH service is already installed, I can move on to creating a user account so that I’m not always logging into the VM as root.

There are still a few things you may want to check before you decide to call it a day..

 

Network Configuration

There is the possibility that you may have selected an incorrect virtual network adapter configuration.  For example, you may have chosen to configure a “Bridged Network” which allows your adapter to have an IP on the external network.

Or, you may have selected a “NAT” configuration which puts your network adapter on a private virtual segment, which means your VM would not be reachable from the external network.

If you decided on a networking type that you had to change later on, after the installation of CentOS was completed, then you will likely cause a problem with the network adapter configuration INSIDE of the guest VM.  Essentially your VMs network configuration will break.

Updating udev Rules

You can fix this by updating the appropriate udev rules as follows:

The ’70-persistent-net.rules’ file will need to be updated with the MAC address of the newest network adaptor connected to the system.  If this file is not updated with the correct MAC address for the virtual adapter currently connected to your VM, your network adapter will not work.

Ensure that you are editing the correct device (in this case, “eth0”) when making modifications to this file.  Remove older duplicate entries from this file when possible to keep it clean.

DHCP Considerations

If you have DHCP configured on your network, you may want to make some changes. I use a static DHCP configuration, which means that each physical or virtual host on my network is assigned a specific IP address which is served up to them via DHCP.  In my case, I would need to update my dhcpd.conf on the DHCPD server to add an entry for the MAC address that was generated for the new VM on my network.

 

Finishing Up

VMware Tools

If you are using a VMware VM, then the first thing you want to do is install VMware tools,  which gives you a bit more control over the performance of the VM.

CentOS Software Updates

Before installing service software (apache, mysql, etc.), you may want to update your CentOS installation with the latest bug-fixes and patches.

 

Finally, my fresh new CentOS 6.4 VM is ready for services to be installed.  In my next post, I’ll detail the process of downloading, installing and configuring Xymon for use on this VM.

Leave a Reply

Your email address will not be published. Required fields are marked *