Lightweight Ubuntu: LXDE Desktop from Scratch

The overall Linux performance depends on the amount of system resources your desktop environment is using. Lightweight desktop environments such as LXDE consume less resources, and are ideal for older computers that can’t keep up with heavier Linux desktop environments.

This article describes how to build an Ubuntu-based LXDE system piece by piece. It is a longer process but the resulting system is as small and light as it possibly gets. I start by installing a regular Ubuntu 14.10 server system and add desktop functionality on top of it in small steps.

Server Install

The installation of Ubuntu Server is actually very straight forward. You first need to download the ISO image from the Ubuntu Website and burn it to a CD. You can also copy the ISO image to a USB flash drive.

Boot the computer from CD or USB stick and go trough the install menus one by one.

Ubuntu Server 14.10 install

Ubuntu Server 14.10 install

In my builds I tend to keep things as simple as possible. I am not exactly interested in the resident operating system and set the entire hard disk for the new one.

Ubuntu Server 14.10 install

Ubuntu Server 14.10 install

Also, I will do my software updates manually, there is no need to have another daemon loaded in memory only for this purpose.

Ubuntu Server 14.10 install

Ubuntu Server 14.10 install

Finally, I am presented with a menu where I can choose some services started automatically at boot time. I leave them out for now, as I can add them later easily if I ever need them:

Ubuntu Server 14.10 install

Ubuntu Server 14.10 install

First boot into the new system I check the RAM memory usage:

netblue@ubuntu:~$ free -h
             total       used       free     shared    buffers     cached
Mem:          489M       144M       344M       352K       8.8M        95M
-/+ buffers/cache:        40M       449M
Swap:         509M         0B       509M

The number to look for is on -/+ buffers/cache line, 40MB in this example. It is a good number, comparable with what you would get on a regular Debian system – my Debian Wheezy server runs in 38MB.

LXDE

The next step is to install LXDE desktop environment. I use apt-get command directly from my console:

netblue@ubuntu:~$ sudo apt-get install lxde

I reboot the computer and I am ready to login into my new desktop:

LXDE login screen

LXDE login screen

After login, I open a terminal and check again the memory:

netblue@ubuntu:~$ free -h
             total       used       free     shared    buffers     cached
Mem:          489M       251M       237M       1.1M        22M       123M
-/+ buffers/cache:       105M       384M
Swap:         509M         0B       509M

105MB is another excellent number, close to the 95MB I am getting on my Debian Wheezy machine. Assuming this was an old computer with 500MB RAM, I would have almost 400MB to run my applications. Actually I am doing this test in a 500MB VirtualBox VM, everyting I’ve tested during this install works fast and smooth.

Sound and Video

No system should be called a desktop without a proper sound and video application stack. Installing them on Ubuntu is easy, regardless what desktop environment you are using. There is full support for mp3, mp4, Flash, hardware acceleration and anything else you might imagine.

I start by installing ALSA, one of the most advanced kernel level audio stacks available in Linux. I also install VideoLAN Client (VLC) my favorite audio/video player:

netblue@ubuntu:~$ sudo apt-get install libasound2 alsa-utils alsa-oss alsa-tools-gui vlc libavcodec-extra

By default the sound is muted, I will use alsamixer to unmute it and set the volume levels.

netblue@ubuntu:~$ alsamixer

Setting volume levels in  ALSA mixer

Setting volume levels in ALSA mixer

Internet

For Internet browsing you can choose between Firefox (sudo apt-get install firefox), Chromium (sudo apt-get install chromium-browser) and Midory (sudo apt-get install midori). Firefox and Chromium need at least 200MB of RAM to run, while Midory will do the same thing in about 70MB. Flash video is enabled by default, you don’t need to install a separate package. Funny, youtube seems to think you need a plugin installed for it, even if your video is already running:

Firefox running Flash directly, without the need of a plugin.

Firefox running Flash directly, without the need of a plugin.

From here I go and install Thunderbird mail client (sudo apt-get install thunderbird), Pidgin instant messaging application (sudo apt-get install pidgin), and Transmission BitTorrent client (sudo apt-get install transmission).

I usually set my browsers to run in a security sandbox such as Firejail. This reduces the risk of security breaches by restricting the running environment of the application using Linux namespaces and seccomp 2. I install the .deb package from the download page (sudo dpkg -i firejail_0.9.18_1_amd64.deb) and start my browser:

netblue@ubuntu:~$ firejail firefox
netblue@ubuntu:~$ firejail chromium-browser
netblue@ubuntu:~$ firejail midori

This takes care of my Internet stack, time to load some more desktop applications.

Installing programs

Ubuntu has over 30,000 packages to chose form. Most of them are coming from Debian Sid with little or no modifications. To search for packages use apt-cache search name command. Once a suitable package is located, you can find more about it using apt-cache show name.

netblue@ubuntu:~$ apt-cache search  games | less
netblue@ubuntu:~$ apt-cache show assaultcube 

You can install the package using sudo apt-get install name command.

netblue@ubuntu:~$ apt-cache install assaultcube 
Ubuntu 14.10 version of AssaultCube

Ubuntu 14.10 version of AssaultCube

These are some of the programs I use:

  • Text editors: sudo apt-get install vim emacs gedit
  • Graphic editors: sudo apt-get install gimp inkscape
  • Office suite: sudo apt-get install libreoffice

For burning CDs and DVDs I use Brasero:

netblue@ubuntu:~$ sudo apt-get install brasero
Brasero

Brasero

Conclusion

I guess if you install your Ubuntu desktop the same way you would install a Debian desktop, what you end up is close to a Debian Sid aged and stabilized for a few short months. The differences in memory footprint are negligible, the system is definitely usable on older computers. You could also use such a system as a preview of what is coming in the next Debian stable release.

It is worth trying your own desktop build. Lubuntu, the official LXDE version of Ubuntu, starts in 180MB of RAM. This is way bigger than the 105MB you could get if you build your own. And if something goes wrong, you can always revert to a more traditional Lubuntu desktop with just a simple apt-get command:

netblue@ubuntu:~$ sudo apt-get install lubuntu-desktop

Enjoy your Linux desktop!

Related Posts

Advertisements

One thought on “Lightweight Ubuntu: LXDE Desktop from Scratch

  1. Pingback: LXDE from scratch (Ubuntu) | 0ddn1x: tricks with *nix

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s