Build a lightweight graphical system in Ubuntu

I am feeling a bit nostalgic these days, and so I think I will do something that I haven’t done in a really long time: I’m going to build up a graphical system in Ubuntu. It’s not anything terrifically difficult actually — there is almost no configuration to do, and there’s definitely no compiling.

Why Ubuntu? Well mostly because I took a chunk out of Ubuntu a few days ago when I complained about the weight of the Gnome desktop in Karmic, and I’m still feeling a little guilty about that. And also because I still see random notes here and there about how the button location in Lucid is a dealbreaker 🙄 and it’s clear that a lot of people haven’t cued in on how simple (dreadfully simple) it is to get your own system built in Ubuntu.

Just to be daring, I’m going to start with a command-line system installed from the Lucid beta alternative ISO. As far as I know there has never been any way to install a CLI-only Ubuntu system from the desktop (or “live”) CD, which means if you don’t have one of the alternate versions or usually just ignore it … well, the time is ripe.

There’s a little trick to installing the command-line only system, and this is where it’s hiding.

 

You pick the CLI version from the boot menu when you start up the CD. Select your language, your keymap if necessary, then press F4 for the installation modes. From that menu, pick the command-line system option. And then highlight “Install Ubuntu” and press return.

I leave you to decide how to partition or arrange your machine; if you’re on an older computer — and by that I mean something pre-2001 — I recommend changing the filesystem to ext2 and selecting the “noatime” option. (If you are on a very, very old machine — and by that I mean pre-1998 — remember that your hard drive size may be an issue for your BIOS; if you have an oversized, newer drive in there you better set up a dedicated /boot partition.)

Expect your command-line system to take up about 600Mb, if df is to be believed. After your system is in place and your network is running and your keyboard is set up, it’s time to get serious. This is probably what your first boot will look like, once you’ve updated from the beta ISO.

Pretty boring. Let’s change that. The first thing we need is the graphical system itself, the software that interprets what you’re doing with the mouse and keyboard and whatnot, and translates it for Linux. Type sudo aptitude install xorg and you’ll see what that will require.

There’s quite a bit there to install, and while it’s possible to carve some of that out, let’s just go ahead and bring it all in. Once it is downloaded you’ll need to wait while aptitude installs and configures it. Once of the nice things about Ubuntu is that those steps are taken care of, and you don’t need to do a thing. Here’s what it will probably look like, when it’s done.

Believe it or not, most of the heavy lifting is finished. You can actually start a graphical system here, but it’s nothing particularly spectacular — in fact, all you get is terminal emulator, with nothing else behind it. Boring.

Let’s give it something to chew on: A file manager. Try this one, and see if you like it: sudo aptitude install -y emelfm2.

Notice that I tacked on a -y to the installation command: I did that because I didn’t want aptitude to ask my permission again. Now let’s start the graphical desktop and see what trouble we can get into: startx

There’s the terminal emulator I mentioned. Not very exciting. If I type emelfm2 and press return, the file manager starts up, and will probably look like this.

Nice, but not particularly genius. And we have no window borders. How can we move things around if we want? Or close them? Or maximize them? We need some way to manage our windows.

Okay, here’s a window manager for you: sudo aptitude install -y openbox.

And if we startx again. …

Ooh, the background has changed color. And there’s right-click menu now. And boxes have frames and controls on them.

If I start emelfm2 now, by typing the command in the emulator window, it’s much more comfortable.

And that’s the way things work, basically. If you add obconf and obmenu to your desktop here, you can more or less coordinate your entire graphical experience without much work at the command-line: sudo aptitude install -y obconf obmenu — and yes, you can stack applications to install like that, when you use aptitude.

Add items to your right-click menu by editing the entries in ObMenu, and then using the Reconfigure command in the right-click menu to update it while it runs. Simple as pie.

But now we have a couple other issues that need work: Proper wallpaper, and we must do something about that hideous interface. It looks like a reject from Windows 98. Let’s try gtk-chtheme and gtk2-engines: sudo aptitude install -y gtk-chtheme gtk2-engines. Now if I start gtk-chtheme, I can switch styles, fonts and appearances.

