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