Sunday 27 April 2008

Setting up a firewall in Hardy

Well, Hardy Heron has been released, and I've already installed it. If you've installed it, hope it went well for you and you aren't having any issues with it. If you have yet to install it, you're in for a treat! It's a great release and a real step forward for Ubuntu.

You may recall that I advised you a while ago how to set up a firewall using Firestarter. Well, that's no longer necessary because Hardy introduces uFW, short for Uncomplicated Firewall. Despite the fact that uFW is a command-line only application, it really is as uncomplicated as the name sounds. To look at the documentation for uFW, enter the following:
man ufw

Now, the default policy will be OK for most people, so all you need to know about is enable and disable. If you want to start up your firewall, enter the following:
sudo ufw enable

Now, when you restart your system, uFW will be working. If you want to disable it, just enter the following:
sudo ufw disable

Couldn't be simpler!

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:
startx

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.

Saturday 12 April 2008

Window Managers

I've previously discussed the choice of desktop between Gnome, KDE and Xfce. You may recall that I mentioned that they aren't the only options. Well, I'm going to elaborate on this.

An alternative to using a full desktop such as Gnome or KDE is using a window manager. This is a program that controls the placement and appearance of windows on the display. For instance, take a look at an open application. You'll notice that, depending on what desktop you're using, you should have a panel along the top that includes several buttons to click on - minimise, maximise, close and so on. The window manager is responsible for drawing these.

Gnome, KDE and Xfce include their own window managers as part of the desktop to ensure a consistent look and feel - Gnome uses Metacity by default (although Compiz will usually be enabled instead in Ubuntu, so you can have the cool effects), KDE uses KWin, and Xfce uses Xfwm4.

There are a number of other window managers that you can use on a standalone basis, without Gnome, KDE or Xfce. These generally lack the visual appeal of something like Gnome or KDE (with the possible exception of Enlightenment), but achieve better performance, making them ideal for older, less powerful machines.

There are a number of these - Fluxbox, Openbox, aewm, the list goes on. If you're interested in looking, try searching for "window manager" in Adept or Synaptic - you'll find a load of them available from the Ubuntu repositories. If you decide to install one, a word of warning: you'll have to do the configuration yourself. It's not that hard, but not all of them have a graphical configuration tool, so you may need to edit a text file and do other work from the command line.

One very popular one, which I have installed alongside KDE, is IceWM. This window manager is laid out in a similar fashion to Windows, making it an ideal choice for those who are used to Windows. It's easy to theme it, too - you can find plenty of themes, some based on Windows XP or Vista, and others completely different. Check out this link for a very handy tutorial on how to set up IceWM (please note, this isn't terribly up to date). I'd recommend you install the icewm-themes and menu packages as well, and ignore the icemc package as that no longer seems to be in the repositories. Then, once you've logged out from your existing desktop, log back into IceWM from the login screen (you'll need to change the session type in this screen, there's a pulldown menu for it), then open a terminal and enter the following:
sudo update-menus

to update the menu in IceWM with your installed applications.

If your computer is a little sluggish with your current desktop and you're not too bothered about a fancy desktop, it's worth considering a switch to a window manager. It's a little more work than the default desktops, but may well be worth the tradeoff. For my money, IceWM is the easiest to use, but Fluxbox is also good, and Enlightenment is very promising (if E17 ever gets released!).

One of the reasons for IceWM's popularity is that it's easy to theme it. Here's an example - the FauxGlass theme from Box-Look.org:


I can't deny that IceWM isn't the prettiest desktop available, but it's fast and practical. If your computer is a bit old and slow, or you're just not happy with the speed of your Linux desktop, IceWM is a great alternative to Gnome or KDE.