For wallpaper there are a lot of solutions available to you, but my preference is feh, which can double as an image viewer. sudo aptitude install -y feh. feh sets the wallpaper at the command line, with feh --bg-scale wallpaper-name.jpg.

You can get the same results again, at each startup, by opening a little file in your home directory called .xinitrc and adding this line to it.

eval `cat .fehbg` &
exec openbox-session

That’ll do the trick. There are other ways to set the wallpaper or even just set a color for it; poke around and you’ll probably see dozens more.

So what else can you add to your desktop? How about everyone’s favorite browser. Of course, if you do that — sudo aptitude install -y firefox — you inherit a huge vat of dependencies, including a lot of Gnome crud. You can avoid that in turn by installing it without the recommended packages, kind of like this, but even that is more than is necessary.

I would recommend downloading the precompiled Linux binary and decompressing it into your home directory. You can edit your Openbox menu to start it directly, and spare yourself the Gordian knot of Ubuntu’s generic Gnomified Firefox. Start here, if that sounds like something you would prefer. P.S., you’ll need the libasound2 and libdbus-glib-1-2 libraries from the repositories to use it — sudo aptitude install -y libasound2 libdbus-glib-1-2.

I have some other recommendations for software in a graphical system, but you should be experimenting on your own and trying out as many different ones as you can. You have the general idea now — install, add to your right-click menu, and repeat. You have an immense number of choices available to you, and don’t forget things like automounting daemons, audio suites, image managers, e-mail clients, games and video players.

And like I said, the real benefit in doing this yourself is that you have the opportunity to avoid a lot of the weight that comes with Ubuntu in its default forms. Exercise your freedom, build your system your way, and you’ll gain a sense of pride and satisfaction at the same time. 😀

