Welcome to post 16 of my 100 day challenge. Checkout my introduction for some background.
This is post one of my LFCS series. You can go back to the overview post for a brief introduction or continue for instructions on setting up an exam practice system.
This is a long article, so you might want to set aside some time to read it.
I am making the following assumptions:
- You are choosing CentOS as the OS for the exam. This is what I am taking but this series should apply if you choose any of your other two choices.
- You are practising for the exam using a CentOS VM running on a Windows or MacOSX host. Although if running Linux most of the same setup steps will apply.
LFCS setting up a test environment
I’m going to assume that you have done the following before continuing with this tutorial. The links below will get you up to speed quickly enough.
- Choose a suitable machine with at least 50GB free disk space and 4GB of RAM.
- Install VirtualBox.
- Download CentOS 6.4. – The latest at this point is 6.6 in the 6 vein and 7.1 in the 7 vein. But your exam will take place on CentOS 6.4 if you choose CentOS as your OS. Substitute this with your OS of choice if not using CentOS.
Configuring the Virtual Machine
- Open up VirtualBox and click on New in the top left corner
- Give the VM a name, choose your OS and Version and press Continue/Next. For CentOS this should be:
- Type: Linux.
- Version: RedHat (64 bit)
- Choose the amount of RAM the machine will have. I chose 1024MB. Press Continue/Next.
- Create a virtual hard drive of:
- Of type VDI.
- Make it Dynamically allocated.
- Give it a name, location and size (ideally in the same directory as your VM will reside).
- Press Create.
- Your VM should now be created. We now need to select the VM in the VirtualBox window and click on Settings in the top menu. In order to create our practice sandbox. change the following settings:
- General -> Advanced, enable bidirectional clipboard. Select Show at top of screen for Mini Toolbar.
- System -> Boot Order is CD/DVD then Hard Disk.
- Display -> Video Memory 64MB.
- Storage ->
- Controller IDE should be the CD/DVD Drive. Click on Empty and click the CD/DVD image under attributes. Select Choose Virtual Disk File from the submenu and navigate to where you downloaded the CentOS 6.4 iso earlier.
- Under Controller SATA, Select the controller and click on the Add New Attachment button at the bottom of the window. Choose Add hard disk and select create new disk. Create three further 8GB volumes following the instructions above and name them <name of root device>2,3,4. These are needed to practice the configuration of LVM partitions.
- Audio -> Disabled.
- Network -> Enable Network adaptor, Attached to set to NAT.
- Serial Ports -> None enabled.
- USB -> Untick Enable USB Controller.
- Shared Folders -> None.
- Press OK to exit settings.
Installing CentOS 6.4 on your new virtual machine
- Select your new virtual machine from the left hand pane in VirtualBox and press Start located in the top hand bar.
- The disk image you attached should boot into the installation menu. Choose Install or upgrade an existing system
- Choose to skip the disk check
- Choose Next to begin the installation.
- Choose a Language and press Next.
- Choose a Keyboard Layout and press Next.
- Choose Basic Storage Devices and press Next.
- Choose Yes discard any data.
- Give the machine a hostname and press Next.
- Choose a location and press Next.
- Input a password and press Next.
- Choose Use All Space and press Next.
- Choose the first disk on SCSI 0 and move that into Install Target Devices and press Next.
- Choose Write Changes To Disk.
- The automated install process begins
- Reboot to use your new install.
- Login to being using your new install
Setting up networking
By default the first network adaptor will be disabled. Here are the details for enabling it on boot.
- Whilst logged into the virtual machine as root use vi to open to /etc/sysconfig/network-scripts/ifcfg-eth0.
- When the file is open press i to enter input mode and use the cursor keys to change the line ONBOOT=no to ONBOOT=yes.
- When you have done the changes press esc to exit input mode and enter command mode then press : followed by wq and press <Enter>, this will save and quit the file.
- You can then start networking either by restarting the VM or with the following command:
# service network restart
- The network service should restart and you should see adaptor eth0 pickup an IP address.
Create a snapshot of your sandbox
Now that we have a basic practice system up and running we should take a snapshot of the current state so that we can be confident we can restore it back if we manage to break it. It’s a lot easier to restore from a snapshot then to reconfigure everything again from scratch or try to fix it manually.
- Shut down the vm if it is running. You can do this via the VirtualBox menu or as sudo issue
shutdown -h now
the h in the command means halt.
- When the server is shutdown. Select it from the VirtualBox interface and click on Snapshots on the top right of the screen then press the camera icon.
- Give the snapshot a name and press OK.
- You will then see the snapshot available in the interface.
It is a good idea to take periodic snapshots especially before performing more sensitive work as this will mean less work is required to get back up to speed.
For more information regarding snapshots you can take a look at the Snapshot section of the VirtualBox documentation.
There you have it we have covered the steps to install VirtualBox, setup a new Virtual Machine and install CentOS 6.4 onto it. You now have a test bed for practicing for the LFCS exam. Come back tomorrow for the first article covering the content of the exam.
Can you improve on any of the tips I’ve discussed here? If you can let me know in the comments.