If you have ever installed a common Linux Distribution like Ubuntu or CentOS you have probably installed it either from Disk, USB or into VMware workstation; and this is fine. However, when deploying Linux operating systems in larger environments a better way is often to install it over the network, either from a PXE server or net-install image: in this post i’m going to look at netinstall images. A netinstall image is essentially the absolute minimum files needed to boot into the install environment and begin the installation process, the rest of the files are then downloaded from an appropriate mirror. The main advantage of this method is the fact that the latest files are downloaded each time and thus you are always installing the most up-to-date image, rather than using an image which was created months ago. Take note that the name of the netinstall image varies by distribution: for example, Ubuntu refer to it as “minimal cd”. Generally it’s 50mb or so.
Downloading netinstall images
To start the process you’ll first want to download the minimum install (netinstall) image from the appropriate site, depending on the distribution you wish to install.
The Ubuntu image can be found here: https://help.ubuntu.com/community/Installation/MinimalCD
The CentOS image here: https://wiki.centos.org/Download
Creating and using the netinstall image
Once you have downloaded the appropriate netinstall image, burn it to a disk or make a live usb. Use the boot media to boot the client(s) and start the installation process.
Once you select your keyboard layout and language settings, you can choose which packages you wish to install and it will proceed to download and install the full customised operating system.
Configuring a local mirror
The downside to carrying out an installation this way, is that it takes quite some time due to the fact that it downloads the majority of the OS each time. A useful way to optimise the process is to pre-configure (and keep updated) a local mirror which will house most of the files required for the system installation. You can then netinstall clients and pull the files from the local server, to ensure fast up-to-date installs. To configure a local mirror you must ensure you have a lot of storage space and then you can begin creating the mirror in a number of ways. It’s possible to use Apt-Mirror, Debmirror, Rsync; as well as a few other tools to create a mirror. Below i use Rsync, which can be run once or added to your crontab file to run it every so often and download incremental changes (not all of the files each time). Rsync copies the files from the existing archive and “clones” them to the chosen directory – in my case /opt/mirror/ubuntu. The –progress flag shows the progress as it downloads the files.
It’s possible to further optimise the netinstall process by using a kickstart file (answer file) to automatically configure preferences during the netinstall process, this prevents the administrator from having to manually enter these values each time. Whilst netinstalls can be very useful, in a large environment requiring frequent deployments and installs it can often be even more efficient to configure a dedicated PXE installation server, which allow clients to boot directly to a server and begin install an image without the need for netinstall boot media.