The following example shows how to perform an unattended guest
installation for an Oracle Linux VM. The example uses various
Create the virtual machine.
# VM="ol7-autoinstall" # VBoxManage list ostypes # VBoxManage createvm --name $VM --ostype "Oracle_64" --register
Note the following:
The $VM variable represents the name of the VM.
The
A 64-bit Oracle Linux 7 VM is created and registered
with
The VM has a unique UUID.
An XML settings file is generated.
Create a virtual hard disk and storage devices for the VM.
# VBoxManage createhd --filename /VirtualBox/$VM/$VM.vdi --size 32768 # VBoxManage storagectl $VM --name "SATA Controller" --add sata --controller IntelAHCI # VBoxManage storageattach $VM --storagectl "SATA Controller" --port 0 --device 0 \ --type hdd --medium /VirtualBox/$VM/$VM.vdi # VBoxManage storagectl $VM --name "IDE Controller" --add ide # VBoxManage storageattach $VM --storagectl "IDE Controller" --port 0 --device 0 \ --type dvddrive --medium /u01/Software/OL/OracleLinux-R7-U6-Server-x86_64-dvd.iso
The previous commands do the following:
Create a 32768 MB virtual hard disk.
Create a SATA storage controller and attach the virtual hard disk.
Create an IDE storage controller for a virtual DVD drive and attach an Oracle Linux installation ISO.
(Optional) Configure some settings for the VM.
# VBoxManage modifyvm $VM --ioapic on # VBoxManage modifyvm $VM --boot1 dvd --boot2 disk --boot3 none --boot4 none # VBoxManage modifyvm $VM --memory 8192 --vram 128
The previous commands do the following:
Enable I/O APIC for the motherboard of the VM.
Configure the boot device order for the VM.
Allocate 8192 MB of RAM and 128 MB of video RAM to the VM.
Perform an unattended install of the OS.
# VBoxManage unattended install $VM \ --iso=/u01/Software/OL/OracleLinux-R7-U6-Server-x86_64-dvd.iso \ --user=login --full-user-name=name --user-passwordpassword \ --install-additions --time-zone=CET
The previous command does the following:
Specifies an Oracle Linux ISO as the installation ISO.
Specifies a login name, full name, and login password for a default user on the guest OS.
Note that the specified password is also used for the root user account on the guest.
Installs the Guest Additions on the VM.
Sets the time zone for the guest OS to Central European Time (CET).
Start the virtual machine.
This step completes the unattended installation process.
# VBoxManage startvm $VM --type headless
The VM starts in headless mode, which means that the
(Optional) Update the guest OS to use the latest Oracle Linux packages.
On the guest VM, run the following command:
# yum update