Home Audience For U & Me How to Remaster Ubuntu to Get a Customised Distribution

How to Remaster Ubuntu to Get a Customised Distribution

3
12368
Customise Ubuntu

Customise Ubuntu

In this article, we look at how to create a custom GNU/Linux distribution based on Ubuntu.

Customisability is a feature most people find amazing about Free Software. The software can be tweaked to any extent to suit individual tastes. Though this has created confusion with newbies, it has always helped the software to grow. We can create modified versions suitable for a specific purpose, eliminating the need to reinvent the wheel — i.e., creating parts that are already available.

Why not apply this to a distro? You may be a sysadmin who needs to install a specific set of tools across all company systems, a student who needs an elegant solution to distribute Linux-based software, or a geek who loves to tweak software just for the fun of it.

I first thought of a custom distro when some of my classmates complained about the difficulty in obtaining and installing software tools needed for coursework in GNU/Linux. Most of them were new users of the GNU/Linux platform, so they wanted a simple solution that suited everyone. My friends and I, while looking for solutions, thought of looking for a distribution in which all the software we needed was preinstalled. However, a few Google searches disappointed us. There are distros such as Uberstudent, which are designed for students, but there were none that were specifically for technical students. That’s when we decided to roll out our own, and we’re happy that we did.

Customisation of the base distro

We selected Ubuntu as our base system, for its manageability, and also because most of our users are new to GNU/Linux. To rebuild the distribution we used Remastersys, a useful software that packs your existing system into a “live” disk image. Let’s look at how we did this.

To create a custom GNU/Linux distro, you need to install and customise the base distro first; so we installed a fresh copy of Ubuntu onto a system that was going to be our “build” machine. Next, we applied all our customisation to the system, installed the software we needed, and applied customisations to the desktop.

With that done, it was time to install Remastersys. To do this, add the repository to your apt sources by appending the following line to the /etc/apt/sources.list file, as you can see in Figure 1:

deb http://www.geekconnection.org/remastersys/repository karmic/

This line differs based on the distro version; see the “Where can I get remastersys?” section of this Ubuntu Information article. As you can see my base Ubuntu version is Ubuntu 9.10 Karmic Koala.

Editing /etc/apt/sources.list
Figure 1: Editing /etc/apt/sources.list

After saving sources.list, execute the following code in a terminal to reload the package lists and install Remastersys:

sudo apt-get update && sudo apt-get install remastersys

Preserving customised user settings

When building the live image, by default, Remastersys excludes the user’s home folders, so as to not include personal settings/data into the build. This will cause any interface (desktop) customisation in your user account to be reset to Ubuntu defaults when the live image is booted. How do we maintain these customisations in the live image as well? There is a standard “skeleton” folder, /etc/skel, that is copied as the home folder for each new user created on a GNU/Linux system (see Figure 2).

Contents of /etc/skel
Figure 2: Contents of /etc/skel

In our user account’s home folder, interface customisations are stored in the (hidden) .gnome2 and .gconf folders. For example, the wallpaper setting is stored in .gconf/desktop/gnome/background/%gconf.xml. Copying these files (preserving the folder structure) to the skeleton folder solves the problem.
Editing the %gconf.xml file
Figure 3: Editing the %gconf.xml file

If there are other settings that you need to preserve, you can use the same method, since almost all GNU/Linux software stores user preferences in the home folder. You can also edit the main system configuration files to customise default settings for new user accounts.

Building the system

Having completed all the initial steps, let us move forward to the final steps to build our release images. By default, Remastersys stores the builds, and necessary files for the build, in the build folder — /home/remastersys/remastersys. If this folder is not present, it is created on first run.

The final building process is divided into two steps. First, we build the “unpacked” filesystem of the image, and then we pack it. Though we can do this in a single step, it is not advisable, in case you need to hack the bootloader configuration before the final packing. Now, let’s start!

Creating the filesystem

Here, let’s create the filesystem for the live disk we are making. This is very processor-intensive; so ideally, don’t run other programs in parallel. Execute the following code:

sudo remastersys dist cdfs

This will start the filesystem creation process. By default, it is built in the ISOTMP subdirectory of the build folder. Inside the ISOTMP folder, you will find the isolinux folder, which contains the bootloader for the disk. The configuration is stored in isolinux.cfg, and the splash.png file is the splash image used for the distro bootloader. You can replace splash.png with an image of your choice, but only use an image of the same resolution and colour depth.

Packing the filesystem

Now we will pack this filesystem into a disk image, which can be burned to a CD/DVD depending on the size. Issue the following command in the terminal:

sudo remastersys dist iso build.iso

Here, build.iso is the desired name for the ISO image. Like the previous step, this is also very processor-intensive. After completion, your ISO image will be in the Remastersys build folder, ready to be tested.

Enjoy your distro!

Note: After you have backed up your disk image, you can run sudo remastersys clean to clean up the non-necessary files.

3 COMMENTS

  1. It hangs and doesnt respond in case your distribution is heavy.. what could be the maximum size of the iso that can be created ??

LEAVE A REPLY

Please enter your comment!
Please enter your name here