Skip to content

Instantly share code, notes, and snippets.

@marioa
Last active June 1, 2017 13:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marioa/d90ec7c8006e19aa99130dc661fc3432 to your computer and use it in GitHub Desktop.
Save marioa/d90ec7c8006e19aa99130dc661fc3432 to your computer and use it in GitHub Desktop.
Setting up a CentOS VM

CentOS7 Virtual Box instance on Sierra

These instructions allow you to create a VirtualBox VM on a MacOS Sierra instance.

Table of contents

Default settings

Change the host key combination to be the right Cmd key (usually use the left one for copy/cut/paste). In virtual box get the preference menu (Cmd-,) then:

Input -> Virtual Machine -> Host Key Combination

Getting a CentOS 7 image

Download a CentOS 7 iso

Get something like:

CentOS_7_1611-VB-64bit.7z

Unpack:

7z e CentOS_7_1611-VB-64bit.7z

This produces a file like: 1611-64bit/CentOS 7-1611 (64bit).vdi

Bit strange but 1611-64bit is an empty directory and it producesthe file CentOS 7-1611 (64bit).vdi outside the hierarchy.

On virtual box click on New. Name it. Type Linux, Version Red Hat (64-bit). Press on Continue. Memory size 80192Mb. Press on Continue. Use an existing virtual hard disk. Copy the virtual CentOS instance.

Change the UUID of a vdi image if it has already been used.

VBoxManage internalcommands sethduuid ./centos7.vdi

Otherwise you get an errror:

Failed to open the disk image file /Volumes/Maxtor/iHUB3/CentOS 7-1611
(64bit).vdi.

Cannot register the hard disk '/Volumes/Maxtor/iHUB3/CentOS 7-1611
(64bit).vdi' {f100ba78-ce0a-42cd-b538-ee0fa403fcfd} because a hard 
disk '/Volumes/Seagate/iHUB3/CentOS_7-1611-64bit.vdi' with UUID
{f100ba78-ce0a-42cd-b538-ee0fa403fcfd} already exists.

Result Code: NS_ERROR_INVALID_ARG (0x80070057)
Component: VirtualBoxWrap
Interface: IVirtualBox {0169423f-46b4-cde9-91af-1e9d5b6cd945}
Callee RC: VBOX_E_OBJECT_NOT_FOUND (0x80BB0001)

Choose:

Use an existing virtual hard disk file

Click on the folder and go to the disk image.

Setting up CentOS 7

Start the VM.

Intial password: osboxes.org

Initial Welcome screen, pick: English (UK)

Networking CentOS 7

TBD

Installing the guest additions

The guest additions facilitate the interation between the host and the guest OS. Get the Guest additions for the virtual box app from the downloads page:

This is needed for the host OS.

You also need to get a download for the guest OS:

You need to get the download for your version of virtual box. Before you can install you will need to have the following modules installed (as bits of the kernel are compiled):

  yum install gcc
  yum install kernel-devel

Now mount the iso image you downloaded

Storage->Controller: IDE->Empty->Click on the CD in Optical Drive

Once you have mounted the ISO image it may try to run the necessary scripts automatically or as root on the guest OS:

cd /run/media/<Your User id>/VBOXADDITIONS*
./VBoxLinuxAdditions.run
reboot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment