VirtualBox Virtual Machine Creation: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
 
(26 intermediate revisions by the same user not shown)
Line 25: Line 25:
'''Create'''
'''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 Location''' Will default to the VM name and that is appropriate. The default name, which should be appropriate in most cases, is main-virtual-disk. 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.
'''File size''' A typical minimal RHEL 7.2 takes about 1.6GB.
Line 45: Line 45:


Select the newly created VM -> Right click -> Settings
Select the newly created VM -> Right click -> Settings
===General===
General -> Basic
General -> Advanced:
Shared Clipboard: Bidirectional
Drag'n'Drop: Bidirectional


===System===
===System===
Line 82: Line 92:


'''Video Memory''' 128 MB
'''Video Memory''' 128 MB
Experimental 64 MB.


'''Monitor Count''' 1
'''Monitor Count''' 1


'''Scale Factor''' 100%
'''Scale Factor''' On client machines with high resolution, use 200%. Otherwise use 100%. This can be changed later.


'''HiDPI Support''' Use Unscaled HiDPI Output
'''HiDPI Support''' Use Unscaled HiDPI Output
Line 137: Line 149:
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]].
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]].


====VM IP Addresses====
Conventionally, vboxnet0 IP address is 172.30.0.1. This address is important because the host will add routes to it automatically, so if you want to be able to communicate with the virtual machines created to use this interface, without additional configuration, from the host, then you should give those VMs IP addresses from the 172.30.0.0/16 network.
{{Error|Do not use 172.20.*.*, it will clash with Marriott's addressing scheme}}
{{Warn|'''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
Settings -> Network


Line 155: Line 174:
'''Cable Connected''' yes
'''Cable Connected''' yes


==Save the Hardware Configuration==
===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.


At this point, the virtualized hardware configuration is defined, save it.
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.


==Clone VMs with Identical Hardware==
Folder name: leave the default.


If we are going to create more virtual machines with the same hardware configuration, now is the moment to clone them.
No read-only (unless you want to)


Right click on the newly created VM -> Clone
<font color=red>What does "auto-mount" mean?</font>


Give it the appropriate name.
Mounting on the guest (requires guest additions):


Clone Type: Full Clone
* Linux <font color=red>TODO</font>
* [[VirtualBox_Windows_VM_Configuration#Mount_the_Exported_Directory|Windows 10]]


Snapshots: Current machine state
==Save the Hardware Configuration==


Reinitialize the MAC address of all network cards
At this point, the virtualized hardware configuration is defined, save it.


==Linux Guest OS Installation==
==Linux Guest OS Installation==
Line 179: Line 203:
Select the VM -> Right click -> Start -> Normal Start.
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.
The Linux installation program should start. From now on go to [[RHEL 7/Centos 7 Installation]] to perform the guest OS installation.


When the OS installation is done, continue with [[#Guest_Additions|Guest Additions]].
When the OS installation is done, continue with [[#Guest_Additions|Guest Additions]].
==RHEL==
For RHEL system, register the system with the subscription manager.
Details: {{Internal|Red Hat Subscription Manager|Red Hat Subscription Manager}}


==Guest Additions==
==Guest Additions==
Line 187: Line 217:
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.
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.
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
* http://download.virtualbox.org/virtualbox/5.1.18/VBoxGuestAdditions_5.1.18.iso


Download <tt>VBoxGuestAdditions_5.0.4.iso</tt> 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  
Download <tt>VBoxGuestAdditions_5.0.4.iso</tt> 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  
Line 205: Line 238:
cd /mnt
cd /mnt
./VBoxLinuxAdditions.run  
./VBoxLinuxAdditions.run  
</pre>
There were situations when the execution failed and I had to (adjusting for the current kernel version):
<pre>
export KERN_DIR=/usr/src/kernels/3.10.0-514.16.1.el7.x86_64
</pre>
</pre>


Line 210: Line 249:


Reboot and make sure the host starts.
Reboot and make sure the host starts.
=Linux Clone=
This is the procedure to create a clone of a VirtualBox Virtual Machine, including an O/S image.
{{Internal|VirtualBox Virtual Machine and Linux O/S Clone|VirtualBox Virtual Machine and Linux O/S Clone}}


=Windows VM Creation=
=Windows VM Creation=


<font color=red>
{{Internal|VirtualBox Windows VM Configuration|VirtualBox Windows VM Configuration}}
Lessons learned so far:
* The screen resolution does not seem great and the mouse interaction is choppy.
* It is probably best if I access it over Remote Desktop
* Some way to exchange files/
</font>

Latest revision as of 22:12, 22 May 2017

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 default name, which should be appropriate in most cases, is main-virtual-disk. 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

General

General -> Basic

General -> Advanced:

Shared Clipboard: Bidirectional

Drag'n'Drop: Bidirectional

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

Experimental 64 MB.

Monitor Count 1

Scale Factor On client machines with high resolution, use 200%. Otherwise use 100%. This can be changed later.

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.

VM IP Addresses

Conventionally, vboxnet0 IP address is 172.30.0.1. This address is important because the host will add routes to it automatically, so if you want to be able to communicate with the virtual machines created to use this interface, without additional configuration, from the host, then you should give those VMs IP addresses from the 172.30.0.0/16 network.


Do not use 172.20.*.*, it will clash with Marriott's addressing scheme


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)

What does "auto-mount" mean?

Mounting on the guest (requires guest additions):

Save the Hardware Configuration

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

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/Centos 7 Installation to perform the guest OS installation.

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

RHEL

For RHEL system, register the system with the subscription manager.

Details:

Red Hat Subscription Manager

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:

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 

There were situations when the execution failed and I had to (adjusting for the current kernel version):

export KERN_DIR=/usr/src/kernels/3.10.0-514.16.1.el7.x86_64

Reboot to Make Sure the Host Starts

Reboot and make sure the host starts.

Linux Clone

This is the procedure to create a clone of a VirtualBox Virtual Machine, including an O/S image.

VirtualBox Virtual Machine and Linux O/S Clone

Windows VM Creation

VirtualBox Windows VM Configuration