Pages

November 25, 2013

Debian: From CLI to GUI

Debian's latest stable release has been out since last May 2013 and I'm very eager to make it the main OS on my computer.

I have used Arch Linux in the past and I liked its K.I.S.S. approach where everything is built from the ground up. But since I decided to limit my Linux explorations to Debian-based distros for now, Arch will have to wait. That's where I got the idea to do a minimal install of Debian and build it up from there.

Disclaimer: I am NOT an expert. This is me chronicling my experience for future reference. I am sharing it to the Internets in case someone else finds this sort of thing worth their while.

Assumptions

If you want to follow along, here are some quick assumptions.

  • You have some experience with Linux.
  • You are NOT afraid of the command line and know your way around it.
  • What may work for me may not work for you hardware-wise. Google (or DuckDuckGo) is your friend.

Preparations

Installation Media

Download the installer ISO file from the Debian website and write it to a CD, DVD or USB. I prefer using a USB.

    $ sudo dd if=/path/to/debian_installer.ISO of=/dev/sdb bs=4M; sync

Note that the value after of= varies depending on your setup. ALWAYS MAKE SURE THE TARGET IS THE ONE DESIRED. dd could bring you all sorts of hurt when not used properly!

Create Partitions

I prefer to partition my installation drive before attempting an install. I use a live Linux session and for this I went with Lubuntu 13.10. Use a distro you're comfortable with.

Boot into the live session then open a terminal. An Internet connection is needed at this point; connect to one accordingly.

    $ sudo apt-get install gdisk
    $ sudo gdisk /dev/sda

I use gdisk tool to do partitioning as I opted to go with a GPT setup. Here's a good walkthrough of the tool. I suggest spending time and reading about gdisk.

Format Partitions

AFAIK, gdisk doesn't have a formatter integrated into it. So format the partitions accordingly.

    $ sudo mkfs.vfat -F 32 /dev/sda1
    $ sudo mkswap /dev/sda2
    $ sudo swapon /dev/sda2
    $ sudo mkfs.ntfs /dev/sda3
    $ sudo mkfs.ext4 /dev/sda4

The first command formats partition 1 to FAT32, to be used for the EFI System Partition. The second and third commands prepares the swap partition (partition 2). The fourth command formats partition 3 to NTFS, which I will use as the partition to hold data. And finally, the last command formats the partition 4 to an ext4 filesystem where I will install the Linux OS.

Thanks to ArchWiki, where I based my filesystem creation off of.

That's done, let the fun begin! It's time to install Debian.

Base Install

Reboot the computer with the Debian netinstall CD/DVD/USB to begin installation.

Non-free Firmware Drivers

I am still using a USB WiFi dongle from way back as my primary connection to the Internet and the Debian 7.2 installer is good enough to identify the driver I need to get the dongle up and running during installation. It actually suggests that I put those drivers into a removable media and insert that into the computer so the installer can look for it and use it. I figured out that these drivers are in the firmware-linux-nonfree package. I downloaded the .tar.gz file and extracted it to another USB thumb drive.

But no matter how many times I clicked on "Yes" » "Continue", it just couldn't find the drivers.

<RANT>
I get what the DFSG is trying to do. But in actual, available hardware that conforms to these guidelines are hard to find. These hardwares most likely don't have F/OSS drivers. It would have saved some time if these non-free hardware drivers were incorporated to the installation media by default.
</RANT>

Luckily Debian's wiki entry on Firmware pointed me to the unofficial netinstall image that has these non-free firmware. I used this to proceed with the installation.

Software Selection

The base install is straightforward. Follow the on-screen instructions accordingly. Upon the "Software Selection" portion, I selected to install only the following:

    [*] SSH Server
    [*] Standard system utilities

Wait for the installation to finish and proceed to the first boot.

First Boot

The first boot will drop you off into a command-line interface (CLI). Login as the created user and become su.

Network Connection

This is the tricky part and may vary depending on your setup. If you are on wired connection, I assume connection is done automatically. I, however, needed to setup a wireless connection manually. This portion may need a lot of work. Searching the Internet is the best resource.

Configure Repositories

The installed system is Debian "stable". Stable is stable, but means that software is a bit outdated. There are 2 things that can be done about this. Either upgrade to "testing" or add the "wheezy-backports" to the repositories. I chose to go with the latter. Edit the sources.list file.

    # vi /etc/apt/sources.list

I have the ff. entries:

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

    deb http://security.debian.org/ wheezy/updates main non-free contrib
    deb-src http://security.debian.org/ wheezy/updates main non-free contrib

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

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

Save the file, close it and update the repositories. You may also do an upgrade if you went with "testing".

    # apt-get update
    # apt-get dist-upgrade

(Optional) Upgrade Kernel

