There a few reasons why you might want to build your own distribution. You might want to build a custom install CD to match the policy of your organisation. For example, a GNOME desktop with Chrome as the web browser might be the standard desktop where you work. That touches on another motivation for wanting to create a customised installer: sometimes the creator of the distribution makes a decision that you simply don’t like. Canonical’s decision to switch to its own UI, Unity, ranks amongst its most controversial decisions. However, by using some of the methods that we explore here, you could create a distribution that is standard Ubuntu, but with a traditional desktop that you are more comfortable with.
There are other, niche reasons for wanting to build your own distribution. You might need to put something small and lightweight together for an older computer. You might need to build a live media ISO that you are able to carry around with you and to bring your favourite set of tools to bear when you need them.
The methods of creating a custom distribution are varied, but they can be divided into two main categories: you can modify a running distribution and then distribute it, or you can modify the installation ISO (called ‘remixing’) so that it installs your modified distribution in the way you have specified. We’re going to take a look at four approaches.
Remastersys is a tool that extracts the configuration from a running Ubuntu or Debian installation and then turns this into an installable ISO image. This means that you carry out the customisation using the standard tools that you normally use, such as the package management system and GUI configuration tools. When you have everything set up the way you want it, you can clone the system and deploy it. Additionally, you can use Remastersys to make a clone of a working system.
The development status of Remastersys is currently in transition. At time of writing, the best policy is to visit the Remastersys website and to cut and paste the repository details from there. For example, if you are using Ubuntu 13.10, download the GPG key and add it from the command line with:
wget -O - http://www.remastersys.com/ ubuntu/remastersys.gpg.key sudo apt-key add remastersys.gpg.key
deb http://www.remastersys.com/ubuntu precise main
…to the end of /etc/apt/sources.lst by invoking a text editor as root.
Following that, type sudo apt-get install remastersys remastersys-gui in order to install Remastersys and its GUI.
When you have the installation set up the way you want it, launch Remastersys by typing sudo remastersys-gui. The first option we need to visit is the customisation page which is reached by clicking on the Customise button. From here, you can change branding options such as the various splash images. From within this page, click on Copy Settings. This takes you to a further page on which you can select the user whose settings will be copied to /etc/skel/. In other words, these are the settings that will become the defaults for all new users on the new system. If you skip this stage, new users will simply have the default settings for the distribution.
Finally, build the installation ISO simply by clicking on the Distribution button on the main menu page. The ISO is deposited into the /home/ remastersys/ folder. Use networking to transfer the ISO file to the outside of the VM. We usually install Filezilla and transfer to a local FTP server. You can now boot the ISO on the target machine and carry out a regular Ubuntu installation.
SUSE Studio allows you to build a customised SUSE Linux installation using a web interface. Although it’s easy to use, that doesn’t mean it has compromised on options.
Initially, you choose a base template such as KDE Desktop or Server. From this point, you begin the configuration properly. The first tab is labelled Software, which is where you choose software packages with an interface that is categorised and searchable.
Example deployment: Business desktop
Here we’re going to put together an example appliance. In this case, the appliance will be a business desktop that based around GNOME. We’ll add a few customisations as we go along, and we want to finish up with an installable ISO that we can use for deployment.
Begin by setting up an account on the SUSE Studio website. You do this by following the ‘Sign In Or Create An Account’ link on the front page, and it is possible to use one of your existing social networking accounts such as Facebook or OpenID if you prefer.
Once you have an account, click on ‘Create New Appliance…’. On the next screen, choose the GNOME Desktop base template, making sure that you are selecting from the templates that relate to the latest version of SUSE Linux. Scroll down to the bottom of the window to choose your architecture and then give your appliance a meaningful name. Click OK, and after a short delay, we can start honing the appliance to match our own requirements.
As this is a business desktop, let’s add LibreOffice to it. To do this, select the Software tab and type the word ‘libre’ into the search box. The search is real-time, so you should soon be presented with a list of matches. Note that they are sorted by popularity and the package called LibreOffice should be at the top of the list. Click the ‘+add’ button to add this package. For a big software suite such as LibreOffice, it may take a few moments for the interface to register all of the needed dependencies. Add Firefox too. Staying in the Software tab for moment, it’s worth noting that you are able to add extra repositories and even custom RPM packages.
We’ll select the localisation options next. Proceed to the Configuration tab and select the General sub-tab. In here, select English (UK) as the language and keyboard layout and Europe and United Kingdom as the region and time zone respectively. Note that you could also have selected Ask on first boot for any of these options as well.
We’ll leave the network options as they are, but this is where you would disable DHCP and specify a static IP address for the workstation, or disable the firewall if you needed to. At the bottom of the page, we can see a list of users and groups. It’s a good idea to change the root password from the default. Now click on ‘Add new user…’ and create a standard user who is a member of the Users group.
Moving to the Personalize sub-tab of the Configuration page, we can now add some custom branding. This might fit in well with the policies of your organisation, and it is also extremely handy for at-a-glance identification of a desktop within a busy IT environment.
The Files tab is worth a visit if you need to add custom files to the distribution. You can add single files or archives. For example, if you wanted to add a file to the desktop of every new user, you should upload it and specify that it should be placed in ‘/etc/skeleton/ Desktop’. If you wanted to place a file within the home directory of the user that you have created called John, add it to ‘/home/john/’.
As a finishing touch, pop into the Configuration>Desktop page. Tick the box to
automatically log the user in. Add the command firefox to the Autostart desktop user log-in section to automatically start Firefox. Opinions vary, but these options allow the user to get straight to work.
Build the ISO
The options within the Build tab are particularly interesting because they allow you to specify the output format of your custom build. This means that you don’t necessarily have to carry out a full installation in order to use your custom build.
For example, you can create a virtual machine that will directly boot within a visualiser. If you want to work like this, you will probably need to skip back to the Appliance sub-tab within the Configuration tab to define the parameters of the VM. Here, you can choose options such as allocated memory and set up the LVM partition arrangement. Apart from the various VM environments you can directly create, you can also create a traditional ISO installer, a hard disk image or a live CD/USB image.
In order to create a traditional installation ISO, select ‘Preload ISO (.iso)’ in the Default format and click on the ‘Build’ icon. This can take a few minutes to complete, depending on how large and complicated your custom image is. Although it may take several minutes for your image to build, once built, your appliances remain on the site and can be downloaded without delay. The final tab, Share, is an intriguing function that allows you share your finished appliances with other people.
Boot the finished ISO as you would any other installation ISO. Confirm that you wish to erase all data on the hard disk when prompted.