VirtualBox Virtual Machine Creation: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 160: Line 160:


===Shared Folders===
===Shared Folders===
Click on the "Blue Folder Green Plus" icon.
Folder Path -> Drop Down -> Select the "Other" folder -> This brings up a File browser window.
Browse to the folder you want to expose on the Guest and click Open. The full path of the selected folder should show up in the "Folder Path:" box.
Folder name: leave the default.
No read-only (unless you want to)
Mounting on the guest (requires guest additions):
* Linux <font color=red>TODO</font>
* [[VirtualBox_Windows_VM_Configuration#Mount_the_Exported_Directory|Windows 10]]


==Save the Hardware Configuration==
==Save the Hardware Configuration==

Revision as of 02:45, 21 July 2016

Internal

Linux

VM Creation

From the VirtualBox Manager -> New -> Expert Mode (it may already start in Expert Mode, and in that case, you'll see a button named "Guided Mode" at the bottom of the screen).

The VM creation process with create the corresponding files in a directory associated with the VM, in ~/VirtualBox VMs/<vm-name>.

The VID (VirtualBox disk image) is a file with .vdi extension.

Name master31-1.openshift.local

Type Linux

Version Red Hat (64-bit)

Memory Size Choose as appropriate. Always keep in mind the amount of physical memory available to your hypervisor, and how many VMs you plan to use at the same time.

Create a virtual hard disk now

Create

File Location Will default to the VM name and that is appropriate. The corresponding physical file will get a .vdi extension and it will be available as ~/VirtualBox VMs/<vm-name>/<vm-name>.vdi

File size A typical minimal RHEL 7.2 takes about 1.6GB.

Hard disk file type VDI (VirtualBox Disk Image)

Storage on physical hard disk Dynamically allocated

Create

After this step, the VM should be created and you can review configuration in the right pane.

If you plan to manage this VM as part of a group, now is the time to create the VirtualBox group and move the VM in it.

Virtual Hardware Configuration

Note

Click OK often, if you go through many changes and successive tabs and don't click OK, Cancel will discard all changes.

Select the newly created VM -> Right click -> Settings

System

System -> Motherboard

Boot Order Optical, Hard Disk (deselect Floppy)

Chipset ICH9

Pointing Device USB Tablet (this is important, default "PS/2 Mouse" does not handle well cursor transition between windows and you will need to Left Command to release the mouse.

Extended Features

  • Enable I/O APIC
  • Hardware Clock in UTC Time

System -> Processor

Processors(s)

Execution Cap 100%

Extended Features Enable PAE/NX

System -> Acceleration

Paravirtualization Interface Default

Hardware Virtualization

  • Enable VT-x/AMD-v
  • Enable Nested Paging.

Display

Display -> Screen

Video Memory 128 MB

Monitor Count 1

Scale Factor 100%

HiDPI Support Use Unscaled HiDPI Output

Display -> Remote Display

Display -> Video Capture

Storage

Settings -> Storage

Controller IDE

Attributes

Name IDE

Type ICH6

Use Host I/O Cache

Empty -> Leave it IDE Secondary Master.

No Live CD/DVD

Controller SATA

Attributes

Name SATA

Type AHCI

Port Count 1

Use Host I/O Cache

<vm-name>.vdi

Attributes

Hard Disk SATA Port 0

Solid-state Drive (if it's a Solid-state Drive)

Network

See VirtualBox Networking Concepts for clarifications. Usually we we want to add one Host-only adapter and one NAT adapter (in this order).

Before adding the Host-only network adapter, go to VirtualBox -> Preferences -> Network -> Host-only Networks and add a Host-only network, if required. If one already exists and you plan to share it, you're all set. If there isn't any, add "vboxnet0". Configure it as described here: VirtualBox Host-Only Networking Configuration.


Good Practice. It is a good idea to use the same Host-only network for all the VMs you create on the same host, provided that you are careful to give those VMs non-overlapping IP addresses. This will allow you to communicate via ssh between any two arbitrary VMs – all you have to do is to start those VMs and they are instantaneously available to each other.

Settings -> Network

Edit "Adapter1" and "Adapter2". Adapter1 should be Host-only and Adapter2 should be NAT. For all adapters:

Enable Network Adapter

Attached to: Host-only Adapter, then NAT

Advanced

Adapter Type Paravirtualized Network (virtio-net)

Promiscuous Mode Deny

MAC Address use default

Cable Connected yes

Shared Folders

Click on the "Blue Folder Green Plus" icon.

Folder Path -> Drop Down -> Select the "Other" folder -> This brings up a File browser window.

Browse to the folder you want to expose on the Guest and click Open. The full path of the selected folder should show up in the "Folder Path:" box.

Folder name: leave the default.

No read-only (unless you want to)

Mounting on the guest (requires guest additions):

Save the Hardware Configuration

At this point, the virtualized hardware configuration is defined, save it.

Clone VMs with Identical Hardware

If we are going to create more virtual machines with the same hardware configuration, now is the moment to clone them.

Right click on the newly created VM -> Clone

Give it the appropriate name.

Clone Type: Full Clone

Snapshots: Current machine state

Reinitialize the MAC address of all network cards

Linux Guest OS Installation

Select the VM -> Settings -> Storage -> Controller: IDE -> Select drive -> Attributes: Optical Drive: IDE Secondary Master -> click on the Disk icon on the right -> Choose Virtual Disk File -> Select the OS iso file -> OK.

Select the VM -> Right click -> Start -> Normal Start.

The Linux installation program should start. From now on go to RHEL 7.2 Installation to perform the guest OS installation.

When the OS installation is done, continue with Guest Additions.

Guest Additions

The guest additions are special software packages that are shipped with VirtualBox but designed to be installed inside a VM to improve the performance of the guest OS and add extra features.

Guest Additions are supposed to be installed inside the virtual machine after the guest operating system has been installed. They are shipped as a CD ISO http://download.virtualbox.org/virtualbox/5.0.4/VBoxGuestAdditions_5.0.4.iso.

Download VBoxGuestAdditions_5.0.4.iso from the same place the hypervisor was downloaded from, then mount the image as a local filesystem: Select the VM -> Settings -> Storage -> Controller IDE -> Disk icon -> Choose Virtual Optical Disk File

Content is found on the guest system as /dev/disk/by-label/VBOXADDITIONS_5.0.4_102546.

Mount it:

mount /dev/disk/by-label/VBOXADDITIONS_5.0.4_102546 /mnt

Installation as root:

yum -y install bzip2 kernel-devel gcc 
cd /mnt
./VBoxLinuxAdditions.run 

Reboot to Make Sure the Host Starts

Reboot and make sure the host starts.

Windows VM Creation

VirtualBox Windows VM Configuration