Based on my experience, the 3.2.0-4 kernel of Debian Wheezy causes a lot of problems for me. Sometimes the system boots up, other times it goes to a kernel panic. I searched the Internet for Linux on an AMD system and I came across this post from Phoronix.

The short story to running AMD A-Series Trinity APUs on Linux is that it works. If you are running Ubuntu 12.10 or distributions of similar state (ideally the Linux 3.4 kernel or later and other recent components), you should be in good shape.

I am using the same CPU. With wheezy-backports, I installed the 3.10-0.bpo.3-amd64 kernel.

    # apt-get install -t wheezy-backports linux-image-amd64

I don't know if it will make a difference, only time will tell. But I can say that during boot-up, the "hda_codec: signal out of range" warning has disappeared since upgrading the kernel. Perhaps that's a good sign?

Essential Elements

Done with the base install, it's time to get a graphical user interface (GUI) running and install additional essential elements.

X Window System

Xorg is the default X Window System for Debian. It provides the backbone for the GUI. If you'd like to learn more about it, you can start here.

    # apt-get install xorg

Desktop Environment

Desktop environments comes in different shades and sizes. It's really about personal preference (Debian Wheezy defaults to GNOME) so it's up to you what you like to use. I believe most desktop environments have binaries in Debian. Here's a gallery from Wikipedia, it may help you decide which to use. As for me, I've decided to use LXDE.

    # apt-get install lxde-core

Note that I'm only installing the core LXDE package. It's because previously, when I installed `lxde` package and rebooted into X, I was surprised to see that the desktop environment was GNOME! Even choosing LXDE from the display manager sets the DE to GNOME. Again, this may work differently for you.

Display Manager

Since I only installed the lxde-core, a display manager wasn't installed along with it. Based on my limited knowledge, this handles the login and choosing the desktop environment, if more than one is installed, during an X session. For my setup, I chose LightDM.

    # apt-get install lightdm

Network Management

Again, as I only installed lxde-core, then network-manager (and it's GUI front-ends) weren't installed. I chose to go with Wicd as my GUI network manager. Again, use what you prefer.

    # apt-get install wicd

Sound

As with desktop environments, display managers or network management tools, sound in Linux also offers a myriad of choices. I don't totally grasp the concept of how sound is made to work in Linux, but this here article explaining how Linux audio works is a great read for any Linux user. As for me, I chose to go with PulseAudio.

    # apt-get install pulseaudio paprefs pavucontrol paman
    # usermod -a -G pulse,pulse-access user

The first command installs PulseAudio, PulseAudio Preferences, PulseAudio Volume Control and PulseAudio Manager. The second command adds user user to the groups pulse and pulse-access.

Now it's time for a reboot.

Moving Forward

If all went well, a graphical login prompt should greet you. And after password authentication, you're taken to the desktop environment you chose (in my case LXDE). That officially ends the "from CLI to GUI" exercise. If however you don't get into the GUI, the Internet is once again your best resource for troubleshooting (but you can leave comments and I'll try to answer them).

Moving forward, it's up to the user how further setup will go i.e. installation of web browser, media players and etc. Again, this is based on preference; below are some of mine.

Terminal Emulator

    # apt-get install lxterminal

Text Editor

CLI

    # apt-get install vim-nox

GUI

    # apt-get install leafpad

Web Browsers

Iceweasel (rebranded Firefox for Debian)

    # apt-get -t wheezy-backports install iceweasel

Chromium (open-source Google Chrome)

    # apt-get -t wheezy-backports install chromium-browser

Adobe Flash plug-in

    # apt-get install flashplugin-nonfree

BitTorrent Client

rTorrent CLI bit-torrent client

    # apt-get install rtorrent

Graphics

Shotwell Photo Manager

    # apt-get install shotwell

GIMP (open-source Photoshop alternative)

    # apt-get install gimp

Inkscape (vector graphics)

    # apt-get install inkscape

Multimedia

Banshee Multimedia Manager

    # apt-get install banshee

MPlayer2 (CLI movie player)

    # apt-get install mplayer2

Document Viewer

    # apt-get install evince

Conclusion

That about wraps up this post. I hope this has been a useful resource for some people out there. This exercise can seem to be a daunting task, and it is. It takes a bit of effort and a lot of online searching and reading. It may take some time to accustom oneself to installing a Linux distro, much more for starting from a CLI and building it up to a GUI system. But believe you me, this is easy compared to setting up an Arch Linux system.

I am bound to make mistakes. Feedback on those mistakes will help me greatly. Any comments, suggestions and/or corrections can be left in the comments section.

Happy Linuxing with Debian! I leave you with a screenshot of my current desktop (using a custom wallpaper I made myself).

This post was partly inspired by this blog post: Lightweight Debian: LXDE Desktop From Scratch. You should go check that blog out for much more technical stuff.

No comments:

Post a Comment