0x2: Minimal Debian Install Guide

Stripping Back The Cruft

When I use Windows I feel like I am in a cluttered room that is filled with unnecessary garbage that I can’t remove or configure. To alleviate this weird and admittedly pretty niche problem, for the last few years I have become accustomed to using a stripped back Debian environment. It allows me to configure, hack and break the system to my hearts content.

So my dearest comrade, I bestow upon you the fruits of my labor — the ‘Minimal Debian Install Guide’. Now with 100% extra rice and 10% less Windows bashing.

mess
By Xkcd https://xkcd.com/1267/

The goal of this post is to outline a minimal Debian install using i3 as the windows manager and Xorg as the display server to give us the most performant, light weight and configurable desktop environment we can. We also want to engage 1337 h4xx04 man mode, so we will be ricing. We won’t be covering the usage of i3 (there’s plenty of resources for that), just it’s installation and configuration.

Install Debian

Download a Debian netinstaller iso and load it onto a USB or CD and proceed with installing it on to your physical or virtual machine. The install is very straightforward and is probably the easiest Linux distro to install (not including Ubuntu.. we don’t talk about Ubuntu here).

install

Once you reach the ‘Software selection’ page of the install, deselect the desktop environments and everything else but the ‘standard system utilities’. This is so we start without a desktop environment and have a very lean install. We will be installing our display server and window manager later.

software-selection

Once the install is finished, the system will reboot and you will be presented with the login screen. Log in using the root account you set in the installation.

login

Debian Minimalism

We are now in our freshly installed Debian environment, logged in as root at a shell. As we chose not to install a desktop environment, not only do we need to manually install one, we now need to do a lot of the post install configurations manually from the command line. Intimidating yes, but Comrade Cheese leaves no comrade behind — we will now walk through this process.

Network

Firstly determine whether or not your machine is correctly configured to access the internet/your network by issuing the following command:

ip link

If your network interface card (NIC) is configured and connected correctly, this command will display the device as being ‘UP’ as demonstrated in the below image:

ip-link

If your NIC isn’t displayed or you want to assign a static address or use a wireless NIC, you will have to modify your ‘/etc/network/interfaces’ file with nano and create a new entry for it. Wired connections are auto configured so I don’t have to configure anything, but if you wanted to use a static address or use a wireless NIC that wasn’t displayed or up, this is how you would lay the entries out in ‘/etc/network/interfaces’:

nano /etc/network/interfaces

Ethernet interface:

# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.x.x
netmask 255.255.255.0
gateway 192.168.x.x

Wireless interface:

# The primary network interface
iface wpa0 inet static
address 192.168.x.x
gateway 192.168.x.x
wpa-ssid YOUR_SSID
wpa-psk YOUR_PASSPHRASE

Or using DHCP (interchangeable with appropriate label for wireless interface):

# The primary network interface
allow-hotplug eth0
iface eth0 inet dhcp

examplewifi
Example wireless entry

Before adding any entry ensure you bring the device down with:

ifdown eth0

Bring a device back up with:

ifup eth0

If you needed to edit your ‘/etc/network/interfaces’ file to configure a NIC, run the following to restart the networking service:

/etc/init.d/networking restart

Update and Upgrade

Before we can update and upgrade the system and begin installing the desktop environment, we first need to configure our sources list by editing the ‘/etc/apt/sources.list’ file with nano.

