VirtualBox Virtual Machine Creation: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
No edit summary
 
(67 intermediate revisions by the same user not shown)
Line 3: Line 3:
* [[VirtualBox Installation]]
* [[VirtualBox Installation]]


=Linux VM Creation=
=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).
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 ~/VirtualBox VMs/<vm-name>
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.
The VID (VirtualBox disk image) is a file with .vdi extension.


Name: master31-1.openshift.local
'''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'''


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


Version: Red Hat (64-bit)
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.


Memory Size:
==Virtual Hardware Configuration==


Create a virtual hard disk now
'''Note'''
:Click OK often, if you go through many changes and successive tabs and don't click OK, Cancel will discard all changes.


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


File Location: &lt;vm-name&gt; in ~/VirtualBox VMs/&lt;vm-name&gt;/&lt;vm-name&gt;
===General===


Will get the .vdi extension.
General -> Basic


File size:  
General -> Advanced:


Hard disk file type: VDI (VirtualBox Disk Image)
Shared Clipboard: Bidirectional


Storage on physical hard disk: Dynamically allocated
Drag'n'Drop: Bidirectional


Create
===System===


System -> Motherboard


After this step, the VM should be created and you can review configuration in the right pane.
'''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'''


!!!VM Post-Creation Configuration
* Enable I/O APIC
* Hardware Clock in UTC Time


__Note:__ Click OK often, if you go through many changes and successive tabs and don't click OK, Cancel will discard all changes.
System -> Processor


!!Settings -> System -> Motherboard
'''Processors(s)'''


Boot Order: Optical, Hard Disk (deselect Floppy)
'''Execution Cap''' 100%


Chipset: ICH9
'''Extended Features''' Enable PAE/NX


Pointing Device: USB Tablet  (so I don't need to Left Command to release the mouse)
System -> Acceleration


Extended Features: Enable I/O APIC
'''Paravirtualization Interface''' Default


Extended Features: Hardware Clock in UTC Time
'''Hardware Virtualization'''
* Enable VT-x/AMD-v
* Enable Nested Paging.


!!Settings -> System -> Processor
===Display===


Processors(s)
Display -> Screen


Execution Cap:
'''Video Memory''' 128 MB


Extended Features: Enable PAE/NX
Experimental 64 MB.


'''Monitor Count''' 1


!!Settings -> System -> Acceleration
'''Scale Factor''' On client machines with high resolution, use 200%. Otherwise use 100%. This can be changed later.


Paravirtualization Interface: Default
'''HiDPI Support''' Use Unscaled HiDPI Output


Hardware Virtualization: Enable VT-x/AMD-v, Enable Nested Paging.
Display -> Remote Display


!!Settings -> Display -> Screen
Display -> Video Capture


Video Memory: 128 MB.
===Storage===


HiDPI Support: Use Unscaled HiDPI Output
Settings -> Storage


!!Settings -> Storage
'''Controller IDE'''


Controller IDE
Attributes


Name: IDE
'''Name''' IDE


Type: ICH6
'''Type''' ICH6


Use Host I/O Cache
'''Use Host I/O Cache'''


Empty -> Leave it IDE Secondary Master.
Empty -> Leave it IDE Secondary Master.
Line 90: Line 123:
No Live CD/DVD
No Live CD/DVD


Controller SATA
'''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 [[VirtualBox Networking Concepts#Host-only_Networking|Host-only adapter]] and one [[VirtualBox Networking Concepts#NAT|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.
 
{{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


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


Port Count 1
'''Enable Network Adapter'''


Don't use Host I/O Cache
'''Attached to:''' Host-only Adapter, then NAT


*.vdi -> Hard Disk SATA Port 0
'''Advanced'''


Solid-state Drive (if it's a Solid-state Drive)
'''Adapter Type''' Paravirtualized Network (virtio-net)


!!Settings -> Network
'''Promiscuous Mode''' Deny


See [VirtualBox Networking Concepts], but usually we we want to add a Host-only adapter and a NAT (in this order).
'''MAC Address''' use default


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].
'''Cable Connected''' yes


For all adapters:
===Shared Folders===


Advanced -> Paravirtualized Network (virtio-net)
Click on the "Blue Folder Green Plus" icon.


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


Cable connected: yes
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.


!!!Linux Guest OS Installation
Folder name: leave the default.


Select the VM -> Settings -> Storage -> Controller: IDE -> Select drive -> Attributes: Optical Drive: IDE Primary Master -> click on the Disk icon -> Choose Virtual Disk File -> Select the OS iso file.
No read-only (unless you want to)


Start -> Normal Start
<font color=red>What does "auto-mount" mean?</font>


From now on go to [RHEL7] to perform the guest OS installation and then return here to continue with Guest Additions.
Mounting on the guest (requires guest additions):


!!!Guest Additions
* Linux <font color=red>TODO</font>
* [[VirtualBox_Windows_VM_Configuration#Mount_the_Exported_Directory|Windows 10]]


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


Guest Additions are supposed to be installed ''inside'' the virtual machine after the guest operating system has been installed:
Select the VM -> Right click -> Start -> Normal Start.


[http://download.virtualbox.org/virtualbox/5.0.4/VBoxGuestAdditions_5.0.4.iso]
The Linux installation program should start. From now on go to [[RHEL 7/Centos 7 Installation]] to perform the guest OS installation.


Download {{VBoxGuestAdditions_5.0.4.iso}} from the same place, then mount the image as a local filesystem: Select the VM -> Settings -> Storage -> Controller IDE -> Disk icon -> Choose Virtual Optical Disk File
When the OS installation is done, continue with [[#Guest_Additions|Guest Additions]].


Then I found the content under: /dev/disk/by-label/VBOXADDITIONS_5.0.4_102546
==RHEL==


Then I mounted it
For RHEL system, register the system with the subscription manager.


{{{
Details: {{Internal|Red Hat Subscription Manager|Red Hat Subscription Manager}}
mount /dev/disk/by-label/VBOXADDITIONS_5.0.4_102546 /mnt
}}}


==Guest Additions==


Installation as root:
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:


yum update
* http://download.virtualbox.org/virtualbox/5.0.4/VBoxGuestAdditions_5.0.4.iso
yum install bzip2 kernel-devel gcc
* http://download.virtualbox.org/virtualbox/5.1.18/VBoxGuestAdditions_5.1.18.iso


cd /mnt
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
./VBoxLinuxAdditions.run
}}}


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


!!!Reboot to Make Sure the Host Starts
Mount it:


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


<font color=red>
Installation as root:


!!!Still TODO
<pre>
yum -y install bzip2 kernel-devel gcc
cd /mnt
./VBoxLinuxAdditions.run
</pre>


Set shared folders and write down the procedure. Manual page 70.
There were situations when the execution failed and I had to (adjusting for the current kernel version):


</font>
<pre>
export KERN_DIR=/usr/src/kernels/3.10.0-514.16.1.el7.x86_64
</pre>


==Reboot to Make Sure the Host Starts==


!!!Windows VM Creation
Reboot and make sure the host starts.


<font color=red>
=Linux Clone=
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>
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=


__Referenced by:__\\
{{Internal|VirtualBox Windows VM Configuration|VirtualBox Windows VM Configuration}}
[{INSERT com.ecyrd.jspwiki.plugin.ReferringPagesPlugin WHERE max=20, maxwidth=50}]

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