Testing environment: Installing CentOS 5.2 on VirtualBox

In the previous post of this series we installed and set up VirtualBox. We prepared it for a default install of CentOS 5.2. This time, we cover the installation of the OS itself. Changes since the last article are an upgrade from v2.0 to v2.1, and the fact that I’m running VirtualBox on my Asus eee under eeebuntu now. The great thing is that VirtualBox is cross-platform, so it runs perfectly fine and acts almost exactly the same. Now, let’s get started!We will install everything from scratch, so we start with a so-called ‘minimal install’ of CentOS. Because we do it this way, we only need the first cd of the 6 cd’s of the CentOS image. Since VirtualBox 2.1 you can run a 64 bit guest OS on a 32 bit host OS, which is pretty cool. We are going to stick with the 32 bit version for this post though. Download the image and select it in the settings for the virtual machine we created in the previous article. Now fire the machine up.

Before the machine will start booting, VirtualBox shows a dialog about the currently configured host key. The host key is an important one, as it allows you to transfer control from the guest OS to the host OS whenever you need it. I have reconfigured it to be the left Ctrl-key as I don’t have a right ctrl-key, but it is all up to you what you decide to do. You can close the dialog if you read it.

Now, the machine will start booting. It will stop at the CentOS 5.2 install screen.

The CentOS install boot screen

The CentOS install boot screen

Since we are of course proper nerds we will use the text install, so type “linux text”  and hit enter. The next screen asks us if we want to test the install medium. Be my guest, but I personally have faith in the image, so I skip it. Now, the installer asks us for the language and keyboard layout we want to use. I chose English and US-layout.

Then, we get to the partition layout. Choose to remove all data on the drive (there’s nothing on it anyway :) ) and select to create a custom partition layout. For my 8 GB virtual harddrive I took the following layout: 2GB for /, 1 GB for swap, 500MB for /home and the rest will be LVM (this will hold our MySQL data). Your partitioning screen should look like this:

The layout we will use for partitioning

The layout we will use for partitioning

When you are satisfied with your layout, continue to the next screen. Now, follow your way through all the screens chosing all the default until you get to the configuration of eth0. Chose to customize it. Enable “Activate on Boot” and “IPv4″ in the next screen.

Now for the tricky bit: to get NAT to work properly (we want our box to have direct internet access so we can yum update and such), but still be configured statically we need to make specific settings for the static IP. This is what the VirtualBox manual says:

In NAT mode, the guest network interface is assigned to the IPv4 range 10.0.x.0/24 by default where x corresponds to the instance of the NAT interface +2 of that VM.
So x is 2 if there is only once NAT instance active. In that case the guest is assigned to the address 10.0.2.15, the gateway is set to 10.0.2.2 and the name server can be found at 10.0.2.3.

So, configure the eth0 interface according to the screenshot below:

IPv4 configuration of eth0

IPv4 configuration of eth0

..and then continue. Configure the gateway and name servers to 10.0.2.2 and 10.0.2.3 respectively.

Then choose a hostname for your new puppy. I like something that ends in a number, so I can keep numbering the clones we make later, but it is completely up to you. I chose dbserver00 for this machine. Make sure you chose it though, and don’t let it be chosen by DHCP!

Next, set your timezone, in my case Europe/Brussels. Setup now asks you for  a root password. Pick something simple unless you intend to open this VM up to the outside world.

We now get to the final part of the setup process, the package selection. It is very simple: deselect everything! That means, in the first screen, deselect everything in the list and choose “Customise software selection”. When you choose OK, it will take you to another list of packages. deselect everything here as well, including “base” and anything else you think you need. You don’t, we will install them using yum on our own terms. If you choose packages here, it will not be possible to run the whole install with just the first CD. Be warned :)

Package selection: deselect everything for a minimal install

Package selection: deselect everything for a minimal install

“Ok” your way through the last few screens and sit back and relax while your CentOS system gets installed. When it’s done, let it reboot. You now have a working CentOS system on virtualbox, ready to take all sorts of testing abuse, yay!

Tags: , ,

2 Responses to “Testing environment: Installing CentOS 5.2 on VirtualBox”

  1. secure vpn says:

    You are using a VPN client that does not allow ’split-tunneling’ and ALL your traffic is being forced over the tunnel to the remote network. This is done for security reasons. It’s possible to disable split-tunneling depending on the client, but it needs to be done by the VPN administrator.

Leave a Reply