Saturday, 19 April 2008

Building a lightweight Ubuntu install using IceWM

As I mentioned in my previous post, there are a number of window managers that make excellent lightweight alternatives to Gnome, KDE or Xfce for getting better performance from older hardware.

If you opt for Fluxbox, you have a ready-made Ubuntu variant for your needs in Fluxbuntu. If you'd prefer IceWM, there is a project called Icebuntu which aims to produce an IceWM-based Ubuntu variant that's fast and ideal for older hardware, and it looks promising. However, this isn't yet very mature, so you may wish to customise an existing Ubuntu install instead. The problem is that if you install Ubuntu then add IceWM to it, you'll still have the Gnome desktop and all its dependencies and applications installed.

Sometimes, it's better to build it up from a basic skeleton. Don't worry, it's not as hard as it sounds, and it's quite fun! It also teaches you quite a lot about how Linux works, so if you have an old computer gathering dust in the attic, you may want to do this just for the educational value. It's also useful for getting old hardware working so you can give it to a computer-illiterate friend or relative (if someone else can get it set up for them, Linux is ideal for the computer-illiterate as it's so much more stable and reliable than Windows).

Using a method like this, you can get an Ubuntu install that only has applications you want. Also, IceWM natively supports both Gnome and KDE apps well, making it easy to pick and mix between the two.

If you want to do this, you'll need to first do a command-line install of Ubuntu on whatever computer you want to set it up on. If you have a DVD copy of Ubuntu (many Linux magazines give distros away on the cover, and Ubuntu is a regular giveaway), then if you boot from the disc as usual, when you get to the menu where you'd normally select "Start or Install Ubuntu", there's an option to do a command-line install.

If you don't have a DVD copy, you'll need to get the Alternate Desktop CD instead of the normal Ubuntu CD. You can get this from the Ubuntu website as usual. Again, boot from it and you'll be taken to a menu which includes the command-line install option.

Select this, and you'll be taken through a text-based installer - don't worry, it's not really any harder than the normal Ubuntu install, you basically get asked the same questions.

Once you've finished your install, boot into your new system. You'll need to log in - just wait for it to finish booting up, then enter the user name you've chosen and press Enter, and you'll be prompted for your password. Once you're in, it's just like the command line when it's open in Terminal or Konsole.

You need to have an Internet connection for the rest of this, although you could potentially use something like APTonCD. It's easiest if you have a router or home network of some kind where you can just connect via Ethernet and be online straight away. I wouldn't want to try this using dialup!

First of all, you'll need to make sure your /etc/apt/sources.list includes all the repositories you need. Enter the following:
sudo vim /etc/apt/sources.list

If you haven't got the hang of Vim yet, feel free to use nano instead. You need to make sure that you have access to main, restricted, universe and multiverse. They will all be there, but it's possible that universe and multiverse may be commented out with a # symbol - if so remove this. You may also want to comment out the CD-ROM by placing the same symbol and a space before it. Now save and exit.

Now enter the following:
sudo apt-get update

Followed by this:
sudo apt-get upgrade

Depending on how old the version of Ubuntu is, there may be a lot of updates to come - if you're doing this now, you may want to wait a few days for Hardy Heron rather than use Gutsy. Once the updates have finished, it's probably a good idea to reboot.

Now, to start installing everything you need. First, you need the X Window Server (this is essentially the bare bones of a desktop, which you can then use a window manager or desktop with). Install this with the following:
sudo apt-get install xorg

As usual, there will be a host of dependencies to add as well, so this may take a while.

You can use X on its own, but it's pretty ugly, so I don't advise it! Instead, we're going to install IceWM now:
sudo apt-get install icewm iceconf icewm-themes menu

The icewm package is pretty self-explanatory, and icewm-themes is a collection of themes for use with IceWM. Iceconf is a graphical application for configuring IceWM, but I've not had much luck with it, and it's often easier to configure IceWM by editing text files as there's plenty of documentation to be found if you Google it. Menu is necessary to enable you to update the menu in IceWM.

Once IceWM is installed, you can start up the X Window Server with IceWM by entering the following:

However, this still means you have to log in from the command line first, and without any software you won't be able to get much done! If you don't want to have to log in from the command line and start X manually, then you'll need to install a login manager to do this for you.

XDM is the default login manager for the X Window Server, and is lightweight, but be warned, it's pretty ugly. If you'd like something nicer-looking, go for either GDM or KDM. Whichever you go for, it's installed as follows:
sudo apt-get install xdm
sudo apt-get install gdm
sudo apt-get install kdm

Just choose the one you want to use, and next time you log in, X will start automatically and you'll have a nice graphical login screen.

Now we've got a desktop in place, we can start thinking about applications. First of all, you're going to need a terminal emulator so you can easily open the command line. Here, you can choose whichever you want. If you want just a basic emulator, then xterm is a good choice. If you're already used to the Gnome or KDE terminal applications, these can be installed instead. Or there are several which run in the background and can appear at the press of a button, namely Tilda for Gnome and Yakuake for KDE - I personally recommend Yakuake, once it's running press F12 and it'll drop down from the top of the screen.

