Lightweight Debian: LXDE Desktop From Scratch
Lightweight Debian: LXDE Desktop From Scratch

			In my neck of the woods the Internet doesn’t get any faster, and my six year old dual-core AMD computer still holds up nicely. I don’t like Gnome 3 and I don’t care about Ubuntu’s run everywhere there is lots of memory vision. Linux is all about choice, and I do have plenty of them.
In this series of articles – part 2 here – I’ll take a look at Debian. Debian is one of the oldest Linux distributions still in active development. It is a popular distribution for personal use among software developers. It is also the most popular Linux web server platform. Debian has a great community and the amount of software packaged far exceeds any other Linux disto out there.
As usual I’ll keep an eye on memory. I’ll start with a basic server install, I’ll add X Window followed by LXDE desktop environment. What I am after is a picture like this:
openSUSE 12.3 Desktops Memory (MB)
The numbers represent the memory consumed by the system immediately after it was started and the user logged in.

Installation
Debian has three different branches you can chose from. Unstable has the latest and greatest software. The name is somehow unfortunate, I would say the software is more stable than what you can find in Fedora. Stable contains the latest officially released version of Debian. This is the production release. Testing branch contains packages that are in the queue to be accepted in the stable branch.
The testing branch (“wheezy”) will be released in the next few weeks. (Update 5/5/2013: Debian 7.0 “Wheezy” has just been released.) I will install it starting with a network install. The download page is here. I burn the iso image on a USB stick using dd command. To find out what device driver is handling the USB stick, I use hwinfo (apt-get install hwinfo):

# hwinfo --disk --short
disk:                                                           
  /dev/sda             HDT722525DLAT80
  /dev/sdb             WDC WD800JB-00FM
  /dev/sdc             Generic USB SD Reader
  /dev/sdd             Generic USB CF Reader
  /dev/sde             Generic USB SM Reader
  /dev/sdf             Generic USB MS Reader
  /dev/sdg             Lexar USB Flash Drive

# dd if=debian-testing-amd64-netinst.iso of=/dev/sdg


The installation was uneventful. At some point it offered me the following software choices: Debian desktop environment, Web server, Print server, SQL database, DNS server, File server, Mail server, SSH server, Laptop, and Standard system utilities. I’ve enabled only SSH server and Standard system utilities, and half an hour later I was booting my new system.
Server
Logging in, I check ps ax. The command doesn’t show anything unusual started by default:

# ps ax
...
 1850 ?        Ss     0:00 /sbin/rpcbind -w
 1881 ?        Ss     0:00 /sbin/rpc.statd
 1895 ?        Ss     0:00 /usr/sbin/rpc.idmapd
 2160 ?        Sl     0:00 /usr/sbin/rsyslogd -c5
 2210 ?        Ss     0:00 /usr/sbin/atd
 2233 ?        Ss     0:00 /usr/sbin/acpid
 2304 ?        Ss     0:00 /usr/sbin/cron
 2531 ?        Ss     0:00 /usr/sbin/sshd
 2561 ?        Ss     0:00 /usr/sbin/exim4 -bd -q30m
 2588 tty1     Ss     0:00 /bin/login --        
 2589 tty2     Ss+    0:00 /sbin/getty 38400 tty2
 2590 tty3     Ss+    0:00 /sbin/getty 38400 tty3
 2591 tty4     Ss+    0:00 /sbin/getty 38400 tty4
 2592 tty5     Ss+    0:00 /sbin/getty 38400 tty5
 2593 tty6     Ss+    0:00 /sbin/getty 38400 tty6
...


rpc* are the standard NFS tools used for remote access of shared file systems across the network. There is also a system logger (rsyslog) and the standard cron daemon. atd daemon allows you to run jobs queued for later execution, and acpid handles the power management of the system. There are 6 consoles handled by getty/login, you can switch between them using Alt-Fn keys. exim4 is your email agent.
As I’ve requested during installation, SSH server is started. By default it allows root login, and it needs some securing.
The server runs in 38MB of memory (I use free command to measure it). It is an excellent base to build a desktop.
X Window
Next step is to install the X Window environment. Debian uses apt-get to manage packages. There are other alternatives available, such as aptitude or synaptic. For now I will stick with apt-get.

# apt-get install xorg


Once installed, I start X Window environment with startx command. In an xterm I use free command to measure the memory: 55MB. Next step is to install LXDE.
LXDE
The command to install LXDE is as follows:

# apt-get install lxde


