Linux not From Scratch – But Debian
I’m a huge fan of the APT package management system, but I don’t like the trend where Canonical is going with Ubuntu and I’m not really a fan of Gnome3. Therefore, I was looking for something based on the APT package management system which is neither Ubuntu/Unity nor Gnome3.
My idea was to take a minimal Debian testing installation and customize it to my needs. No sooner said than done!
I already had a running Linux system on my Laptop, so I was able to prepare the boot medium directly from this machine. But the following steps can also be performed from a Windows or Mac machine, because UNetbootin is available for all these three operating systems (my boot medium had to be a USB stick because my X220 doesn’t have a CD/DVD drive).
I started my plan by installing two necessary packets
sudo apt-get install gparted unetbootin
Then I started gparted and created a fat32 partition on my USB stick. Afterwards I started UNetbootin and selected Debian testing x86_64 hd_media as my target system. Once finished I downloaded the first DVD of the Debian testing release
and stored it on the USB sticks root directory along with the stuff that UNetbootin put on it. Now, some of you might ask why I didn’t use the much smaller network installer and instead downloaded the whole DVD image when I only wanted to use a minimal set of applications. In my defense, I tried the network installer first, but I had some problems with it. The running Kernel lacked support for LVM, disk encryption and my SSD wasn’t recognized.
Once done preparing my USB stick I plugged it into the X220 and rebooted the system. During but I held down the blue ThinkVantage-button, then hit F12 to select a temporary Boot device. From the menu I selected my USB stick and started the Debian installer.
I went through the default Debian installation (I used my entire disk with LVM and full disk encryption) up to the software selection dialog. There I only selected the following:
[ ] Desktop environment
[ ] Web server
[ ] Print server
[ ] DNS server
[ ] File server
[ ] Mail server
[ ] SQL server
[*] SSH server
[*] Standard system utilities
I didn’t want a graphical system just yet, because I didn’t want one of the bloated environments like Gnome or KDE. I just selected some essential components (Even the SSH server is optional. I use it quite often therefore I enabled it, but it isn’t a must-have).
After installing a basic system it was time for me to boot my newly created system. After logging in I installed a set of tools
sudo apt-get install i3 vim-gtk zsh rxvt-unicode build-essential xinit
The package build-essential is also optional. I’m a developer so I need it. Maybe I forgot some packages, just install them as you need them.
That was basically it, now I was able to start the GUI by executing
My window manager should be plain, simple and easy to configure, so I decided to use i3wm. It’s a tiling window manager which provides a lot of cool features. The first usage of i3wm might be a little bit unfamiliar but once you get used to it, it’s very powerful. Here is a quick introduction to i3wm.
You have one Super key, upon first start you can decide which one to use, either ALT-key or Windows-key (I simply refer to it as Super key). There are only a handful shortcuts you need to know in order to navigate through the system.
|Super+Number||Switch between workspaces|
|Super+cursor left/right||Switch active window|
|Super+w||window takes entire screen|
For a more complete reference check the keybindings page on i3wm.org. For now I wanted to spawn a shell, so I hit Super+d, typed urxvt in the appearing bar and hit Enter.
The default installation of i3wm didn’t look very appealing, so I wrote my own config file. I stored it in ~/.i3/config and the config file for the i3status bar in /etc/i3status.conf. I overwrote the existing files. Now I was able to just hit Super+r to reload the GUI and everything looked a lot better. It might be necessary to install additional fonts (I don’t remember exactly =P). If so, just run
sudo apt-get install xfonts-base
I added the following line in my ~/.i3/config to show my wallpaper.
exec feh –bg-scale /home/jester/Pictures/24.jpg
Before I did any additional configuration work, I wanted to switch to a better shell. In the beginning I had already installed the zsh. Now I just wanted a good configuration. Luckily there is a guy (Robbie Russell) who does this for us. I had to fetch oh-my-zsh from Github (on the bottom of the Github page are further installation instructions). After installing this framework I opened my ~/.zsh and changed the following lines:
plugins=(git debian cp)
to enable the cool git feature which you will see in the screenshot below, and also some aliases for aptitude. Oh-my-zsh contains several themes, I decided to use geoffgarside. So I added the following line
All themes can also be browsed here. Just select the one you like.
For a consistent color scheme I had to write my own ~/.Xdefaults file to have cool colors and transparency in the urxvt terminal windows. After storing the file in ~/.Xdefaults I was able to apply the changes by calling
When I spawned a new shell the background was transparent, the wallpaper was visible and the colors matched the ones in the i3bar.
Instead of installing vim I installed vim-gtk, because with vim-gtk allows to navigate with the mouse and copy/paste text into/out of vim easily by selecting the text. For an even better experience, I wrote my own ~/.vimrc. I just stored this file in ~/.vimrc to have a solid vim configuration.
The following screenshot shows my fully configured system. In the bottom right I have vim open so that you can see the colors, and the status bar in vim. On the top left you can see the zsh (with oh-my-zsh) and its git integration. I’m currently in a directory which contains a git tree (Linux kernel), so thanks to the plugin I can see on which branch I’m currently on. On the left side I simply run Firefox with my start page. On the bottom you can see the i3bar showing system information (e.g. IP address, battery level, CPU temperature, etc.). Also in the i3bar in the far right corner you can see that I’m running Pidgin and Dropbox. It’s pretty neat that the i3bar supports applications with notification icons.
Several parameters in my configuration files are device depended.
If the i3wm doesn’t start correctly check the file /etc/X11/xinit/xinitrc. Mine looks like
# global xinitrc file, used by all X sessions started by xinit (startx)
# invoke global X session script
Volume Up/Down keys
In my ~/.i3/config I have mapped two keys for volume up and down and another one to mute the sound
bindsym XF86AudioRaiseVolume exec amixer -c 0 — sset Master playback 3.22dB+
bindsym XF86AudioLowerVolume exec amixer -c 0 — sset Master playback 3.22dB-
bindsym XF86AudioMute exec /usr/local/bin/toggle-mute
These keys might differ depending on the used device. With the tool xev it is possible to capture the correct key events and compare them with the mapping table (xmodmap -pk). It might be necessary to write a new ~/.Xmodmap. I didn’t need to do this, therefore I can’t explain it. But there are plenty of information on the web about that.