Creating Your Own Distributable Ubuntu DVD (Relinux)
Author: Christian Schmalfeld <c [dot] schmalfeld [at] projektfarm [dot] de>
This article is about how to create a DVD image of your machine with the exact same software included on the disk. This can be done using a software called Relinux. Relinux is a fork of the recently discontinued Remastersys.
1 Preliminary Note
The image created with Relinux can under no circumstances be greater than 4 GB, which is why you will need to exclude the home folder as well as possible other folders too big to include. Furthermore, at the time of this article's writing Relinux is only compatible with GRUB2, needs an X11 display and installs metacity.
I have tested Relinux on Linux Mint 11 and it works properly on my machine.
I do not issue any guarantee that this will work for you!
2 Install Relinux
To download Relinux, visit its launchpad site under https://launchpad.net/relinux and get the latest version.
The archive file contains two folders and an installation guide; the two folders must be merged with the original etc and usr folders. Change into the directory you unpacked the two folders to, in my example it is the /home/ctest/Downloads folder:
Now copy the downloaded folders to the original ones:
sudo cp -R usr /
sudo cp -R etc /
Relinux should now be properly installed. You can find further documentations in the /usr/share/doc/relinux/README file.
3 Install Software
To create yourself a unique distributable Ubuntu DVD you need to install the software you want on it on your current system. Do this by opening Synaptic Package Manager and use the search bar to find the packages you want to install. Click the checkbox right next to the package and select Mark for Installation.
Most packages will need to install more packages they're dependent on, you will need to Mark those too.
After you have selected all the packages you want, click the Apply button.
Click Apply once more to confirm your choices:
Afterwards the packages are downloaded and installed:
All software you have installed on your current system will later automatically be transferred to the iso-image of you DVD. Make sure that the content you want on your DVD does not exceed the size of 4GB! Otherwise Relinux will not produce an .iso file out of the filesystem!
4 Use Relinux
Relinux uses a config file for every command which you better edit before you use the program for the first time. Leave the original config as backup and create a new one in a specified location (I'll do it in my personal folder):
cp /etc/relinux/relinux.conf ./relinux.conf
Next direct Relinux to the new configuration file:
sed -i 's:EXCLUDES="\(.*\)":EXCLUDES="\1 '`readlink -f ./relinux.conf`'":g' ./relinux.conf
It is highly recommended to have a look at all the options in the config file and adjust them to your liking. If you do not exclude enough files to bring the squashed file system to a maximum of 4 GB, Relinux will not create an image out of it. Additionally there are other helpful options like the choice of a boot splash screen or the naming of the actual image.
Relinux' actual control is only possible through the command line. It generally has the same options as Remastersys at the moment except for the lack of an explicit backup command, which however can be accomplished by not excluding the home folder:
- sudo relinux clean [configfile] - Cleans the working directory of unimportant process stuff
- sudo relinux fullclean [configfile] - Cleans the working directory completely, including the .iso image, the checksum and all other files
- sudo relinux squashfs [configfile] - Creates the squashed file system to build the iso-image out of. This is the necessary step to take before actually creating an iso-image. This can also be used to retroactively add files to the file system before creating the images
- sudo relinux onlyiso [configfile] - Creates the actual iso-image which can be used in a virtual machine or burned on a CD to boot your custom system from (before choosing this option a file system must have been created using squashfs)
- sudo relinux iso [configfile] - Creates the squashed file system and the .iso image in one command
Since you most likely want to use the image you create for burning it on a DVD you should pay attention to the summed size of software and files you add to it.
Every file created with Relinux will be placed in its temporary directory, which by default is /home/relinux. That counts for filesystems as well as for images (e.g. custom.iso by default). Be sure you move your image to some other place since this temporary folder will be emptied on the use of fullclean.
5 Add Files to a Non-Backup Filesystem Without home-folder
If you have a home folder that is to large to put it on a DVD but still have files that need to be on the image, there are two ways you can put them on it; one has to be dealt with before you create the file system and one that can also be done after it has been created.
5.1 /etc/Skel Folder
To add files to your non-backup image before you create the file system, just put them into the /etc/Skel folder to let the files appear in your home folder on the image afterwards. The /etc/Skel folder is responsible for populating the home folder on every installation and every adding of a new user.
Squashfs-tools is package that allows you to build and uncompress but also to add files to squashed filesystems, which are also used to build the filesystem on Remastersys and Relinux. They can be used to append files to already created filesystems. Install them by entering the following into a terminal:
sudo apt-get install squashfs-tools
The squashfs-tools offer two commands to use, one to create filesystems or add files to existing and one to uncompress them. The first one is
and its basic structure is the command followed by one or more source files or folders and the path to the squashed file (e.g. mksquashfs /home/ctest/Desktop/bla /home/ctest/Desktop/ultimate.squashfs). The last folder in the path of the source file will be the root of the squash filesystem unless you specify otherwise with an option, meaning it will not be directly displayed itself. The same command is also used to append files to existing squash filesystems, which is what we basically want. To do so, just pick the existing filesystem as the filesystem to create and the files to append in the input files' path. Unfortunately, it is not possible to merge the two filesystems, which is why we circumvent this problem by creating a folder called extrafiles (could be any name) in any folder and choose this upper folder as the one to add to the system (it will become the root folder and the folder inside, the one we want, will be displayed along the files in the filesystem's root folder). Add the files you want on your DVD to the extrafiles folder. Following would be a possible way to add files to the filesystem:
mksquashfs /home/ctest/Desktop/bla /home/remastersys/remastersys/ISOTMP/casper/filesystem.squashfs
In this example the folder bla is the one containing the extrafiles folder. See the man page for further switches and options.
To uncompress a squash filesystem, use following command:
The most common way to use this command should be combined with the destination switch. Make sure to choose an unexisting directory as destination since it will give you an error otherwise.
unsquashfs -d /home/ctest/Desktop/unexistingdirectory /home/remastersys/remastersys/ISOTMP/casper/filesystem.squashfs