1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
|
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE topic
PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd">
<topic xml:lang="en-us" id="unattended-guest-install-example">
<title>Creating a New Virtual Machine Using VBoxManage</title>
<body>
<p>You can create a VM on the command line using VBoxManage. See also <xref href="../cli_topics/vboxmanage-createvm.dita"/>.</p>
<p>The following example uses various <userinput>VBoxManage</userinput> commands to specify the VM and configure an unattended guest installation for an Oracle Linux VM on a Linux host.</p>
<p>It then shows the use of the <userinput>VBoxManage unattended install</userinput> command to install and configure the guest OS.</p>
<ol>
<li>
<p>Set a variable for the name of the OS.<pre xml:space="preserve"># VM="ol8-autoinstall"
</pre></p>
</li>
<li>
<p>List the available guest OS types and note the exact name of the one you need. This is required in <userinput>VBoxManage</userinput> commands.<pre xml:space="preserve"># VBoxManage list ostypes</pre></p>
</li>
<li>
<p>Create the virtual machine.<pre xml:space="preserve"># VBoxManage createvm --name $VM --ostype "Oracle_64" --register</pre></p>
<p>The VM has a unique UUID.</p>
<p>An XML settings file is generated.</p>
</li>
<li>
<p>Create a 32768 MB virtual hard disk for the VM.<pre xml:space="preserve"># VBoxManage createhd --filename /VirtualBox/$VM/$VM.vdi --size 32768</pre></p>
</li>
<li>
<p>Create storage devices for the VM.</p>
<ul>
<li>
<p>Create a SATA storage controller and attach the virtual hard disk. <pre xml:space="preserve"># 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</pre></p>
</li>
<li>
<p>Create an IDE storage controller for a virtual DVD drive and attach an Oracle Linux installation ISO. <pre xml:space="preserve"># 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</pre></p>
</li>
</ul>
</li>
<li>
<p>(Optional) Configure some settings for the VM. </p>
<ul>
<li>
<p>Enable I/O APIC for the motherboard of the VM. <pre xml:space="preserve"># VBoxManage modifyvm $VM --ioapic on</pre></p>
</li>
<li>
<p>Configure the boot device order for the VM. <pre xml:space="preserve"># VBoxManage modifyvm $VM --boot1 dvd --boot2 disk --boot3 none --boot4 none</pre></p>
</li>
<li>
<p>Allocate 8192 MB of RAM and 128 MB of video RAM to the VM. <pre xml:space="preserve"># VBoxManage modifyvm $VM --memory 8192 --vram 128</pre></p>
</li>
</ul>
</li>
<li>
<p>Specify the Unattended Installation parameters, and then install the OS.</p>
<ul>
<li>
<p>Specify an Oracle Linux ISO as the installation ISO.<pre xml:space="preserve"># VBoxManage unattended install $VM \
--iso=/u01/Software/OL/OracleLinux-R7-U6-Server-x86_64-dvd.iso \</pre></p>
</li>
<li>
<p>Specifiy a user name, full name, and password for a default user on the guest OS.<pre xml:space="preserve">--user=<varname>login</varname> --full-user-name=<varname>name</varname> --user-password <varname>password</varname> \</pre></p>
<p>Note that the specified password is also used for the root user account on the guest.</p>
</li>
<li>
<p>Specify that you want to install the VirtualBox Guest Additions on the VM.<pre xml:space="preserve">--install-additions \</pre></p>
</li>
<li>
<p>Sets the time zone for the guest OS to Central European Time (CET). <pre xml:space="preserve">--time-zone=CET</pre></p>
</li>
</ul>
</li>
<li>
<p>Start the virtual machine.</p>
<pre xml:space="preserve"># VBoxManage startvm $VM --type headless</pre>
<p>The VM starts in headless mode, which means that it does not have a GUI.</p>
</li>
</ol>
</body>
</topic>
|