Now you've got enough to finish the rest from the desktop so you can reboot or enter startx if you wish. You might want to run the following first to make sure you can get access to the terminal emulator you just added:
sudo update-menus

That updates the IceWM menu to show the installed applications.

Once you're logged into your new desktop, open whatever terminal emulator you installed. First thing you need to think about is a file manager. This is up to you, but two good lightweight file managers worth considering are PCManFM and Thunar. PCManFM has a tabbed interface similar to Konqueror, but is much lighter, while Thunar is a more conventional but lightweight file manager. XFE is even lighter, so may be better for lower-performance systems. You can always try different ones to see which appeal to you.

You'll probably need to install an icon theme to show nice friendly icons in your file manager - the package tango-icon-theme is a good choice. When you start the file manager, it will usually prompt you to set up a file to configure the icon theme it uses. Don't worry - this isn't as hard as it sounds. It will usually give full details of the kind of thing you'll need to put in the text file.

Next you may want a web browser. Firefox is always an option, but it may not be fast enough for older machines. At the other end of the scale is Dillo, which is very fast, but not really up to supporting most modern websites. There are a number of Gecko-based browsers similar to Firefox, but lighter, which may be worth trying - Kazehakase is a particularly good choice.

If you want a lightweight e-mail client, then Sylpheed is an excellent choice. Thunderbird is always an option, or if you use web mail you can always do without. If you use Gmail, then you're in luck - there's a number of desktop applets that work OK in IceWM and will notify you when you receive a new email and will even let you open your inbox in a browser with a few clicks, of which probably the best is gmail-notify.

Finally, if you want a graphical package manager, then you can install Synaptic from the repositories, however if you've made it this far, you can probably survive without it!

From here, it's up to you. Having come this far, I'm sure you can add whatever applications you want from the repositories without my help. Don't forget, to use things like Flash and MP3 playback, you'll need to install the ubuntu-restricted-extras package. Just remember, to update the menu in IceWM, you'll need to run the following command, otherwise your newly installed applications won't work:
sudo update-menus

Please note that there's no reason that you can't install all the additional software at once - I've just done them separately to make it clearer what's going on.

For more ideas about creating a lighweight Ubuntu desktop, including applications you can consider using when setting up the system, you may wish to refer to this document. You may also want to take a look at this document for ideas on how to set up your new IceWM desktop.

Because IceWM doesn't come preconfigured the way Gnome or KDE do, and the configuration application isn't much use, it's generally necessary to configure it using text files. Don't worry, the text files aren't hard to set up at all, it just needs you to do a little studying before you get started. If you're not sure you're up to it, you can always try it out in VirtualBox so you can get the hang of it before moving to an actual computer, and have access to the host OS's web browser in case of problems.


Anonymous said...

Superb blog. I've written similar blog at however I think icewm needs lot of improvements to match the new needs. I'm using icewm since 2001 and it is still the same as it was 7 years ago. Time for icewm team to introduce icons on desktop.

orgone said...

Great guide - thank you! Got so fed up up with finding so-called 'advice' stating "install ubuntu-desktop", which i profoundly wanted to avoid like the plague. Why someone wanting to install IceWM could care a fig for U-Desktop is beyond me. In particular the advice to install a display manager made all the difference - i was trying to figure out how to get into gfx at boot and this nailed it. Tried wdm (Wings) but finally settled on gdm because it looks nicer and friendlier. Userver + IceWM + gdm rocks and no 10000 unremovable apps!

MattBD said...

Glad you enjoyed the guide! I'm planning to do a guide to creating your own customised live CD based on Ubuntu at some point in the near future, so you may want to keep an eye out for this.
From Hardy onwards, the Ubuntu repositories have included SLIM (Simple LogIn Manager), so that's also a good choice. I haven't tried WDM yet, so I may give this a try.

Bruno Cassol said...

Great guide! I'm testing it in VirtualBox as soon as I finish downloading ubuntu alternate iso.

One question, How can I skip the login manager and auto-login into icewm directly?

I know about the auto-login feature of the login manager, but that's an overhead I'd like to remove.


MattBD said...

Bruno, I don't know of a way of being able to log in automatically without using a login manager. GDM will do it but it's got quite a high overhead. I recommend SLIM, which is a very lightweight and easy to configure login manager. You can easily configure it by editing the /etc/slim.conf file.
I found a link to a site which explains how to up automatic login on the Fluxbox version of Linux Mint Felicia (which is based on Ubuntu). You should hopefully be able to use the same thing within Ubuntu.

Bruno Cassol said...

Thanks for the reply.

One question: Your keyboard/mouse was detected automatically?

MattBD said...

I've always found that even a minimal Ubuntu install always seems to successfully detect my keyboard and mouse. However it's a good idea to make sure you set up the correct keyboard map from the option screen you get when you boot from the CD using F2 and F3.
Incidentally, there's an Ubuntu respin called Ubuntu Mini Remix which you can easily remaster to create your own Ubuntu-based distro. At the time I wrote this article I didn't know about this, but I plan to cover remastering it at some point in the future since this is a great way to get a customised Ubuntu respin you can use as a Live CD.