Clone and deploy desktop computers with FOG
The Impersonator
Managing a network full of computers can sap the energy out of any admin, irrespective of the number of computers in your network. Whether you oversee a lab full of computers at school or the network of a multinational company with offices across the world, you can use the FOG project [1] to manage them with ease.
FOG helps take the pain out of time-consuming and repetitive tasks such as imaging and cloning computers. FOG also makes light of regular administrative tasks such as installing software and can even manage printers on the network. All theatrics aside, FOG's most essential task is to help you image an installation that can then be deployed to other computers on the network, which is what I'll cover in this tutorial.
Set Up the Imaging Server
To use FOG, you first need to set up an imaging server. The project officially recommends using a long-term support (LTS) version of a distribution intended for server installations. I've personally tried it on CentOS [2], but it's known to work on other distros as well.
Before installing FOG, make sure the server has a static IP address, which can be easily ensured from your router's admin page. For this tutorial, I'll assume our FOG server is at 10.0.0.1
. You'll also have to make sure that all the machines in your network are configured to boot from the network card. Finally, remember to disable any existing DHCP servers on the network, as you'll set up the FOG server as a DHCP server and hand out addresses to all the computers on the network. You can create a virtual lab inside VirtualBox to deploy the server and see how it interacts with other computers inside the virtual lab (see the box titled "Virtual Lab").
Virtual Lab
You can use the VirtualBox's internal network feature to create an artificial lab for testing FOG's imaging capabilities. First up, create a virtual machine (VM) for the FOG Server. The only thing different about this VM is that it will have two NICs. The first NIC will be connected to the physical network (either via Bridged or NAT), while the other one will be connected to the Internal Network named intnet . Similarly, create multiple VMs that'll act as the computers in your virtual lab. Make sure these VMs also have two NICs, with the first connected to the internal network and the other to the physical network.
Now install the OS in the server VM and deploy FOG as described in the tutorial. During setup, make sure you mark the NIC connected to the internal network as the primary interface. Give this an IP address like 10.0.0.1, which will also be the IP address for FOG's DHCP. You'll now be able to access the FOG Dashboard from inside this VM at 10.0.0.1/fog/dashboard
. The other VMs that are connected to the internal network will be able to communicate with the server. You can now use this virtual lab to follow the tutorial.
Once you have your network set up, head to the machine that you've earmarked as the FOG server and download [3] the latest stable FOG release (v1.5.7 currently) from its Git repository with:
$ git clone https://github.com/ FOGProject/fogproject.git ~/fogproject
Once it's downloaded, change into the directory and fire up the installation script:
$ cd fogproject/bin$ sudo ./installfog.sh
The installation script [4] will prompt you for several bits of information such as whether you're running a Red Hat-based distro or a Debian-based one, the IP addresses of the server, the router and the DNS server, and whether you'd like to set up the FOG server's own DHCP server. In most cases, it's best to go with the default options suggested by the installer. While it installs the required components, the installer will ask you to install the database scheme by heading to the FOG server's web-based management interface. For your convenience, it'll also print the exact URL where you need to go. After installing the database following the instructions on the web page, come back to the terminal and press Enter to continue the installation.
When it's done, the installation script will display a URL for FOG's Dashboard, such as http://10.0.0.1/fog/management
(Figure 1). Open the link in your web browser and log in with the default username (fog) and password (password). Before going further, it's a good idea to create another user with administrator privileges. Head to User Management
| Create New User
to define a new administrator.
Image the Host
Now that the imaging server is set up, you can use it to image a computer. Once a computer has been imaged, you can then deploy that image to other computers with a single click. To begin the process, head to Images | Create New Image . Use the fields in the form to describe the image. For example, assuming you are creating an image of a Fedora 30 Workstation installation that you'll then use on all your computers in the network, you can name the image Fedora 30 Workstation . Next, use the Operating System pull-down menu to specify this image's operating system (Linux). Finally, select the correct disk layout scheme from the Image Type pull-down menu. My Fedora installation is on a single disk with multiple partitions, so I'll select the second option (Figure 2).
Now head to the computer with Fedora 30 that you wish to use as the base image and boot it up. Since you've set all the computers in your network to boot from the network card, it'll display the PXE boot environment from the FOG server (Figure 3). Scroll down the FOG menu and select the Quick Registration and Inventory option. The FOG server will now scan the computer and add it to its repository of known hosts.
When it's done, power down the Fedora computer and head back to the FOG server. Fire up the dashboard and head to Hosts | List All Hosts . You should now see the Fedora 30 machine listed here, which by default is identified by its MAC address. Click on the edit icon to change it to something more identifiable like Fedora30Master . Before saving the changes, make sure you associate an image with this host. Use the Host Image pull-down menu to select the Fedora 30 Workstation option for the image you created earlier.
You're now all set to image the Fedora installation. Head to Tasks | List All Hosts , which will list the recently added Fedora machine. Under the Tasking section, click on the upload arrow icon corresponding to this host.
Now head to the Fedora machine and boot it up. It'll again detect FOG's PXE and automatically image the machine and upload a compressed version to the FOG server (Figure 4). The process will take some time depending on the size of the disk it has to image, the processing capabilities of the computers involved, and the speed of the local network. The Fedora computer will restart once it's done uploading the image. You can now head to Images | List All Images to verify the image and make sure it's associated with the correct host. Repeat these steps to image any other computer on the network.
Deploy Target Machines
Before you can deploy an image to another computer, you need to first register these target computers with the FOG server as well. The registration process for the target machines is the same as the process for registering hosts. Boot the new computer from the network, which should detect FOG's PXE environment, and, when it does, select the Quick Registration and Inventory option.
Once a new target computer has been added to FOG's repository of known computers, log in to the FOG dashboard and head to Hosts | List All Hosts . Just like before, click on the edit icon corresponding to the newly added machine and rename it so that it's more identifiable, something like Lab01_Desktop01 . Most importantly, remember to associate the Fedora 30 Workstation image with this computer using the Host Image pull-down menu. Repeat the process to register all the computers in the lab with the FOG server. Then edit them in the FOG Dashboard to give them an identifiable name and associate them with the appropriate image such as the Fedora 30 Workstation image that was created earlier.
Now to replicate this Fedora image onto the target computers, head to Tasks | List All Hosts . Browse the list of hosts to find the entry for the computer to which you wish to deploy and hit the corresponding down arrow image Deploy button (Figure 5). After the deploy task has been created, head to the workstation, and power it on. The computer's PXE environment will automatically detect the task from the FOG server and begin copying the image from the server onto the local machine. Again, it'll take some time to complete, but when it's done, you'll end up with a mirror copy of the Fedora 30 Workstation installation on this computer.
Buy this article as PDF
(incl. VAT)
Buy ADMIN Magazine
Subscribe to our ADMIN Newsletters
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Most Popular
Support Our Work
ADMIN content is made possible with support from readers like you. Please consider contributing when you've found an article to be beneficial.