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>Using VBoxManage Commands for Unattended Guest Installation</title>
|
---|
6 |
|
---|
7 | <body>
|
---|
8 | <p>
|
---|
9 | The following example shows how to perform an unattended guest
|
---|
10 | installation for an Oracle Linux VM. The example uses various
|
---|
11 | <userinput>VBoxManage</userinput> commands to prepare the guest VM.
|
---|
12 | The <userinput>VBoxManage unattended install</userinput> command is
|
---|
13 | then used to install and configure the guest OS.
|
---|
14 | </p>
|
---|
15 | <ol>
|
---|
16 | <li>
|
---|
17 | <p>
|
---|
18 | Create the virtual machine.
|
---|
19 | </p>
|
---|
20 | <pre xml:space="preserve"># VM="ol7-autoinstall"
|
---|
21 | # VBoxManage list ostypes
|
---|
22 | # VBoxManage createvm --name $VM --ostype "Oracle_64" --register</pre>
|
---|
23 | <p>
|
---|
24 | Note the following:
|
---|
25 | </p>
|
---|
26 | <ul>
|
---|
27 | <li>
|
---|
28 | <p>
|
---|
29 | The $VM variable represents the name of the VM.
|
---|
30 | </p>
|
---|
31 | </li>
|
---|
32 | <li>
|
---|
33 | <p>
|
---|
34 | The <userinput>VBoxManage list ostypes</userinput> command
|
---|
35 | lists the guest OSes supported by Oracle VM VirtualBox,
|
---|
36 | including the name used for each OS in the
|
---|
37 | <userinput>VBoxManage</userinput> commands.
|
---|
38 | </p>
|
---|
39 | </li>
|
---|
40 | <li>
|
---|
41 | <p>
|
---|
42 | A 64-bit Oracle Linux 7 VM is created and registered
|
---|
43 | with Oracle VM VirtualBox.
|
---|
44 | </p>
|
---|
45 | </li>
|
---|
46 | <li>
|
---|
47 | <p>
|
---|
48 | The VM has a unique UUID.
|
---|
49 | </p>
|
---|
50 | </li>
|
---|
51 | <li>
|
---|
52 | <p>
|
---|
53 | An XML settings file is generated.
|
---|
54 | </p>
|
---|
55 | </li>
|
---|
56 | </ul>
|
---|
57 | </li>
|
---|
58 | <li>
|
---|
59 | <p>
|
---|
60 | Create a virtual hard disk and storage devices for the VM.
|
---|
61 | </p>
|
---|
62 | <pre xml:space="preserve"># VBoxManage createhd --filename /VirtualBox/$VM/$VM.vdi --size 32768
|
---|
63 | # VBoxManage storagectl $VM --name "SATA Controller" --add sata --controller IntelAHCI
|
---|
64 | # VBoxManage storageattach $VM --storagectl "SATA Controller" --port 0 --device 0 \
|
---|
65 | --type hdd --medium /VirtualBox/$VM/$VM.vdi
|
---|
66 | # VBoxManage storagectl $VM --name "IDE Controller" --add ide
|
---|
67 | # VBoxManage storageattach $VM --storagectl "IDE Controller" --port 0 --device 0 \
|
---|
68 | --type dvddrive --medium /u01/Software/OL/OracleLinux-R7-U6-Server-x86_64-dvd.iso</pre>
|
---|
69 | <p>
|
---|
70 | The previous commands do the following:
|
---|
71 | </p>
|
---|
72 | <ul>
|
---|
73 | <li>
|
---|
74 | <p>
|
---|
75 | Create a 32768 MB virtual hard disk.
|
---|
76 | </p>
|
---|
77 | </li>
|
---|
78 | <li>
|
---|
79 | <p>
|
---|
80 | Create a SATA storage controller and attach the virtual
|
---|
81 | hard disk.
|
---|
82 | </p>
|
---|
83 | </li>
|
---|
84 | <li>
|
---|
85 | <p>
|
---|
86 | Create an IDE storage controller for a virtual DVD drive
|
---|
87 | and attach an Oracle Linux installation ISO.
|
---|
88 | </p>
|
---|
89 | </li>
|
---|
90 | </ul>
|
---|
91 | </li>
|
---|
92 | <li>
|
---|
93 | <p>
|
---|
94 | (Optional) Configure some settings for the VM.
|
---|
95 | </p>
|
---|
96 | <pre xml:space="preserve"># VBoxManage modifyvm $VM --ioapic on
|
---|
97 | # VBoxManage modifyvm $VM --boot1 dvd --boot2 disk --boot3 none --boot4 none
|
---|
98 | # VBoxManage modifyvm $VM --memory 8192 --vram 128</pre>
|
---|
99 | <p>
|
---|
100 | The previous commands do the following:
|
---|
101 | </p>
|
---|
102 | <ul>
|
---|
103 | <li>
|
---|
104 | <p>
|
---|
105 | Enable I/O APIC for the motherboard of the VM.
|
---|
106 | </p>
|
---|
107 | </li>
|
---|
108 | <li>
|
---|
109 | <p>
|
---|
110 | Configure the boot device order for the VM.
|
---|
111 | </p>
|
---|
112 | </li>
|
---|
113 | <li>
|
---|
114 | <p>
|
---|
115 | Allocate 8192 MB of RAM and 128 MB of video RAM to the
|
---|
116 | VM.
|
---|
117 | </p>
|
---|
118 | </li>
|
---|
119 | </ul>
|
---|
120 | </li>
|
---|
121 | <li>
|
---|
122 | <p>
|
---|
123 | Perform an unattended install of the OS.
|
---|
124 | </p>
|
---|
125 | <pre xml:space="preserve"># VBoxManage unattended install $VM \
|
---|
126 | --iso=/u01/Software/OL/OracleLinux-R7-U6-Server-x86_64-dvd.iso \
|
---|
127 | --user=<varname>login</varname> --full-user-name=<varname>name</varname> --password <varname>password</varname> \
|
---|
128 | --install-additions --time-zone=CET</pre>
|
---|
129 | <p>
|
---|
130 | The previous command does the following:
|
---|
131 | </p>
|
---|
132 | <ul>
|
---|
133 | <li>
|
---|
134 | <p>
|
---|
135 | Specifies an Oracle Linux ISO as the installation ISO.
|
---|
136 | </p>
|
---|
137 | </li>
|
---|
138 | <li>
|
---|
139 | <p>
|
---|
140 | Specifies a login name, full name, and login password
|
---|
141 | for a default user on the guest OS.
|
---|
142 | </p>
|
---|
143 | <p>
|
---|
144 | Note that the specified password is also used for the
|
---|
145 | root user account on the guest.
|
---|
146 | </p>
|
---|
147 | </li>
|
---|
148 | <li>
|
---|
149 | <p>
|
---|
150 | Installs the Guest Additions on the VM.
|
---|
151 | </p>
|
---|
152 | </li>
|
---|
153 | <li>
|
---|
154 | <p>
|
---|
155 | Sets the time zone for the guest OS to Central European
|
---|
156 | Time (CET).
|
---|
157 | </p>
|
---|
158 | </li>
|
---|
159 | </ul>
|
---|
160 | </li>
|
---|
161 | <li>
|
---|
162 | <p>
|
---|
163 | Start the virtual machine.
|
---|
164 | </p>
|
---|
165 | <p>
|
---|
166 | This step completes the unattended installation process.
|
---|
167 | </p>
|
---|
168 | <pre xml:space="preserve"># VBoxManage startvm $VM --type headless</pre>
|
---|
169 | <p>
|
---|
170 | The VM starts in headless mode, which means that the
|
---|
171 | VirtualBox Manager window does not open.
|
---|
172 | </p>
|
---|
173 | </li>
|
---|
174 | <li>
|
---|
175 | <p>
|
---|
176 | (Optional) Update the guest OS to use the latest Oracle
|
---|
177 | Linux packages.
|
---|
178 | </p>
|
---|
179 | <p>
|
---|
180 | On the guest VM, run the following command:
|
---|
181 | </p>
|
---|
182 | <pre xml:space="preserve"># yum update</pre>
|
---|
183 | </li>
|
---|
184 | </ol>
|
---|
185 | </body>
|
---|
186 |
|
---|
187 | </topic>
|
---|