We want to remove all the comments (denoted with a #) that were leftover from the install and append a string to the end of each line to include the non-free repositories. Simply add ‘contrib non-free’ to the end of every line that ends with ‘main’, as demonstrated below:

nano /etc/apt/sources.list

Created with GIMP

Save (Ctrl + O) and close (Ctrl + X) the file and update the system with:

apt update && apt upgrade -y

User Privileges

As we shouldn’t use the root account for our day to day access, we need to give our user account superuser privileges by installing sudo and adding our user to the sudoers list. Further we don’t want to have to enter our password every time we want to execute a command using sudo, so we’ll configure for that as well. Start by installing sudo and adding your username to the sudo group with:

apt install sudo && adduser username sudo

Then we need to add the following entry to the end of the sudoers file using visudo:

visudo
username ALL=(ALL) NOPASSWD:ALL

Created with GIMP
Mine for example.

Save the file and exit. Now you can log out of root and log back into your account to continue with the configurations. To test that the visudo config worked, simply run a update or another command requiring sudo and if its working, it shouldn’t prompt you for a password.

Intel/AMD Microcode

Depending on the manufacturer of your CPU, you should install its microcode firmware to ensure your CPU’s microcode firmware remains up to date.

Intel:

sudo apt install intel-microcode

AMD:

sudo apt install amd-microcode

Missing Drivers

During the initial install of the system, the installer should have installed all required firmware and drivers, however sometimes it doesn’t automatically or it can’t find them and you may need to manually install them.

The best way to check for any firmware or driver issues is to enter the dmesg command and parse through the output (using grep or your eye balls) looking for missing firmware or driver errors and googling for the package you are required to install to fix the error.

sudo dmesg

Installing i3

Finally it is time to install and migrate into the glorious desktop environment we have been longing for: i3. Ensure you have updated and upgraded the system, rebooted and then run the following command to install i3 and required components:

sudo apt install xorg xinit i3 suckless-tools

installi3

Once this is completed we need to configure the display server to use i3 on startup and start the display server with:

echo ‘exec i3’ > ~/.xsession
startx

Created with GIMP

The first time that i3 runs it will ask you to generate a configuration file. Enter yes and choose your modifier key (by default it is win) and it will generate your config file at ‘~/.config/i3/config’. Everything related to the management and configuration of i3 is in that file.

Use your modifier key + D to open up dmenu and type (it should auto complete) and select ‘i3-sensible-terminal’ to start a terminal. Dmenu is what you use to access and use software. By default its location is at the top of the screen. Another shortcut to start a terminal (which is defined in the i3 config file) is modifier key + Enter.

terminals

i3 has many shortcuts and keys for navigating around the environment and setting the various modes entirely without the use of a mouse, so I suggest you read up on them or use one of the many cheat sheets available. But essentially it is modifier key + some other key/combinations of keys.

Compiling and Installing i3-gaps

i3-gaps adds.. gaps.. to i3. To access this glorious aesthetic improvement, we need to compile and install i3-gaps from source. I have covered this in a previous post, but I will also cover it here.

Before we can begin to compile and install i3-gaps, we need to grab some extra packages:

sudo apt install -y libxcb1-dev libxcb-keysyms1-dev libpango1.0-dev libxcb-util0-dev libxcb-icccm4-dev libyajl-dev libstartup-notification0-dev libxcb-randr0-dev libev-dev libxcb-cursor-dev libxcb-xinerama0-dev libxcb-xkb-dev libxkbcommon-dev libxkbcommon-x11-dev autoconf libxcb-xrm0 libxcb-xrm-dev automake libsnack2-dev libxcb-shape0-dev autoconf libev-dev build-essential git

When completed reboot the system to ensure everything is working for the i3-gaps install. Once you have rebooted and logged back in, clone the i3-gaps repository and move into the repos directory with:

git clone https://github.com/Airblader/i3 i3-gaps
cd i3-gaps

Created with GIMP

Now we have cloned the repo, it’s time to compile and install it by issuing the following sequentially:

autoreconf –force –install
rm -rf build/
mkdir -p build && cd build/
../configure –prefix=/usr –sysconfdir=/etc –disable-sanitizers
make && sudo make install

We just need to add the following to the end of our i3 config file to setup some keybindings:

nano ~/.config/i3/config

config

Now restart i3 with modifier key + Shift + R and i3-gaps should start.

completedinstall

Notice the gaps we now have between our terminal windows? It is good, it is glorious even.

Ricing 101

Micah Cowell defines ricing as “when someone is custom their desktop such as the icons, panels, or system interface”, a user on Reddit called it “form over function for nerds” and the InstallGentoo wiki entry on ‘GNU/Linux Ricing’ simply states “let’s be honest: this is why you’re really here”.

Ricing is all about making your system look cool as fuck (often at the behest of accessibility and sometimes functionality) even with just i3 we have a pretty cool looking system — we’re not done yet.

Wallpaper

Lets start of with a basic wallpaper to hang on our systems desktop environment. I like to use a selection of wallpapers that is assigned a random one at login. To do this we first need to install feh and then dive into the i3 config file:

sudo apt install feh
nano ~/.config/i3/config

Create a directory called ‘.wallpapers’ in your home directory and fill it with images, then add the following line to the bottom of your i3 config:

exec_always feh –recursive –bg-fill –randomize ~/.wallpapers/*

wallpaperconfig

If you only want one specific image:

exec_always feh –bg-scale ~/.wallpaper/image.file

When we restart i3 or X a wallpaper should load on the desktop.

fehcompleted

Status Bar

statusbar

The status bar includes extra system information not relevant to my setup and because I don’t rely on an outdated and convoluted system of measurement (that is only used by three countries globally), I would like the date and time to read more logically.

Instead of using i3’s built in status bar, we are going to use i3blocks. Install it by issuing:

sudo apt install i3blocks

Configure your i3 config file to now use i3blocks and a config file we will set next:

nano ~/.config/i3/config
status_command i3blocks -c ~/.config/i3/i3blocks.conf

i3blocks

Copy the i3blocks configuration file to your home directory with:

cp /etc/i3blocks.conf ~/.config/i3/

Now configure this file as you see fit. The following is the config I used for this layout:

i3blocksdone

Read more here about how to configure i3blocks to suit your system setup.

Screen Lock

Currently you can lock the screen by issuing the i3lock command at a terminal. Let’s configure a keybinding for i3, so all you have to do to lock the screen is modifier key + Shift + X.

nano ~/.config/i3/config

Find the section where bindings are defined and add the entry:

# lock the screen with i3lock
bindsym $mod+Shift+x exec i3lock

Created with GIMP

Terminal Transparency

The terminal and the overall system theme currently looks like garbage and as I have covered in an unrelated post, only psychopaths use a white theme. Lets deal with that, but first lets fix the default terminal up to express our systems unique individuality.

Create a file named ‘.Xresources’ in your home directory with:

nano ~/.Xresources

Then enter the following into this file:

URxvt.transparent: true
URxvt.shading:20
URxvt.foreground: #eeeeee
URxvt.scrollBar: false

Then issue the following to init this configuration:

xrdb ~/.Xresources

Close i3 to restart X and the terminal should now be configured to be transparent and not have a ugly scroll bar. Let’s dive into configuring how the terminal looks even further. We now need to crack open our ‘.bashrc’ file to configure the terminal to output more pretty. You can read more about this here. First, let’s make a backup of the file by issuing:

cp .bashrc .bashrc_backup

Either delete ‘.bashrc’ and recreate it, append its contents with this gist and once you restart your terminal the output will be pretty.

transparentterminal

If you don’t like it and want to return to the default output, delete ‘.bashrc’ and rename the backup to replace it.

Windows Without Borders

I’m not a fan of the title bar on top of the windows, so I am going to remove it and make the edge lines of the windows a lot thinner. One again dive back into your i3 config file and add the following entry:

new_window 1pixel
new_float normal

Close your terminal and restart i3 and the top bar will be removed.

Theme

Finally let’s add a system theme that all of our various GUI applications will use. We are going to use the Arc GTK theme. First we need to install a theme switcher named lxappearance and then we need to install the Arc theme package:

sudo apt install lxappearance arc-theme

Run lxappearance from dmenu or a terminal and select the Arc theme and apply it. I chose to use the high contrast icon theme as well.

lxappearance

If you’re using Firefox like I am, there is a theme for it  that matches the system theme.

finished

Final Thoughts

As you’ve seen there are a lot of ‘dotfiles’ to configure when ricing. The great thing about the online community of ricing enthusiasts is, a lot of people like to upload their various configurations — often with screen dumps — so you can use or reference their configs. Some good ones to consider using or referencing are:

If you are looking for inspiration for your configurations, the sub-Reddits /r/unixporn and /r/ricing are filled with examples. I don’t think desktop ricing threads are allowed on /g/ anymore, but they used to be a good source of inspiration.

I didn’t include it in the guide, but one of the last things I would do is change the system and terminal font.

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 )

Google photo

You are commenting using your Google 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 )

Connecting to %s