Ever wanted to create your own Linux distro but were at a loss where to start? It is easier than you think. Distroshare Ubuntu Imager creates an installable Live ISO from an installed Ubuntu or derivative distribution.
Why would you make your own distro?
With so many Ubuntu derivatives available that cater to almost everyone’s needs, the above question sounds reasonable. Yet you might not be happy with what is on offer. You might have installed and configured your environment to such an extent, creating custom tools and setups, that it would be difficult to recreate. Or you just want to share this special environment with others, such as if you set up a work environment with similarly configured machines. You might have a specific combination of hardware that makes it challenging to make Ubuntu run correctly. You might just want to show off your custom system; after all, Linux is all about variety.
Ubuntu Imager is a tool that was founded to allow you to share your custom Ubuntu distribution with others, and they make the process incredibly simple.
There used to be a tool called remastersys that allowed for easy Live CD creation from your installed system. However, the development of the project has been discontinued for some very unfortunate reasons. Even if you still have a copy, it might not be working as expected for newer Ubuntu systems. While Ubuntu has a very detailed tutorial on how to create live CDs manually, the process is long, elaborate and difficult.
Fortunately, the people at distroshare.com were kind enough to automate the process, putting it all into a bash script that does the bulk of the work. With minimal configuration, anyone would be able to create a live environment with as little effort as editing a text file and running a shell script.
The Distroshare Ubuntu Imager script is hosted on GitHub. To get it, type
into a terminal. When the download has finished, unpack the zip.
In our case, the command was
Once you have the zip unpacked, you can change to the script’s directory
Of the several files found here, the interesting ones are “distroshare-ubuntu-imager.config” and “distroshare-ubuntu-imager.sh.”
You will start by editing the former.
The contents of the file are mostly self-explanatory, and the options are well-commented.
The first line determines whether the GTK or Qt fronted should be installed for Ubiquity – the installer that allows you to install your live system later.
Change this line for Qt (If you run KDE) to
GTK="NO" or even
The next line will be the working directory. This is where your ISO will be placed. In this case it is just the user’s home directory. You can change it to anything you like (but make sure it is an existing directory on your system).
The patch line can be ignored (or rather left as is), but the Display manager must be taken care of. The default setting is for LightDM which is the display manager used by vanilla Ubuntu.
If you run any derivative, you should change the line according to your setup. (As a hint, Gnome uses “GDM” and KDE uses “KDM”, so most derivatives based on these systems will likely use these display managers. A popular derivative system, LinuxMint uses “MDM.”)
If “EFI Support” is needed, change the below line to “YES”:
By default, the script will use whatever kernel the system is running on. By modifying the
you can specify which kernel to use, be it an older or newer one or even one you’ve compiled yourself. Only change this if you know what you are doing. Leaving it at the default setting should be fine for most.
You can specify kernel parameters for the LiveCD
or for the system you’d install from the live CD.
Lastly, you can specify additional packages to be installed. It could be useful if you want to keep the live image as small as possible, but make sure plenty of additional software gets installed with it. List them with spaces between package names.
The last line allows you to insert a URL for your own release notes, if any.
Running the script
You need to run the script itself as root.
The script will do a number of things. After reading the configuration details you’ve just specified, it will create the necessary directories, install some additional software it needs (specifically
xorriso squashfs-tools dmraid lvm2 and
samba-common), determine which version of GRUB needs to be installed and take care of the installation, and install Ubiquity (and its dependencies). After that, it cleans up temporary files, removes ubiquity from your system, compresses the new file system it has just created with squashfs, creates an md5 checksum and grub entries for the new system, and puts it all into an ISO file.
By the time the script finishes (it will take a while), you should have a nice working ISO live image. It could not be easier.
Booting the ISO
The ISO image created can be burned onto a CD, mounted to a virtual machine, or run directly from grub as shown here. You can also copy it to a USB drive with dd.
/dev/sdX is the path to your USB drive.
Distroshare Ubuntu Imager is an easy-to-configure bash script that replaces the sadly missed Remastersys, allowing you to create your custom Ubuntu spins with ease. After editing the configuration file and running the scripts, make sure you show off your work on distroshare.com for everyone to see and use.