User:Chad-bisd/Using FOG in VirtualBox
- 1 Overview
- 2 Requirements
- 3 Creating the virtual FOG Server
- 4 Creating the Client
This tutorial is meant to introduce the reader to using FOG in a virtual environment using Oracle VM Virtualbox.
- Host computer with dual/quad core process and 4GB+ RAM running a VirtualBox compatible OS
- Oracle VM VirtualBox installed on host computer
- OS Install images (ISO or CD/DVD)
- Linux for FOG server (Ubuntu 10.04 LTS)
- Windows XP, Vista, 7, etc for clients
- Internet connection
Note: VirtualBox works best on processors that support Hardware Virtualization (VT-x/AMD-V). While it will run on other processors, the performance suffers.
Creating the virtual FOG Server
Once you have Oracle VM VirtualBox installed, start it and create a new virtual machine definition by clicking the "New" button. This will start the wizard that guides you through creating a virtual machine definition.
Name the virtual machine and select the Operating System (Linux) and Version (Ubuntu). Select the amount of memory to allocate to the virtual machine depending on how much memory is in the host. Usually 1GB is plenty for a FOG server for testing. Create a new startup disk, select VDI type, dynamically allocated. The size of the virtual disk depends on just how much you plan to test with it. For this test client, only the base install of Windows is used, so 20 GB is plenty. Continue through the wizard and finish creating the virtual machine definition.
Select your virtual machine definition and click Settings. Go to the Network section, click on Adapter 2, and enable it. Change the Attached to: value to Internal Network, and name the network "FogPXE". Click OK to save. Start the virtual machine by double clicking the definition name or by selecting it from the list and clicking the Start button in the VirtualBox top menu.
The First Run Wizard! should start and help you install the operating system. Click Next. Choose the ISO or CD/DVD that contains your OS install. We'll choose an Ubuntu 10.04 Server i386 ISO file that we downloaded earlier. Don't worry about having GUI at this time, we'll install one later if needed. Click Next after selecting the install file. Click Start to begin the OS install on our first virtual machine.
The virtual machine reboots and launches the ISO, which launches the Ubuntu install. Select English for the language and hit Enter. Select "Install Ubuntu Server" from the menu and hit Enter. If your mouse gets stuck in the virtual machine, the right control key will break it out for you. Select English again for the language and hit Enter. Select United States for the country and hit Enter. Select No to detect keyboard layout unless you have a really really special keyboard. Select USA as origin of the keyboard and hit Enter. Select USA as the keyboard layout and hit Enter. The installer begins the process of installing Ubuntu. This may take several minutes.
Configuring the Network
When prompted for the Primary Network Interface, choose eth0 and hit Enter. At this point, it's hard to tell which interface is the NAT'ed one and which is the internal network one, so let's just hope they are detected in the right order. If you chose the right one, it will get IP configuration info from the DHCP server built into VirtualBox. Don't get confused at this point, it's just how VirtualBox assigns IP addresses to the virtual network interfaces that are inside VirtualBox.
Set the hostname when prompted. Choose something meaningful, like FOGMaster, and hit Enter. You'll be prompted for time zone info with an educated guess already chosen. It's usually right, so just hit Enter or select No and choose the right time zone.
Partitioning the Disk
When prompted for disk partition info, select the default: Guided - use entire disk and set up LVM, and hit Enter. You should only have one disk shown in the next screen, so select it and hit Enter. On the next screen you'll have to move the selection to Yes in order to write the changes to disk and configure LVM. So just arrow over to Yes and hit Enter. Leave the default size for the volume group and hit Enter to continue. At the prompt to write the changes to disk, arrow over to Yes and hit Enter. The installer creates the volume group, partitions, and file systems necessary for the OS.
The installer now installs the OS onto the virtual disk. This may take a few minutes depending the speed of the host.
Setting up the Primary User
When prompted for the Full Name of the new user, select almost anything other than "fog". Your first and last name will do just fine. Enter them and hit Enter. The installer prompts for a username and defaults to your first name. This is probably fine unless your first name is "fog". If your first name really is "fog", just make the username "admin" or something simple one word and not a Linux reserved user name (do not use root, nobody, fog, wwwroot, etc...) Hit Enter to accept the username. Type in a password and hit enter. Confirm password and hit enter. Do not encrypt your home directory, so choose No and hit Enter.
IMPORTANT: Remember the username and password from here.
Updating Software Packages
If you use a proxy server to get to the internet, type that information in when prompted and hit Enter. If you do not use a proxy server, leave it blank and hit Enter. The installer goes through a few more steps setting up the system, retrieving a bunch of files from somewhere, whatever. The installer prompts for update settings. Choose No Automatic Updates and hit Enter.
When prompted for addition software to install, leave the options blank and tab down to Continue and hit Enter. All the software we'll need we will install later either via the FOG install script or manually using apt.
Finalizing the Install
Select Yes when prompted to install GRUB boot loader to the master boot record and hit Enter. At the Installation Complete prompt, select Continue and hit Enter. VirtualBox will automatically unmount the install files and boot straight into Ubuntu.
There are a few things to do to the Ubuntu OS after the install. First we'll login as the user we created during the install. The user account does not have root privileges without using the sudo command. Almost every command from here on will begin with sudo.
Setting a static IP
Because the virtual machine has two network adapters, we need to determine which is the NAT'd one and which is the private one. Run the command:
When prompted, enter your password again. You should see the interface configuration printed to the screen. If we selected the correct primary interface during setup, we should see eth0 having an inet addr: 10.0.2.X. If you only have a "lo" interface listed, then we got something wrong. Keep reading and see if you can figure out what is wrong as we continue to configure the network settings.
This virtual machine has two network adapters, but only one is showing up. This is because we have not told Ubuntu how to bring the other interface up, i.e. static IP or dhcp, or even told it we want the other interface to come up at boot time. To do that, we'll edit the /etc/network/interfaces file.
sudo nano -wS /etc/network/interfaces
Let's break down that command and explain what each part does. "sudo" makes the command run in privileged mode. "nano" is the name of the editor. "-wS" are arguments to nano. "-w" means don't wrap long files. Very important when editing configuration files. "S" means smooth scrolling, or line by line scrolling rather that page by page. "/etc/network/interfaces" is the name of the configuration file for Ubuntu's networking interfaces.
Arrow down to the bottom of the page and add a section for the other adapter. In most cases, the second adapter will be "eth1". So hit Enter to leave a blank line and type the following:
# The internal FOG PXE interface auto eth1 iface eth1 inet static address 10.1.1.12 netmask 255.255.255.0
Don't worry about the static IP address too much here. Since this interface is on an "internal network" inside VirtualBox, only interfaces specifically setup to be part of the same internal network will be able to see it. Hit Ctrl+O to save, hit Enter to write to the file /etc/network/interfaces when prompted. Hit Ctrl+X to quit nano.
Bring up the second adapter.
sudo ifup eth1
and check it with
You should see eth0, eth1, and lo adapters. If you do, then we're done configuring the network. If you don't, verify your /etc/network/interfaces file is correct.
It is very important to update Ubuntu before moving forward with the FOG installation. Many issues can be avoided by installing up to date packages for this release.
First, we'll update the package repository since it is out of date. The current repository may only know about the packages from the install file.
sudo apt-get update
Next, we'll upgrade all the base packages that need them. This does not upgrade us from Lucid to the next version, only upgrades the packages within this release.
sudo apt-get upgrade
This takes a while, but when it's done, install the dkms package in preparation for installing the VirtualBox Guest Additions later.
sudo apt-get install dkms
I also had problems with the console scrolling really slow. To resolve this, I added
to the end of the /etc/modprobe.d/blacklist-framebuffer.conf file and rebooted. The console was much snappier.
The FOG install is very standard for Ubuntu 10.04. Please review the Ubuntu_10.04#Setting_up_FOG installation guide.
Some differences from a basic install. You'll want to change the IP address to the one you gave to eth1 when you configured it static. You'll change the interface FOG uses from eth0 to eth1, and you install the DHCP server.
The settings should be: Ubuntu Normal Server 10.1.1.12 no dhcp router address no dhcp dns address interface: eth1 yes to dhcp no to internationalization
FOG will then download and install the various packages used such as Apache2, PHP, MySQL, etc. Since this is a virtualbox install, do NOT put in a mysql root user password. After a while, all the packages will be installed and verified and you'll having a working FOG server.
Leave this virtual machine running for now.
Creating the Client
Defining the Virtual Machine
In the Oracle VM VirtualBox Manager window, click New to make a new virtual machine definition. Our first client will be just to make sure that PXE booting is working, so it doesn't really matter what Operating System or Version we choose. Name the VM "FOG Client 1" for now, choose Microsoft Windows, and whatever version of windows you have a licensed. Specify enough RAM for the machine to work but not run your host system out of memory. Create a new Virtual Hard Disk accepting the defaults. Now select the "FOG Client 1" definition and click Settings. Click the System section on the left and the Motherboard tab in the right side panel.
We're going to adjust the boot device order so the computer tries to PXE boot first. Check the Network option in the Boot Order list, and then use the arrows on the right to move it to the top. Now we need to adjust the network settings, so choose Network on the left panel. We want 1 adapter to be for PXE boot. Change Adapter 1 to Internal Network. From the drop down box for the Internal Network name, choose FogPXE, which must match what you specified for the FOG Server virtual machine adapter. If you select it from the drop down list you're pretty safe it will be the same. Enable Adapter 2 and set it for NAT. This will give out client access to the internet for updates, etc. Click OK to save the settings then start the virtual machine by selecting it from the list and pressing the Start option in the top menu or double clicking the VM Name.
You will get the First Run Wizard. For this time, we're going to ignore this so we can get to PXE boot. Just hit Cancel. After a few seconds, you should be greeted with PXE boot messages and finally the FOG menu. Arrow down to stop the timer so you can read the menu before it disappears.
Installing the client OS
Since we cancelled out of the First Run Wizard! we have to manually start up the OS installer. You can install from a CD/DVD or ISO file. Once you have the disc or ISO file, use the devices menu to attach the device to the virtual machine and then reboot/start the virtual machine and let it run through the boot order, which should be Network, floppy, CD/DVD, Hard Drive. The OS installer should kick off shortly after the FOG menu times out.
Install a minimal OS for now just so we can test upload and deploy.