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)

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

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

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

Flash player

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. The article can be found here.

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)

Debian “wheezy” Memory (MB)

Also for comparison, I attach the numbers for Ubuntu 13.04:

Ubuntu 13.04 Memory (MB)

Ubuntu 13.04 Memory (MB)

Related Posts

About these ads

31 thoughts on “Lightweight Debian: LXDE Desktop From Scratch

  1. rasishi

    Great article..!!! like to know if you can write an article on setting up a headless file server and login into it with vnc from off of any machine on the network??

    Reply
  2. Pingback: Lightweight Debian: LXDE Desktop From Scratch | Hallow Demon

  3. Bob Robertson

    Since you’re using the command line for apt-get anyway, I suggest you give “dselect” a try.

    It’s an apt front end that has been around almost as long as apt itself, and it makes searching for packages and resolving dependencies very simple.

    Nice review. No matter how many times I see people claim that Debian is “everything and the kitchen sink”, I (and you) know that Debian doesn’t install the kitchen sink unless you tell it to. :^)

    Reply
    1. Bob Robertson

      One thing about dselect, since nothing is perfect.

      You have to update the list of packages available to dselect with the “update” option even if you have issued an “apt-get update” command earlier. It seems that dselect uses its own buffer of available packages rather than just using apt’s.

      Otherwise, it’s just an apt front-end, and uses all the same files and repositories as apt is already using.

      So start dselect, choose “update” then “select” and you get the list of available packages.

      Reply
  4. Pingback: Links 5/5/2013: Chromebooks Growth, Further Catchup | Techrights

  5. Mukhthar Ahmed

    Hello,

    startx gives error : Fatal server error:
    xf86OpenConsole: Cannot open /dev/tty0 (No such file or directory)

    while the /dev/tty0 exists.

    Any suggestions on fixing this FYI the system is debian squeeze with 256mb ram

    Reply
    1. netblue30 Post author

      Something went wrong during installation. /dev/tty0 device should be present after install. It has nothing to do with startx, it should be there even on a regular server install.

      Reply
  6. Pingback: Minimal Debian with LXDE | 0ddn1x: tricks with *nix

  7. Goren

    It is amazing what you can get away with when using debian. I had an old machine (my first machine back in 1997) a 233mhz AMD K6 with 96 megs of ram. I did sort of the opposite of what you did though. I installed the full desktop support with gnome. Then disabled gnome and then installed LXDE. I like a lot of the GUI bits and pieces, etc gnome installs I just don’t want all that junk running at the same time. I don’t mind wasting disk space since the fact the system’s BIOS can’t see a 250GB IDE disk, doesn’t mean the linux kernel booted off the original 6GB drive can’t. I go through and shutdown all the useless daemons, etc. Booting to lightdm (wheezy installed) it uses 88mb of ram with nothing in swap yet. Logging in a user account bumps it up to 92 used (2 of that in swap since the video driver robs 6mb of the system ram). My main problem is the web browsers, they are such resource hogs. In squeeze I would use Kazehakase on my low spec boxes, but its not available in wheezy.

    Reply
  8. LucaM

    Hi there! First of all thanks for your guide, I would like to use it to build virtual machines to run boinc over night time.
    I just need an information, after lxde installation how can I set automatic login?
    I’m using latest 7.4 version.

    Thanks

    Reply
    1. netblue30 Post author

      You’re welcome!

      To configure automatic login open /etc/lightdm/lightdm.conf in a text editor and add the following line in [SeatDefaults] section:

      autologin-user=your-user-name

      Reply
  9. linuxer

    “it’s definitely the best choice to build a lightweight Linux desktop.”

    WRONG!!!
    The best choice by far is Arch Linux.
    A basic LXDE setup under 64MB of RAM

    Reply
      1. netblue30 Post author

        Also, keep in mind I’m doing a standard Debian/LXDE install with all default processes running, without any kind of tinkering. If on my 90MB Debian box I start removing default processes, I’ll get below 70MB very fast.

        Anyway, thank you for your comments.

      2. icarolongo

        See the video and comments, Debian 7.4 on iMac G3: http://www.youtube.com/watch?v=BnaUvlSMZ2U

        Jacob Dorne
        Thanks for the tip! I’ll give LXDE a try. Xfce always seems more feature-packed and stable than LXDE, such as desktop icon arrangement. But thats probably why it has a larger footprint.
        Although after a cold boot up into Xfce, I am only using 70MB out of 512MB of RAM. The wonders of a minimal install.
        What web browser do you recommend? I like Epiphany but it is screwed on PPC Debian (no toolbar icons and half buttons missing etc).\Midori works but isn’t the best in terms of UI.

        Will McDade
        +Jacob Dorne I have an old Pentium 3 PC (866MHz, 256MB RAM) and it runs great with Debian 7.4 LXDE. I used Iceweasel (Debian’s unbranded Firefox) and it ran well! I could run LXDE on a cold boot using about 85MB RAM with Iceweasel open. Openbox used 40MB RAM on a cold boot but that was with no panels or anything. I have yet to play with Openbox :) I am aiming to set the PC up as a file server/torrent box so I can just send stuff to it via SSH.

  10. Chad McCullough

    Sorry to be commenting a bit late. This is yet another great tutorial. Thanks!

    I’ve been using and developing on Linux for more than 20 years. For a while, I used to love distributions that included all the “latest and greatest” software. My feelings regarding that have changed, a little, over the past few years. I’m actually quite happy running a distribution like Debian Stable that include software that might be a bit out of date compared to other distributions. Sure, I may not have the latest and greatest to play around with but everything runs rock solid, for sure. Do you have any recommendations for repositories that might be nice to add to Wheezy to get a few updated apps? Like I mentioned, I’m very happy running apps that are a bit behind in updates but I do have a few that I use daily and the newer versions contain some updates that are very nice.

    Thanks, again, for a great article!

    Reply

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