Remix Linux: how to customise your install

29th Nov 2009 | 09:00

Remix Linux: how to customise your install

Make Linux work your way by tweaking and tailoring your distro

Ubuntu Customisation Kit

Mainstream Linux distro developers have to make decisions that affect thousands of potential users.

Should they include or remove a particular package? Should they apply a patch that may break compatibility with older machines?

These matters are discussed fiercely in forums where trolls growl, flames burn and project leaders defend their decisions against an onslaught of dissident. But as an individual you have none of these issues.

You can install and remove packages as and when you want to, and you can choose whether to install free or non-free software on your system. Why should you have to live with community decisions when you can make Linux work your way?

However, the distribution you install will likely contain drivers and components that you don't really want or need on your system.

Not only that, the software you always install on every new system has to be downloaded and installed separately each time, which is time-consuming and inconvenient. That's where we come in.

If you spend more time programming than you do playing games, you could replace the game packages with your favourite IDE. Or why not remove drivers for hardware you'll never need and save disk space?

Those of you who found useful speed increases in last issue's Supercharge Linux feature could even apply those tweaks automatically from the install stage. Whether you're tailoring a system for a particular machine or plotting to knock Ubuntu off its perch, there are myriad tools out there to help you do it.

Some are easier to use with less potential for customisation, while others are more difficult to configure but give you maximum control. We'll cover the pitfalls and which areas you can tweak and tailor to suit your needs, but in the end you are in control, and can apply as many or as few changes as you want – it's your Linux, your way.

Tailor Ubuntu for your own ends

If you're fed up with installing the same components each time you install Ubuntu, you'll find this is by far the easiest way to customise your install CD to include those packages.

You'll need 5GB spare space on your hard drive, an Ubuntu install ISO and Ubuntu Customisation Kit installed from your package manager. Once you have these resources available to you, simply launch UCK and follow the on-screen instructions.

You'll find that most of the usual steps you would have had to take in the past to edit your live CD are all automated. Add this to the intuitiveness of the GUI and it's easy to see that anyone with the inclination can customise their copy of Ubuntu quickly and easily. You can edit Ubuntu as much or as little as you like but you'll be the one calling the shots.

A common pitfall within the UCK setup is to miss the dialog that enables you to change which packages are included or omitted by default, with the result you wind up with a standard Ubuntu install disc with a custom name, which isn't overly useful!

To ensure you gain access to Synaptic, answer 'Yes' when you're asked whether you want to customise the CD manually during building. This will give you a dialog that offers to open Synaptic or a terminal, or continue the installation.

Decisions, decisions

