0

LFCS setting up a test environment

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

prerequisites:

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.

  1. Choose a suitable machine with at least 50GB free disk space and 4GB of RAM.
  2. Install VirtualBox.
  3. 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

  1. Open up VirtualBox and click on New in the top left corner

    VirtualBoxMain

    Virtual Box Main

  2. 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)

      Create New VM

      Create New VM

  3. Choose the amount of RAM the machine will have. I chose 1024MB. Press Continue/Next.

    Set RAM value

    Set RAM value

  4. Create a virtual hard drive of:
    Create HDD

    Create HDD

    • Of type VDI.

      Choose HDD Type

      Choose HDD Type

    • Make it Dynamically allocated.

      Dynamic Size Allocation

      Dynamic Size Allocation

    • Give it a name, location and size (ideally in the same directory as your VM will reside).

      HDD Size

      HDD Size

    • Press Create.
  5. 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.

      Bidirectional Clipboard

      Bidirectional Clipboard

    • System -> Boot Order is CD/DVD then Hard Disk.

      Boot Order

      Boot Order

    • Display -> Video Memory 64MB.

      Graphics Card Size

      Graphics Card Size

    • 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.
        IDE Controller

        IDE Controller

        Choose install ISO

        Choose install ISO

      • 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.
        Create New Hard Disk

        Create New Hard Disk

        Choose HDD Type

        Choose HDD Type

        Dynamic Size Allocation

        Dynamic Size Allocation

        Name and Size Hard Disk

        Name and Size Hard Disk

        List of Disks

        List of Disks

    • Audio -> Disabled.

      Disable Audio

      Disable Audio

    • Network -> Enable Network adaptor, Attached to set to NAT.

      Enable Network As NAT

      Enable Network As NAT

    • Serial Ports -> None enabled.

      Disable Serial Ports

      Disable Serial Ports

    • USB -> Untick Enable USB Controller.

      Disable USB Ports

      Disable USB Ports

    • Shared Folders -> None.

      Disable Shared Folders

      Disable Shared Folders

    • Press OK to exit settings.

Installing CentOS 6.4 on your new virtual machine

    1. Select your new virtual machine from the left hand pane in VirtualBox and press Start located in the top hand bar.

      Finished Setup

      Finished Setup

    2. The disk image you attached should boot into the installation menu. Choose Install or upgrade an existing system

      Install System

      Install System

    3. Choose to skip the disk check

      Skip Disc Test

      Skip Disc Test

    4. Choose Next to begin the installation.

      Next to begin installation

      Next to begin installation

    5. Choose a Language and press Next.

      Choose Language

      Choose Language

    6. Choose a Keyboard Layout and press Next.

      Choose Keyboard Layout

      Choose Keyboard Layout

    7. Choose Basic Storage Devices and press Next.

      Basic Storage Devices

      Basic Storage Devices

    8. Choose Yes discard any data.

      Discard Any Data

      Discard Any Data

    9. Give the machine a hostname and press Next.

      Set A Hostname

      Set A Hostname

    10. Choose a location and press Next.

      Choose Location Press Next

      Choose Location Press Next

    11. Input a password and press Next.

      Choose A Password Press Next

      Choose A Password Press Next

    12. Choose Use All Space and press Next.

      Choose All Space Press Next

      Choose All Space Press Next

    13. Choose the first disk on SCSI 0 and move that into Install Target Devices and press Next.

      Choose Install Target Devices Press Next

      Choose Install Target Devices Press Next

    14. Choose Write Changes To Disk.

      Write Changes To Disk

      Write Changes To Disk

    15. The automated install process begins

      Automated Install Process Begins

      Automated Install Process Begins

    16. Reboot to use your new install.

      Reboot To Use New Install

      Reboot To Use New Install

    17. Login to being using your new install

      Login To Use New Install

      Login To Use New Install

Setting up networking

By default the first network adaptor will be disabled. Here are the details for enabling it on boot.

  1. Whilst logged into the virtual machine as root use vi to open to /etc/sysconfig/network-scripts/ifcfg-eth0.
  2. 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.
  3. 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.
  4. You can then start networking either by restarting the VM or with the following command:
    • # service network restart
  5. 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.

  1. 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.

  2. 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.

    Take Snapshot

    Take Snapshot

  3. Give the snapshot a name and press OK.

    Name the snapshot

    Name the snapshot

  4. You will then see the snapshot available in the interface.

    Snapshot View

    Snapshot View

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.

Conclusion

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.

Subscribe to my feed either by E-mail or by RSS to receive updates as they happen.

Can you improve on any of the tips I’ve discussed here? If you can let me know in the comments.

Jason Edwards