Configuring an auto install client / server setup using VirtualBox
During one of my presentations @ CommunityOne I demonstrated on my laptop an auto install setup in VirtualBox. I had an auto install server running OpenSolaris 2009.06 and used that to "jumpstart" (to use a Solaris 10 familiar term) a client.
I was asked to write this and committed to that asap after @ CommunityOne,so here goes...
1. Install 2009.06 in VirtualBox
2. Create a 2nd network adapter for the virtual machine, under settings, select network, adapter 2, enable it and then where it says attached to select "internal network" (you'll need to shutdown the virtual machine to do this if you didn't do it before installing).
3. Inside the virtual machine install the autoinstaller package:
pkg install SUNWinstalladm-tools
NOTE:
You need to have root priviliges to do everything from 3. onwards, best way is to pfexec bash
4. Now configure the network connections on the virtual machine you just installed
Adapter 1 is e1000g0 and will be dhcp by default, leave that alone
Adapter 2 is e1000g1 and will need to be configured, specifically:
Netmask: 255.255.255.0
IP: 192.168.2.50
Broadcast: 192.168.2.0
So first off edit /etc/hosts, adding in:
192.168.2.50 name_of_the_machine
192.168.2.60 aiclient0
192.168.2.61 aiclient1
192.168.2.62 aiclient2
192.168.2.63 aiclient3
Add a line entry aiclient<number> for every machine you'd like to auto install. You can pick a whatever name you want here for each one, I just used aiclient to make it easy to understand.
name_of_the_machine is the name of the machine you installed in step 1, by default this is "opensolaris".
Also in /etc/hosts you have the line:
127.0.0.1 opensolaris opensolaris.local localhost loghost
Delete the first opensolaris entry so the line looks like:
127.0.0.1 opensolaris.local localhost loghost
Now edit /etc/hostname.e1000g1, assuming you entered 192.168.2.50 as the internal network address of your guest earlier enter that into this file.
Now edit /etc/netmasks, adding in the line:
192.168.2.0 255.255.255.0
Now check and modify the status of your network/physical smf services:
guest@opensolaris:~# svcs -a | grep network/physical
disabled 12:36:58 svc:/network/physical:default
online 12:37:02 svc:/network/physical:nwam
guest@opensolaris:~# svcadm disable /network/physical:nwam
guest@opensolaris:~# svcadm enable /network/physical:default
guest@opensolaris:~# svcs -a | grep network/physical
disabled 13:20:57 svc:/network/physical:nwam
online 13:21:20 svc:/network/physical:default
Configure the e1000g1 interface:
ifconfig e1000g1 inet 192.168.2.50 netmask 255.255.255.0 broadcast 192.168.2.0
ifconfig e1000g1 up
Configure the e1000g0 interface:
ifconfig e1000g0 dhcp
5. Start the auto install service, run the command:
installadm create-service -n 0906x86 -i 192.168.2.60 -c 4 -s /images/osol-0906-111b2-ai-x86.iso /export/aiserver/osol-0906-ai-x86
NOTE:
The assumes you've put the iso image in /images and named it osol-0906-111b2-ai-x86.iso
The -c option is the number of clients you've configured in /etc/hosts, in this example it is 4
The -i option is the address of the first client you've configured
You should see:
Setting up the target image at /export/aiserver/osol-0906-ai-86 ...
Registering the service 0906x86._OSInstall._tcp.local
Creating DHCP Server
Created DHCP configuration file.
Created dhcptab.
Added "Locale" macro to dhcptab.
Added server macro to dhcptab - opensolaris.
DHCP server started.
Unable to determine the proper default router
or gateway for the 192.168.2.0 subnet. The default
router or gateway for this subnet will need to
be provided later using the following command:
/usr/sbin/dhtadm -M -m 192.168.2.0 -e Router=<address> -g
Added network macro to dhcptab - 192.168.2.0.
Created network table.
adding tftp to /etc/inetd.conf
Converting /etc/inetd.conf
copying boot file to /tftpboot/pxegrub.I86PC.OpenSolaris-1
Service discovery fallback mechanism set up
Verify the service creation has worked:
Start up firefox and go to http://localhost:5555 it should show an 'Index of /' page
6. Now setup dhcpmgr and ipv4
run dhcpmgr
Select macros and double click on the dhcp_macro_0906x86 to bring up a macro window and add the following macros:
Router with the value of the ip address of this machine (192.168.2.50)
DNSserv with the value of the IP address in /etc/resolv.conf (or one of them if more than one is listed)
NOTE:
DNSserv will need to be *changed* when you move the system around to the current value in /etc/resolv.conf
8. Fix up the server to allow for IPv4 forwarding:
routeadm -e ipv4-forwarding
routeadm -u
9. Create your client machine in VirtualBox
* Give it a hard disk of 16G or more
* Set the boot order to be network first (Settings->General->Advanced)
* Set the network to be internal (in the same way as you setup the e1000g1 interface earlier, using Settings->General->Network)
10. Startup the client
You'll get the PXE boot, a dhcp address, then the grub menu for 2009.06 with a single line and then you'll get the screenshot you see below:

11. When it is installed
You'll get a successful completion messages and if you look at the /tmp/install_log file the end will look like this:

To use your newly installed image shut it down, then go and change your network boot priority or remove (deslect) it completely (Settings->General->Advanced).
Once you have done that you can boot your newly installed machine.
The install log can be found in /var/sadm/system/logs/install_log on the installed client machine.
Note: Thx goes to Pete Dennis on my team for working with me on this.