19 thoughts on “Build a lightweight graphical system in Ubuntu

  1. secdroid

    Thank you for a great tutorial.

    I’ve been downsizing from Ubuntu/Gnome to (currently) Debian/LXDE, with a goal to go to Arch/Openbox. Your post demystified a good part of Openbox config, as well as pointing to lighter graphical software options.

    I enjoy the increased control of my desktop environment almost as much as the increased speed. (Celeron 450 single core 2.2 GHz, integrated Intel graphics runs great on Debian/LXDE.)

    Reply
    1. K.Mandla Post author

      You’re welcome. I sometimes take for granted the things I have been doing for years now, and thought it might be helpful to revisit a few of them. Cheers! 🙂

      Reply
  2. Morten

    Would it be possible to start with a full blown system, and just by removing unused daemons – ending up with a system that’s as lean as what you are describing in memory, although with a LOT of stuff dormant on the harddisk?

    Reply
    1. K.Mandla Post author

      Sort of, but tearing things out tends to become messy, whereas building up from scratch usually works without a hitch. That isn’t anything unique to Ubuntu, more it’s the nature of Linux, in my experience.

      Tear out the wrong stuff or tear out some dependency that was hooked into something else, and you’re left with a lot of rough edges and so forth. Which isn’t to say that it can’t be done, only that it seems counterintuitive if your goal is a fast, light, clean system.

      This comes to mind too … https://kmandla.wordpress.com/2009/01/28/build-up-dont-tear-down/

      Reply
  3. Jose Catre-Vandis

    @ Morten

    That’s a difficult and messy way to do it, can be done though, seek out the specific howto thread about this on ubuntuforums.

    @ KMandla

    Why gtkthemes over openbox-themes? Better, different, more options?

    Nice approachable howto, will use it next time I go commando 🙂

    Reply
    1. K.Mandla Post author

      To be honest I forgot about openbox-themes. Installing only openbox and obconf brings in a mess of themes for Openbox. There are a lot of new ones I hadn’t seen before, and installing gtk2-engines seems to install some that are named the same as the Openbox themes.

      For example in those screenshots, I think the Openbox theme is simple-slate, and there’s a matching GTK theme called simple-slate. Rather convenient, if you’re not a rabid desktop themer. 😉

      As far as the autostart.sh file, I rarely need it. I sometimes use it to set the backdrop color, if I don’t want wallpaper there. But last time I looked it relied on a couple of other programs (esetroot? hsetroot? I forget) which I don’t particularly care for. feh is just quicker and has a second function as an image viewer. 😉

      Reply
  4. John Bohlke

    You might want to add install alsa-base and alsa-utils. Otherwise you don’t have any sound. Also, unless they finally changed this, you might want to add running alsamixer and un-muting the master and pcm outputs.

    Reply
    1. K.Mandla Post author

      Good point. I mentally had that lumped in with audio players, but it is worth mentioning that alsa-utils is probably useful, and that the channels are still muted at startup. Thanks. 😉

      Reply
  5. Pingback: Build a lighter Gnome in Ubuntu « Motho ke motho ka botho

  6. Pingback: Its beauty is in its potential « Motho ke motho ka botho

  7. Walter

    Hello there,
    wonderful tutorial. I loved to go through these steps and “build” my first own system (well, not exactly “mine” I guess, but closest that had ever been). Indeed, very easy.
    I have a couple of questions though, if I can ask:
    1) Installing openbox does not bring any “bar” (a-la-gnome) nor docking. It would be a nice add on for me so that I could make some menus for quick-launching apps and to go through the open apps. What do you suggest (other than installing gnome-core I guess)
    2) About the docking: I tried to install awn and cairo. I managed to install ‘some’ packages, but I really have no way to know which package do I need to install to get an app up and running (for example, for openbox you indicated to install “openbox”, “obconf” and “obmenu”).
    3) Say I don’t like openbox: should I uninstall it before installing gnome-core?
    4) Last but not least: in most of your previous posts you showed us console setups with “video against the framebuffer”: if I was to try and do that, what should I do?

    Regardless of the answers, thank you again so much for the tutorial.
    Walter

    Reply
    1. secdroid

      Walter, may I suggest something else before you give up on Openbox?

      Lightweight X11 Desktop Environment (LXDE) is based on Openbox but has the sort of built-in features that make it instantly understandable to Gnome, KDE, and XFCE users. It is a great way to get started with Openbox and you can easily add and remove features at will. (LXDE is modular, allowing mix-and-match application selection, should you desire.)

      The main LXDE wiki page has (at bottom) “How to install LXDE with different Linux distributions” that covers the most popular distros. See http://wiki.lxde.org/en/Main_Page

      Antother helpful wiki page (even if you use another distro) is http://wiki.archlinux.org/index.php/LXDE

      A good LXDE overview article can be found at http://itmanagement.earthweb.com/osrc/article.php/3866591/LXDE-Smaller-Faster-than-KDE-or-GNOME.htm

      I use it and like it. It has allowed me to get comfortable with Openbox and start to change out some of the other LXDE apps to give me a more personalized Openbox experience.

      Reply
      1. Walter

        Secdroid,
        no worries: I have not given up on openbox yet.
        Thing is: I am quite demanding of my desktop when I use it: normally I have many apps open at the same time (Thunderbird, Firefox, Calc, Write, Pidgin, likely Rythmbox/VLC, a torrent client and maybe even Gimp): I rely on ‘something’ that lets me switch apps quickly and also lets me kepe track of what’s open and where, so the ‘plain vanilla’ openbox did not cut it for me, which is why I looked into docks.
        LXDE is certainly an option: I’ll have a look at it.
        I’m no Linux expert, so I’ll probably need something as simple as the guide in this post to get it to work 🙂
        Thanks again for the suggestion.

        Reply
  8. Nythain

    How well does this install handle sound devices and hal related things like display settings? I used to build my ubuntu systems from cli but as the releases keep on releasing, i find it trickier and trickier to get a full functional lightweight desktop 😦

    Reply
  9. Pingback: Bloat is in the eye of the beholder « Motho ke motho ka botho

  10. davide

    Sorry for the previous post, the firs question mark was supposed to be an exclamation mark!

    Reply

Leave a comment