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:
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.
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
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
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”:
Also for comparison, I attach the numbers for Ubuntu 13.04:
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
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??
Thanks! I think you would need to set is as a server (without xorg), and enable SSH on the machine, without vnc.
Pingback: Lightweight Debian: LXDE Desktop From Scratch | Hallow Demon
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. :^)
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.
I’ll try it, thanks!
Pingback: Links 5/5/2013: Chromebooks Growth, Further Catchup | Techrights
Thanks for the description and the measures.
You’re welcome!
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
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.
Debian Wheezy 64-bit with GNOME 3.4 Fallback runs with 144MB of RAM in my Virtual Machine (VirtualBox)
Pingback: Minimal Debian with LXDE | 0ddn1x: tricks with *nix
i would prefer xfce over lxde, somehow when i use lxde, i cant tweak much.
To install xfce on debian is quite simple
# apt-get install xfce4 xfce4-goodies thunar-archive-plugin
there are also few more gui for debian out there, i have not tried them all yet http://namhuy.net/1085/install-gui-on-debian-7-wheezy.html
my next gui is properly kde since i have never used it, gnome is just too slow
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.
Yes, sometimes I am doing it the same way. I would start with a full Ubuntu Unity, bring in LXDE and scrap everything else. I have an article here: https://l3net.wordpress.com/2013/02/08/ubuntu-cleanup/ . And I agree, web browsers are memory hogs.
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
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
“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
I doubt it.
71.7M – 15M (gnome-screeshot program) = 56.7M
http://imgur.com/h8IFkqh
I have no idea how you measure it. Boot up, login, and in an xterm run “free -h”.
Another screenshot taken with scrot http://imgur.com/KifVHkT
I like Debian. Is my second favorite just after Arch Linux.
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.
See the video and comments, Debian 7.4 on iMac G3: http://www.youtube.com/watch?v=BnaUvlSMZ2U
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!
Thank you for your comment!
The only thing I ever found missing in Debian is libdvdcss library for decrypting DVDs. I went for the semi-official repository described here:
https://wiki.debian.org/CDDVD#DVD
Usually i remove or disable exim also remove nfs-common and relatet rpc * daemons
Yes, I usually scrap them also.
Also you can skip or disable pulseaudio (vlc works without it) , for login manager i use slim
I’ll have to try it out! The only reason I put in pulseaudio was vlc, … or maybe flash plugin for firefox…
What about installing only lxde-core along wiz lightdm, would zat decrease memory footprint….
Here what I wanted is to have a virtualbox debian server to z minimal….only to run LAMP, iceweasel (still big for me). Mostly I do things via ssh-server but sometimes I needed to login via GUI. Apart frm zis no bells and whistles are needed.
Any suggestion on zis.
You’ll have to try it out, you’ll probably get a lower memory footprint. I also use to keep a light GUI on some of my servers.
I’m not sure measuring RAM usage after boot really makes sense. Some OS might cache as much stuff as possible into RAM while there is some available, so they’ll *look* heavy, but are able to drop least useful things when applications start requesting RAM (for example Windows does this as far as I know). Having a lot of free RAM doesn’t necessarily mean you have a better system ; maybe it’s just waiting for you to do anything to fill your RAM with crap (and stutter each time it has to load new stuff).
Nice tutorial though, and even if they are not actual proof of lightweightness/usability, your measures are still good hints 🙂 Thanks.
Thanks for your comment. There is no official definition of lightweightness. You are correct, the memory usage is just a hint – maybe the only hint.
Pingback: pc no gui runlevel 1 | berwien
Thank you!
You’re welcome!
Thanks. Very usefull
You’re welcome
Afaik, the recent Debian releases consume more memory, on Debain 8 AMD64 it was around ~80MB on a 2GB machine without any GUI. FreeBSD on the same machine consumed less than 20MB..
Pingback: Leituras 2Agosto2017 – daily digest news