Unlike openSUSE, installing LXDE will change the boot level. Next reboot you will be directed to login into a display manager (lightdm). The desktop runs in this moment into 95MB of memory, slightly lower than openSUSE 12.3.
Debian wheezy LXDE desktop
Installing Programs
Debian has over 30,000 packages to chose form. 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 package_name. You can install the package using sudo apt-get install package_name command.
You will probably start with a web browser and mail client. In Debian the regular Mozilla programs are called Iceweasel and Icedove:

$ sudo apt-get install iceweasel icedove


You can continue with some text editors, graphic editors, and LibreOffice suite:

$ sudo apt-get install vim emacs gedit
$ sudo apt-get install gimp inkscape
$ sudo apt-get install libreoffice


For burning CDs and DVDs I use Brasero:

$ sudo apt-get install brasero


Brasero
Debian packages also lots of games.
For sound you can use either alsa or pulseaudio. My personal preference these days is alsa:

$ sudo apt-get install libasound2 alsa-utils alsa-oss alsa-tools-gui


For pulseaudio you also need to add your current user to pulse and pulse-access groups:

$ sudo apt-get install pulseaudio paprefs pulseaudio-module-jack \
pavucontrol paman alsa-tools-gui
$ sudo usermod -a -G pulse,pulse-access `whoami`


Reboot the computer for the sound system to kick in and install vlc, and yes, it does have mp3 support:

$ sudo apt-get install vlc libavcodec-extra-53


You should not be surprised by the presence of mp3/mp4 support in Debian. The purpose of any distribution is to distribute software, and Debian excels doing that. Debian team packages everything from mp3 and dvd support, to wireless and video card drivers. There is no need to access unofficial software repositories.
For example this is how you would install Adobe flash player. Start by adding contrib non-free (still official Debian repos) in your /etc/apt/sources.list file:

deb http://ftp.us.debian.org/debian/ wheezy main contrib non-free


and install the flash player:

# apt-get update
# apt-get install flashplugin-nonfree


Flash player
Security
Security is one of the most important Debian features. Software packages are tested thoroughly before being included in a Debian stable release. If security problems are discovered and fixed, new versions are released. Users are advised to update the software packages installed periodically. It is a simple operation, and if you do it once a week all should be fine. The commands are as follows:

$ sudo apt-get update
$ sudo apt-get upgrade


Coming up in Debian 9 (Stretch) is Firejail. a security sandbox similar to the sandbox currently running internally in Google Chrome. Originally intended to secure Firefox, the sandbox supports by default a large number of desktop programs, including proprietary programs such as Skype, Steam and Spotify.
If you are running Sid or testing, install it as “sudo apt-get install firejail”. For Jessie or Wheezy, download the latest deb package from here and “sudo dpkg -i firejail_X.Y_1_amd64.deb”. To sandbox an application just prefix the name of your application with “firejail”:

$ firejail firefox
$ firejail pidgin


Conclusion
While Debian isn’t exactly the friendliest distribution ever, it’s definitely the best choice to build a lightweight Linux desktop. It is a popular distribution for software development, with lots of support behind it. You might find it worth looking at running on your own system. And if something goes wrong during setup, you can always ask a question on the mailing list, or revert to a distro you know better.
To put things into perspective, I’ve also installed Debian Gnome 3 on this machine. Debian “wheezy” packages Gnome version 3.4. To my surprise, it loaded in 215MB of memory! Under Debian even Gnome 3 looks lean and mean. A better comparison would be Ubuntu 13.4 Unity loading in 425MB or Fedora 18 LXDE spin loading in 220MB. A Gnome 3 Debian desktop requires less memory than a Fedora LXDE desktop!
Here are the idle memory consumption numbers for several system configurations in Debian “wheezy”:
Debian “wheezy” Memory (MB)
Also for comparison, I attach the numbers for Ubuntu 13.04:
Ubuntu 13.04 Memory (MB)
In part 2 of this series of articles I continue with several enhancements to the current setup. I start by setting icons on the desktop, configuring a password-less bootup and password-less partition mount in file manager, I replace Openbox window manager with Mutter giving the desktop a very polished modern look, I configure desktop sharing using VNC, and I take a look at Debian Backports system and how to install newer versions of some very popular Linux programs.
Related Posts

Lightweight Debian: LXDE Desktop From Scratch Part 2
Light Debian Linux for Family and Friends
Lightweight openSUSE: LXDE Desktop From Scratch
Fedora 19 LXDE Spin Cleanup


			
								