In our example (cunningly called BobBuntu) we installed the Medibuntu repository (see LXF124's tutorial on Ubuntu PPAs for more insight on this) by opening the terminal from the dialog, and ran the following command:

wget http://www.medibuntu.org/sources.list.d/jaunty.list
--output-document=/etc/apt/sources.list.d/medibuntu.list

You can then install the GPG key for the repository by typing:

apt-get update && apt-get install medibuntu-keyring && aptget update

This third-party repository gives us access to all kinds of non-free software such as Adobe Reader, Skype and codecs for restricted media formats.

Firing up Synaptic from the dialog should now show Skype packages available when you search for it (you may need to reload the list of packages).

In BobBuntu we also stripped out OpenOffice.org and replaced it with AbiWord and Gnumeric, then removed Ekiga and replaced Firefox with Epiphany. You can include your own choice of software from a Launchpad PPA and any third-party repositories, or remove packages you rarely use simply by checking and unchecking boxes.

Once you have committed your changes by clicking on Apply you can then proceed to the build stage, which will produce your live CD image in the /tmp/remaster-newfiles/ directory as lived.iso. When the build is complete you can burn this to CD or try the image out in a package such as VirtualBox to try your own personalised Ubuntu respin.

Ubuntu Customisation Kit has an excellent array of features. You can easily select packages, desktops and locales for instance, and you can also include Wubi if you're distributing your respin to Windows users.

Ubuntu satanic edition

SATANIC DESIGNS:Whatever your niche, there's a Ubuntu respin out there for you

However, UCK does lack a few of the features that make the other tools and services worth considering. For example, you can't define the look and feel of your Ubuntu respin without extensive terminal wizardry, and you can't create a boot image for a live USB (though you can do this from your new live environment).

You're also bound to Ubuntu as your host system and an Ubuntu variant as your final product, but despite these shortcomings UCK is a great introduction to distro development and is the ideal tool for those of you who simply want a copy of Ubuntu that installs and runs your favourite working environment from the outset.

SUSE Studio

Generate your own SUSE appliances with your browser

Novell recently launched SUSE Studio, a service that enables you to create SUSE respins from any browser.

At the time we went to press this service was so exclusive it was strictly invite-only, though you could request an invitation via www.susestudio.com. Even in beta this is a powerful, easy-to-use tool.

The primary aim of the service is to enable you to generate virtual appliances using SUSE as a base for almost any purpose, but for our purposes we can also use it to create our own distro respin. From the outset there is a lot of potential to tailor your distro.

You have a choice of which version of SUSE to use, and then you choose a base package that defines which desktop and hardware platform you're likely to be running your respin on. This could include choosing Gnome, KDE or LXDE as your desktop, or deciding that you're going to run it on a server.

Open suse

We recommend you choose OpenSUSE as your platform choice with this service as this tends to be more appropriate for home users, though you do have the option to choose SUSE Enterprise if you so wish.

Further options allow you to define which software is included or rejected using a search tool towards the bottom of the page, and you can also add repositories and custom RPMs by simply clicking on the relevant link. In each case the interface works logically as a browser-based service and is surprisingly intuitive.

Custom file storage

You can then customise the look and feel by selecting from the logos and wallpapers provided, or you can upload your own to give your respin that personal touch.

Uploading files to include from the /home directory of your respin is also a painless exercise, which is an added bonus if the idea of transferring a large music collection every time you reinstall your distro fills you with dread.

The configuration options are also fairly extensive, enabling you to define your locale, whether you want 32- or 64-bit operation, any apps or services you would like to run at startup, and even a virtual hard drive if you are creating an appliance rather than a live CD.

The flexibility and potential of the service is excellent, and is one of the easiest ways to create a SUSE respin customised to your particular needs. And despite all the options available to you, SUSE Studio sets up appliances with a sensible set of defaults depending on which base package you choose, so you can simply make the changes in the areas you want to rather than worry about the formalities.

SUSE Studio is no more difficult to use than any other standards-compliant website, and the navigation enables users to easily to cycle back and forth through the creation stages simply by clicking on the right tab.

An excellent service?

Compared with Ubuntu Customisation Kit SUSE Studio gives you far more freedom to customise your respin, especially as you can run the service on any host through a browser.

However, if you don't have a particularly fast internet connection then downloading your finished appliance or live CD may be a major downside, which you'll feel especially keenly given that there are other offline tools that you can use to accomplish much the same purpose.

Even if you do have an internet connection fast enough to use this service, you may feel stymied by the fact that you can only create SUSE respins, though this is to be expected from a service that has been developed by Novell (which owns and maintains SUSE).

However, the code behind SUSE Studio will be released under an open source licence once it moves out of beta, so we may yet see similar services spring up for rival distros in the not-so-distant future.

SUSE is enterprise hardened and well-supported by the Linux community, but if you're dead-set on respinning another distro then an good alternative is Instalinux.

Step by step: Creating a SUSE Studio Appliance

1.Appliances

Step 1

You can choose the desktop, hardware platform and version of SUSE here with a simple click in a radio button.

2. Choose a name

Step 2

The current statistics about your machine are available in the left-hand pane and update with each choice you make.

3. Software

Step 3

Here you can search for packages using the search tool to add or remove them, and also add additional repositories or upload your own RPMs by clicking the relevant links.

4. Configure

Step 4

Feel free to change the nuts and bolts of your system, including which users are added, locale, startup applications and any scripts you want to include.

5. Design

Step 5

In the same Configure tab you can choose a logo and a wallpaper, or upload your own. The windows at the bottom of the page show what your appliance will look like.

6. Build

Step 6

We chose to build an ISO image, but you can also build virtual appliances for use with VMware Player and images to run your appliance from a memory stick.

Arch Linux

A lightweight and powerful distro designed for respins

Arch Linux is designed specifically for its users to customise it from the ground up. "Big wow", we hear you say, "so is everything else in this feature".

Of course that's true, but unlike projects such as UCK and SUSE Studio, Arch Linux experiences rolling updates to cover bugs and security issues, so you can spend more time considering which desktop or office suite you're going to use rather than what order each package and its associated dependencies need to be compiled.

This also means that Arch Linux doesn't have set releases, as each version is automatically upgraded to the next, so it's brilliantly stable, which is a very important consideration when you're choosing a base for your distro.

Arch linux

For this reason the Arch Linux base package is a great starting point if you want to make more fundamental decisions about your distro than you can with either Ubuntu Customisation Kit or SUSE Studio.

The initial kernel installation tends to be fairly uniform from system to system. You get the chance to set which base packages and drivers are installed, but the rest of the kernel setup is primarily concerned with setting time zone and locale, as well as installing the kernel and bootloader to a hard disk partition.

You are also expected to manually set up several configuration files but if this is your first build you can safely use the defaults in the Arch Linux wiki entry mentioned in the step-by-step guide.

The advantage of using the wiki entry is that you can always edit the files again later to better tailor Arch Linux to reflect your decisions. After rebooting from the kernel install (see below), there are a few steps to take before we can have the fun of installing a desktop, window manager, file manager, etc.

First, type adduser into the console screen and follow the instructions to add a user to log in with an associated password.

Then we need to upgrade the system by running the following:

pacman -Syu

You can probably guess from this that pacman is our package manager, but this stage should not take too long, as you only have a minimal environment at this stage.

Arch Linux uses sudo by default, but if you'd rather use su to gain root privileges, we can install it and add our user to the list of sudoers by using the following commands:

pacman -S sudo
visudo

just below root(ALL)=(ALL)ALL in the file that appears, add:

user(ALL)=(ALL)ALL

replacing user with the login name you chose during the configuration steps.

Setup Xorg

Now we can start setting up a GUI, and a vital component is the X.org. Type in the following to install the binary package:

sudo pacman -S xorg

If you have an Nvidia graphics card, use the following commands to install the driver, configure it then apply it to your installation:

sudo pacman -S nvidia
sudo nvidia-xconfig
cp /etc/skel/.xinitrc

Users of ATI graphics cards will find extensive information about setting things up from here, as each card tends to use a different driver or needs some additional configuration.

Once this step is complete use the latter two lines, replacing nvidia-xconfig with ati-xconfig to achieve the same result.

Install Gnome

You can install any desktop manager you care to mention on Arch Linux. To install Gnome and the various extra utilities, for example, run the following two lines:

pacman -S gnome
pacman -S gnome-extra

Each time you'll be asked if you want to install the lot or fine-tune what you install. Either way, simply follow the on-screen instructions to install a Gnome desktop.

Then you need to open /etc/rc.conf, look for the part that says DAEMONS and ensure it includes portmap, fam and hal somewhere within the brackets.

If you've installed GDM as your login manager (the package name is gdm), you can set it up by opening /etc/inittab and looking for these lines:

# Boot to console id:3:initdefault:
# Boot to X11
#id:5:initdefault:

and changing them to:

# Boot to console
#id:3:initdefault:
# Boot to X11 id:5:initdefault:

Then scroll to the bottom and uncomment the following line by removing the hash:

x:5:respawn:/usr/sbin/gdm -nodaemon

Save and exit. If you would like Gnome to run applications and scripts at startup, run the following command:

/.config/autostart/*

Install KDE

To install the basic KDE 4 desktop, do:

pacman -Sy kde

If you like the idea of more eye-candy and plugins for your KDE environment you can also install the following packages:

pacman -S kde-extragear
pacman -Sy qtcurve-gtk2 qtcurve-kde4

You can then set up KDM by installing the following packages:

pacman -Sy kdebase kdebase-workspace

then open /etc/inittab and alter the file in the same way as you would with Gnome, this time replacing gdm with kdm. Finally, to ensure KDE can run applications at startup, do:

/.kde/Autostart

Extend and improve

Now you have a base install of Arch Linux that automatically updates and upgrades, you can install any package you care to mention on your system.

Will you install OOo or choose AbiWord and Gnumeric instead? You could install Firefox with your own custom branding (as mentioned here).

Another bizarre possibility is to replace your entire desktop with Openbox and use Avant Window Navigator to launch applications.

If you would like to create a live CD version of your efforts, you could use larch, a script that will produce an ISO from a hard drive image of your install. It is available for download from here.

Arch Linux does take more effort than UCK and SUSE Studio, and you don't have complete control over how packages are managed, but the end result is a great deal more flexibility and control. This is the closest you can get to building your own distro without recompiling every component from source…

Step by step: Install an Arch Linux base

1. Main menu

Step 1 arch

Welcome to the world of text-mode installers! Work your way sequentially from option 0 to 7 following the on-screen instructions to install the Arch kernel.

2. Locale

Step 2 arch

After defining your method of installation, just hit the correct numbers to select your country and define your time zone.

3. Partition

Step 3 arch

You can partition your drive using the built-in GUI tools included in the installer, or you could use cfdisk if you prefer to do things manually.

4. Packages

Step 4 arch

After selecting which categories of package you want, you can choose which individual packages you want. Press Space to select/ deselect and Enter to proceed.

5. Configure

Step 5 arch

Select your text editor (we recommend Nano for newer users). You can get some example scripts from the Arch Linux wiki.

6. Boot

Step 6 arch

Select which partition you want Grub to boot when you're installing the bootloader. Once all is complete with the kernel installation, you can start on the desktop installation!

Linux From Scratch

Make every decision from the ground to build your ultimate distro. For true Linux power users who want to define everything about their distro, from the choice of kernel drivers to whether the default text editor is Vi or Emacs, there is no more thorough way than to build your own kernel and every vital component of a Linux distro from scratch.

And this is exactly where Linux From Scratch comes in. LFS is an ebook created by the online community with this goal of helping inveterate tweakers to create their own unique distro with as little hassle as possible.

The ebook itself (available on this month's coverdisc) details everything you need to know, from building a cross-compiler to using chroot to set up the user environment. However, there are a few gotchas to watch out for when you are creating your own LFS system.

Linux from scatch

Naturally though, we've put the hard yards in so you don't have to. What follows is the LXF refinement of the ebook, and every one of these tips was bought in blood, sweat and sleepless nights.

Our tests followed LFS 6.3 as this was accompanied by a stable live CD with all the tools, packages and patches we needed, but if you would prefer the latest and greatest LFS available (6.5 as we went to press) then all the ebooks cover how to use your mainstream distro to build an LFS system.

Whichever way you go, these tips should help you to a hassle-free install!

Partitioning

When you start the initial cfdisk, a common error is to leave without saving your changes (people then wonder why mke2fs returns a '/dev/ hda1 does not exist' error), so double-check your partitions are available for use by your system before proceeding.

Source location

If you are using the LFS live CD, all your tools, sources and patches are stored in /lfs-sources. It is recommended that you copy these over to $LFS/sources once you've set up the 'lfs' user, as you will then be able to complete most of the stages correctly without needing root permissions.

If you experience any problems, double-check that your working directory is $LFS/sources and that the following command returns /mnt/lfs.

echo $LFS

Bootstrapping

The first time you run a build of GCC (using the 'bootstrap' option), we recommend that you go away and make a cup of tea and drink it. Then make another one – this particular stage takes a while, as you're compiling GCC three times, then comparing the third build to the second build.

The point of this is to check that the second and third builds are the same, which implies that you built GCC correctly the first time round. It is possible to skip bootstrapping, but we wouldn't recommend it, as you may encounter strange errors that are difficult to diagnose later.

New LFS users scattered over various forums often post wondering why GCC is taking so long to build and whether this is normal. Rest assured that it is, but your patience will be rewarded with a guarantee of far fewer problems in future.

On a related subject, it's very common for the build process after you've typed make to take longer than your short-term memory can remind you to type make install when it finishes. Make sure there is no way you could possibly forget to do this, or you will encounter errors later that will have you retracing your steps to troubleshoot the problem.

Kernel API headers

A common mistake is to expect the kernel API headers to be in their own package. This is not the case – you will need to extract the kernel source package (usually of the form linux-2.6.x.tar.bz2) and then move into the extracted directory to follow the steps in the ebook.

Shell quirks

It's important to be familiar with the subtleties of Bash before you embark on an LFS build. You'll be creating symlinks and writing multi-line commands (meaning that where you see \ this should be followed by pressing Enter). However, you may be caught out at this point by the ebook formatting.

Throughout the ebook a multi-line command will not contain a on each line (though you will see this in the terminal). However, if you see a in the ebook, make sure that you type this character in as well with your command. We missed this accidentally while typing this in:

gcc -dumpspecs | sed 's@^/lib/ld-linux.so.2@/tools&@g' \
> 'dirname $(gcc -print-libgcc-file-name)'/specs

and got a bizarre error stating that a file didn't exist. The second line should look like this in the terminal:

> > 'dirname $(gcc -print-libgcc-file-name)'/specs

No typos

If you're using a mainstream distro as a host system, we heartily recommend copying and pasting in shell commands. This is primarily because you are less likely to mistype anything, which may produce an error later on in the process (this usually requires a complete rebuild to solve).

For those of you who are determined to type everything in manually or are using the live CD, ensure you double-check every command before you execute it, and that you're using the correct type of bracket.

Typing in manually makes sense to start with, but eventually you'll encounter this particular beast of a command:

GCC_INCLUDEDIR='dirname $(gcc -print-libgcc-file-name)'/ include &&
find ${GCC_INCLUDEDIR}/* -maxdepth 0 -xtype d -exec rm -rvf '{}' \; &&
rm -vf 'grep -l "DO NOT EDIT THIS FILE" ${GCC_ INCLUDEDIR}/*' &&
unset GCC_INCLUDEDIR

We tried to type this all in one go and accidentally used standard brackets, which wiped out all everything we'd done up to that point! You can avoid this mistake by copying and pasting or by typing in each line individually where you see &&.

Avoid complacency

After the second pass of your GCC build, it becomes easy to configure and install a series of packages with the exact same steps:

./configure --prefix=/tools
make
make install

However, this doesn't last forever, and you'll quickly hit packages that need workarounds and patches for your LFS build to work properly. For this reason you should check with the ebook at frequent intervals to avoid strange behaviour later and possible errors later.

Move to root

You should be logged in as user 'lfs', but as soon as you're instructed you should change to root. You can do this by holding Alt and the right arrow key (you can return to the lfs user by doing the same with the left directional button).

Make sure you make a backup at this stage, as the ebook instructs. All it takes is a badly timed rm command in the wrong directory and your hours of hard work will be rendered pointless.

You can create an archive (and hence save a bit of space) by running the following command:

tar -cvf --file=$LFS/tools/lfs_build.tar $LFS/tools

then copy the tarball to external media or somewhere you can easily recover your system from. Even if you don't use the archive as a backup, you can use it to build other LFS systems more quickly in future.

Build your dream distro

Linux From Scratch opens a window of infinite possibilities, and its accompanying ebook, Beyond Linux from Scratch, has been created for the purpose of extending and customising a standard LFS-based distro.

It discusses package management as well as how to build desktop environments and common packages. To see the scope of what Beyond Linux From Scratch can do, take a look at Nutyx. It's in French and there's no option to use English so far, but the distro has a full desktop and application suite, so it's completely usable.

Nyutx

They key thing with LFS is that you have complete control over which patches and updates are applied. Everything is compiled from source so it's lightning fast, and you always get the choice of whether to upgrade the kernel and which software does or doesn't run on your system.

It takes some serious time and dedication to achieve this kind of distro building nirvana and then maintain it, but the results are worth the effort.

------------------------------------------------------------------------------------------------------

First published in Linux Format Issue 125

Liked this? Then check out How to turn a spare Linux machine into a media server

Sign up for TechRadar's free Weird Week in Tech newsletter
Get the oddest tech stories of the week, plus the most popular news and reviews delivered straight to your inbox. Sign up at http://www.techradar.com/register

Follow TechRadar on Twitter

tutorial
Share this Article
Google+

Most Popular

Edition: UK
TopView classic version