VirtualBox: Installing CentOS 7 Guest on Windows 8.1 host


Step-by-step guide

  1. Download CentOS.
  2. When selecting a version, select the "DVD ISO" don't select "Everything ISO", it is more than 4 GB for CentOS version 7.
  3. Download & install VirtualBox, or you may use any existing version you already have like what is installed with Genymotion.
  4. Open Virtualbox, and click "New" button.
  5. In the name "CentOS7" you will find the type is automatically changed to "Linux" & version to "Red Hat", change the version to be "Red Hat (64 bit)", click "Next". Note: If you are running VirtualBox in Windows 8/8.1, you may not find the option of 64 bit. If this is the case, and to get it enabled, first make sure that you enabled "Intel Virtualization" option in your BIOS. Second, disable Hyper-v platform in Windows through ControlPanel->Programs->Turn Windows Features On or Off.
  6. For the memory, select at least 1024 MB, click "Next".
  7. For the Hard drive, click "Create a virtual hard drive now", click "Create".
  8. Keep "VDI (VirtualBox Disk Image)", click "Next".
  9. Keep storage as "Dynamically allocated", click "Next".
  10. Type a location for this file without spaces.
  11. The maximum size limit 40 GB will be more than enough (Dynamic allocated as required this is just maximum limit), click "Create".
  12. Select your virtual machine, click "Settings":
    1. Click "System", Boot order, uncheck "Floppy".
    2. Click "Storage", click "Controller: IDE" and select the CD ROM, and click the button "Set up virtual CD DVD drive" and select the iso image file downloaded in step #2, click "OK".
    3. Click "Network", Adapter 1, attached to "Bridged Adapter" instead of NAT & then:
      1. Select your WiFi controller in name in-case you are using your laptop and will use the wireless network on your Internet connectivity.
      2. Select your Ethernet in name in-case you are using a PC and you will be using the Ethernet network on your Internet connectivity.
  13. Select your virtual machine, click "Start".
  14. Select "Install CentOS 7".
  15. You can abort checking the media by clicking "Esc".
  16. In the graphical installer starts, select "English", "United States", click "Continue".
  17. Change the timezone.
  18. In software selection "Basic Web Server" & select the following Add-Ons (Based on your needs):
    1. Backup client.
    2. Directory client.
    3. Guest agents.
    4. Hardware Monitoring utilities.
    5. Large Systems performance.
    6. Performance tools.
    7. Remote Management for Linux
  19. For Installation Destination, Keep "Automatic partitioning selected".
  20. For Network & hostname:
    1. You will find a Network Ethernet (Either you are using Wireless or Ethernet connection on your host; VirtualBox will mimic any network connection to Ethernet), click the button to make it "On" as you will need for Internet connectivity & your work later. It will say connected.
    2. Scroll down and change the hostname to "centos7.localdomain"
  21. Click button "Begin Installation".
  22. For root password: root_password_must_memorize
  23. For user creation: Type your name it will suggest login name, make sure to "Make this user as administrator" and provide your password.
  24. When installation, click "Reboot".
  25. From the virtualbox settings, storage, "Remove disk from virtual drive" to avoid re-installing CentOS again.
  26. Make sure your system is up & running before performing post installation steps.

    You can scroll up & down in the CentOS guest using shift + pageup & shift + pagedown

Post installation

Installing DKMS & Guest Additions

  1. In-case you have VirtualBox older than v4.3.14RC1, download newer version of Guest Additions, tried for version 4.3.20, & copy it to virtual box folder having the original one. If you have already higher version, please skip this step.
  2. While your CentOS vm is already started, and you have logged using root.
  3. Run the following command to install EPEL (Extra Packages for Enterprise Linux):
    yum install epel-release
    Is this ok? y
  4. Run the following command to install kernel-devel package that provides the headers needed to compile modules for the kernel:
    yum install kernel-devel
    Is this ok? y
  5. Run the following command to install dkms (Dynamic Kernel Module Support):
    yum install dkms
    Is this ok? y
  6. While your CentOS vm is already started, and you have logged using root. Select "Device" menu, and select "CD/DVD", and mount VirtualBox Guest Additions 4.3.20
  7. In the VM status bar just move to the CD icon, you will find that the CD has mounted "Virtual Guest Additions iso" that is normally located in %VIRTUALBOX_FOLDER%\VBoxGuestAdditions.iso
  8. Auto installation doesn't work with CentOS it just mounted the CD, it usually works for Windows, we will perform the next steps to manually install Guest Additions.
  9. Mount the CD ROM using the command (Note: Without installing the kernel-devel specific version although done before, the building of GuestAdditions was always failing, now it will take time and build successfully):
    yum install kernel-devel-3.10.0-123.el7.x86_64
    Is this ok? y
    mount /dev/cdrom /mnt
    cd /mnt
    sh ./VBoxLinuxAdditions.run
  10. Shutdown your VM using command:
    shutdown -h now "configure shared folder"
  11. Go to your VM settings, click "Shared Folder", Add new folder "c:\shared-with-vbox" with below settings:

  12. Go to your VM settings, click "General", tab "Advanced", for Shared Clipboard select "Bidirectional".
  13. Go to your VM settings, click "Storage", Remove disk from virtual drive.
  14. Start your VM, login with root, you need to make a folder in your centos and then mount the shared folder to this newly created folder using below command:
    cd /tmp
    mkdir sharedhost
    mount -t vboxsf sharedwithvbox /tmp/sharedhost

Installing SELinux (Security-Enhanced Linux) Policy Management tool

This is required later for securing your server when changing the port of SSH
  1. Just run the command:
    yum install policycoreutils-python

Installing Network Time Protocol

This is required later for synchronizing your server with NTP
  1. Just run the command:
    yum install ntp

3 comments:

  1. Thanks. It works but windows can not be scaled or entering full screen mode. Your pictures can not be displayed due to their links to your account in the cloud which requiring log in.

    ReplyDelete
  2. Great Post. Thanks. I can't see any posted .png but that's ok. In Post installation 11, I had a hard time figuring out the file name "shared-with-vbox" has to be exactly "sharedwithvbox" in 14. But eventually I did.

    ReplyDelete
    Replies
    1. Name of the folder can be anything you specify

      Delete