Overview

These are my notes for installation of Debian Linux on my personal workstation. They are intended as a high level checklist rather than a step by step installation guide. I tend to start from a minimal, text-only Debian install.

Installation

Hardware

NVMe SSD

As of 20160903, the version of GRUB included with the Debian installer contains a bug preventing it from working with NVMe drives. Also, the 3.16 kernel included with Debian 8 predates some important NVMe improvements. Perform an expert installation, enable backports and, before installing a bootloader, drop to a shell and chroot to the install.

cd /target
mount -t proc /proc proc/
mount --rbind /sys sys/
mount --rbind /dev dev/
mount --rbind /run run/
chroot . /bin/bash

Now install the kernel and grub from backports.

apt-get update
apt-get -t jessie-backports install linux-image-amd64
apt-get -t jessie-backports install grub-pc
update-grub
grub-install

The last two steps may not be necessary. GRUB has automatically detected installed OSes and installed itself with most of my configurations. If EFI ever offers a compelling benefit, install the package grub-efi instead of grub-pc.

SSD Hard Drive

Use a TRIM enabled filesystem such as ext4.

Locate partitions so they match the SSD block size. To check under Windows, execute msinfo32 and check under Components -> Storage -> Disks, looking for “Partition Starting Offset”. If it is divisible by 4096, all is well. If not, use the GParted Live CD and follow these instructions.

Set AHCI mode in the BIOS

Install package hdparm and check for TRIM support with

hdparm -I /dev/<your device>

under “Data Set Management TRIM supported”.

Create daily TRIM cronjob by creating the following file in /etc/cron.daily/fstrim (remember to make it executable)

#!/bin/sh
# Perform manual filesystem TRIM
#
LOG=/var/log/trim.log
echo "*** $(date -R) ***" >> $LOG
fstrim -v / >> $LOG

To reduce disk writes, mount the SSD filesystems with the relatime option in /etc/fstab to reduce file and directory access time updates.

USB Automounting

Install package usbmount and add ntfs to valid partition types in /etc/usbmount/usbmount.conf so the line reads

FILESYSTEMS="ntfs vfat ext2 ext3 ext4 hfsplus"

Graphics Drivers

Add the contrib and non-free repositories to /etc/apt/sources.list and then install the linux-headers-amd64, fglrx-driver and fglrx-control packages. If you installed the backports kernel earlier for NVMe support, be sure to use backports for the video drivers so they compile the kernel module correctly. Ignore this and you will be chasing very misleading error messages again.

As root, execute aticonfig --initial to generate an initial Xorg config file.

For my dual head configuration (40" 3840x2160 in landscape and 30" 2560x1600 in portrait) create new file ~/.xinitrc with the following contents:

#!/bin/sh
xrandr --output DFP9 --mode 3840x2160 --pos 0x0 --output DFP10 --rotate left --mode 2560x1600 --pos 3840x-150
. /etc/X11/Xsession

Add a Virtual line to /etc/X11/xorg.conf in the Display section defining a large enough virtual desktop.

Section "Screen"
        Identifier "aticonfig-Screen[0]-0"
        Device     "aticonfig-Device[0]-0"
        Monitor    "aticonfig-Monitor[0]-0"
        DefaultDepth     24
        SubSection "Display"
                Viewport   0 0
                Depth     24
                Virtual 5440 2560
        EndSubSection
EndSection

Note: The open source radeon driver is getting better. If you go this route in the future, remember that apt does not remove the radeon blacklist installed by fglrx-driver in /etc/modprobe.d and it must be done manually.

Audio

Install relevant packages and then use alsamixer to set audio levels. Later, after fluxbox is installed, can add key bindings for volume control.

apt-get install libasound2 libasound2-doc alsa-base alsa-utils alsa-oss alsamixergui

Printer

Install packages cups and cups-client

/etc/init.d/cups start
usermod -a -G lpadmin ataylor

In a browser, visit http://localhost:631 and add printer via this interface (autodetects the networked HP LJ4). Go to “Printers” tab, then click printer name. From “Administration” dropdown, make this printer the default for this server. From “Maintenance” dropdown, print a test page.

Scanner

Install relevant packages:

apt-get install xsane sane sane-utils xsltproc libtiff-tools

Download Epson ImageScan software and install

dpkg -i iscan-data_1.22.0-1_all.deb
dpkg -i iscan_2.29.1-5~usb0.1.ltdl7_amd64.deb
dpkg -i iscan-plugin-gt-x770_2.1.2-1_amd64.deb

Basic Services

Install basic packages

apt-get install openssh-server bzip2 zip

Email Forwarding

The minimal OS install includes exim4. Execute dpkg-reconfigure exim4-config and select “mail sent by smarthost; no local mail” unless you intend to host a mail server on this machine.

Create file ~/.forward that contains destination email address.

Check /etc/aliases to make sure system/daemon users are routed the way you want.

NTP Configuration

Install package ntp and check servers with ntpq -p. Default configuration should cause daemon to start at boot and sync automatically.

SMB Client

Install cifs-utils.

Create /etc/smb_credentials as root with permissions 0600. Do not include spaces around the equal sign.

username=windows_username
password=windows_password

Create a new mount point in the filesystem and add it to /etc/fstab.

//192.168.1.5/zfs_stripe_0      /mnt/talisker_stripe_0  cifs    credentials=/etc/smb_credentials,file_mode=0664, \
    dir_mode=0775,iocharset=utf8,sec=ntlm,uid=1000,gid=1000,noserverino   0       0

GUI

X, Fluxbox

Install the following packages:

apt-get install xorg fluxbox

Overwrite existing ~/.fluxbox/keys file with the following key shortcuts:

# click on the desktop to get menus
OnDesktop Mouse1 :HideMenus
OnDesktop Mouse2 :WorkspaceMenu
OnDesktop Mouse3 :RootMenu

# scroll on the desktop to change workspaces
OnDesktop Mouse4 :PrevWorkspace
OnDesktop Mouse5 :NextWorkspace

# alt + left/right click to move/resize a window
OnWindow Mod1 Mouse1 :MacroCmd {Raise} {Focus} {StartMoving}
OnWindowBorder Move1 :StartMoving

OnWindow Mod1 Mouse3 :MacroCmd {Raise} {Focus} {StartResizing NearestCorner}
OnLeftGrip Move1 :StartResizing bottomleft
OnRightGrip Move1 :StartResizing bottomright

# control-click a window's titlebar and drag to attach windows
OnTitlebar Control Mouse1 :StartTabbing

# double click on the titlebar to shade
OnTitlebar Double Mouse1 :Shade

# left click on the titlebar to move the window
OnTitlebar Mouse1 :MacroCmd {Raise} {Focus} {ActivateTab}
OnTitlebar Move1  :StartMoving

# middle click on the titlebar to lower
OnTitlebar Mouse2 :Lower

# right click on the titlebar for a menu of options
OnTitlebar Mouse3 :WindowMenu

# open a terminal
Mod1 F1 :Exec xterm
# open a dialog to run programs
Mod1 F2 :Exec fbrun
# Open file manager
Mod1 F3 :Exec spacefm
# current window commands
Mod1 F4 :Close

# Take a screenshot
107 :Exec /home/ataylor/bin/take_screenshot.sh

# Start screensaver, lock screen
127 :Exec xscreensaver-command -lock

# Window sizing commands
Control F1 :Minimize
Control F2 :Shade
Control F3 :Maximize
Control F4 :Fullscreen

Control F5 :MacroCmd {ResizeTo 1600 1250} {Moveto 0 0 UpperLeft}
Control F6 :MacroCmd {ResizeTo 1600 1250} {Moveto 0 0 LowerLeft}

Control F7 :MacroCmd {ResizeTo 1905 2160} {Moveto 0 0 UpperLeft}
Control F8 :MacroCmd {ResizeTo 1905 2160} {Moveto 0 0 UpperRight}

Control F9 :MacroCmd {ResizeTo 1920 1080} {Moveto 0 0 UpperLeft}
Control F10 :MacroCmd {ResizeTo 1920 1080} {Moveto 0 0 UpperRight}
Control F11 :MacroCmd {ResizeTo 1920 1080} {Moveto 0 0 LowerLeft}
Control F12 :MacroCmd {ResizeTo 1920 1080} {Moveto 0 0 LowerRight}

Use “meta” style in fluxbox

Install numlockx package and add numlockx & to ~/.fluxbox/startup.

Ensure ~/.xinitrc ends in . /etc/X11/Xsession if the file doesn’t already exist.

Add any apps that I want to autostart in ~/.fluxbox/startup (pidgin, deluge-gtk, etc)

Set “focus on mouse” and NOT “raise on focus” in the right-click menu.

Add the following to ~/.fluxbox/startup if not already present.

# Set numlock                                                                                       
numlockx &                                                                                          
# Chat software                                                                                     
pidgin &                                                                                            
# Get colors for xterms                                                                             
xrdb ~/.Xresources &                                                                                
# Wallpaper rotation                                                                                
# /home/ataylor/bin/wallpaper_rotation.sh &                                                         
# Xscreensaver                                                                                      
xscreensaver -nosplash &
# Change your keymap:                                                                               
xmodmap "/home/ataylor/.Xmodmap"

Control/Capslock Swap

Create or edit ~/.Xmodmap to contain:

!
! Swap Caps_Lock and Control_L
!
remove Lock = Caps_Lock
remove Control = Control_L
keysym Control_L = Caps_Lock
keysym Caps_Lock = Control_L
add Lock = Caps_Lock
add Control = Control_L

Screensaver

Install the following packages:

xscreensaver xscreensaver-gl xscreensaver-gl-extra xscreensaver-screensaver-bsod xscreensaver-screensaver-webcollage

Execute xscreensaver-demo to configure the screensaver.

Add xscreensaver -nosplash & to ~/.fluxbox/startup.

Wallpaper Rotation

Install nitrogen package. Execute nitrogen once and set wallpaper manually to create initial config files.

Create file ~/bin/wallpaper_rotation.sh as shown below and add to ~/.fluxbox/startup as /home/ataylor/bin/wallpaper_rotation.sh &.

#!/usr/bin/python
# This script creates a wallpaper slideshow.

##### Configuration

# List of image source directories
# Each sublist is of the form:
# [monitor ID, absolute path to directory containing images for this monitor]
source_dir = [
              [0,"/mnt/talisker_mirror_0/wallpaper/ratio_16_9"],
              [1,"/mnt/talisker_mirror_0/wallpaper/ratio_10_16"]
             ]

# This list will be populated during runtime.
# Each sublist is of the form:
# [monitor ID, absolute path to image file to display on this monitor]
current_wallpaper = [
                     [0,""],
                     [1,""]
                    ]

# Path to nitrogen configuration file
nitrogen_config = "/home/ataylor/.config/nitrogen/bg-saved.cfg"

##### Dependencies

from subprocess import call
from os import listdir
from os.path import isfile, join
from random import choice
from time import sleep

##### Source Code

def write_config():
        config_file = open(nitrogen_config, 'w')
        for monitor in current_wallpaper:
                # Indenting the following triple-quoted text inserts leading whitespace in the
                # nitrogen config file. However, nitrogen strips leading whitespace before
                # processing its config file and the extra whitespace makes this Python script
                # more readable.
                template = """[xin_{monitor_n}]
                              file={wallpaper_file}
                              mode=0
                              bgcolor=#000000
                           """
                context = {
                           "monitor_n":monitor[0],
                           "wallpaper_file":monitor[1]
                          }
                config_file.write(template.format(**context))
        config_file.close()

def refresh_wallpaper():
        write_config()
        call(["/usr/bin/nitrogen", "--restore"])

def get_rand_from_dir():
        file_choices = [x for x in listdir(source_dir[current_monitor][1]) if isfile(join(source_dir[current_monitor][1], x))]
        filename = choice(file_choices)
        filename = join(source_dir[current_monitor][1], filename)
        current_wallpaper[current_monitor][1] = filename

# Put something up on all monitors
for i in range(len(source_dir)):
        current_monitor = i
        get_rand_from_dir()
refresh_wallpaper()

# Eternal slideshow loop
while 1:
        current_monitor = (current_monitor + 1) % len(source_dir)
        get_rand_from_dir()
        refresh_wallpaper()
        sleep(10)

Screenshots

Create screenshot directory ~/screenshots.

Install packages x11-apps (for xwd) and netpbm (for xwdtopnm and pnmtopng)

Write the following to ~/bin/take_screenshot.sh

#!/bin/bash

SAVEDIR="$HOME/screenshots"
DATE=`date +%Y%m%d-%T`

if [! -d ${SAVEDIR} ]
then
mkdir -p {$SAVEDIR}
fi

xwd | xwdtopnm | pnmtopng > "${SAVEDIR}"/"${DATE}".png

Update ~/.fluxbox/keys with line 107 :Exec /home/ataylor/documents/screenshots/take_screenshot.sh or use xev to select a different key.

xterm

Set xterm fonts and colors by creating ~/.Xresources with contents shown below. Add the line xrdb ~/.Xresources & to ~/.fluxbox/startup and restart X.

xterm*faceName: Liberaqtion Mono:size=12:antialias=true
xterm*font: 7x13

! Solarized color scheme for the X Window System                                                    
!                                                                                                   
! http://ethanschoonover.com/solarized                                                              
! Common                                                                                            
#define S_yellow #b58900                                                                            
#define S_orange #cb4b16                                                                            
#define S_red #dc322f                                                                               
#define S_magenta #d33682                                                                           
#define S_violet #6c71c4                                                                            
#define S_blue #268bd2                                                                              
#define S_cyan #2aa198                                                                              
#define S_green #859900                                                                             
! Dark                                                                                              
!#define S_base03 #002b36                                                                           
!#define S_base02 #073642                                                                           
!#define S_base01 #586e75                                                                           
!#define S_base00 #657b83                                                                           
!#define S_base0 #839496                                                                            
!#define S_base1 #93a1a1                                                                            
!#define S_base2 #eee8d5                                                                            
!#define S_base3 #fdf6e3                                                                            
! Light                                                                                             
#define S_base03 #fdf6e3                                                                            
#define S_base02 #eee8d5                                                                            
#define S_base01 #93a1a1                                                                            
#define S_base00 #839496                                                                            
#define S_base0 #657b83                                                                             
#define S_base1 #586e75                                                                             
#define S_base2 #073642                                                                             
#define S_base3 #002b36                                                                             
! To only apply colors to your terminal, for example, prefix                                        
! the color assignment statement with its name. Example:                                            
!                                                                                                   
! URxvt*background: S_base03                                                                        
*background: S_base03                                                                               
*foreground: S_base0                                                                                
*fading: 40                                                                                         
*fadeColor: S_base03                                                                                
*cursorColor: S_base1                                                                               
*pointerColorBackground: S_base01                                                                   
*pointerColorForeground: S_base1                                                                    
*color0: S_base02                                                                                   
*color1: S_red                                                                                      
*color2: S_green                                                                                    
*color3: S_yellow                                                                                   
*color4: S_blue                                                                                     
*color5: S_magenta                                                                                  
*color6: S_cyan                                                                                     
*color7: S_base2                                                                                    
*color9: S_orange                                                                                   
*color8: S_base03                                                                                   
*color10: S_base01                                                                                  
*color11: S_base00                                                                                  
*color12: S_base0                                                                                   
*color13: S_violet                                                                                  
*color14: S_base1                                                                                   
*color15: S_base3

vim

Install packages vim, vim-gtk, vim-addon-manager.

Install file ~/.vim/colors/solarized.vim

Create ~/.vimrc as shown below.

set nocompatible              " be iMproved, required
filetype off                  " required

set number
syntax on
set tabstop=4
set expandtab
set background=dark
colorscheme solarized

"Folding
"http://vim.wikia.com/wiki/Folding_for_plain_text_files_based_on_indentation
"set foldmethod=expr
"set foldexpr=(getline(v:lnum)=~'^$')?-1:((indent(v:lnum)<indent(v:lnum+1))?('>'.indent(v:lnum+1)):indent(v:lnum))
"set foldtext=getline(v:foldstart)
"set fillchars=fold:\ "(there's a space after that \)
"highlight Folded ctermfg=DarkGreen ctermbg=Black
"set foldcolumn=6

" Color the 100th column.
set colorcolumn=100
highlight ColorColumn ctermbg = darkgray

" Support for tags, currently for Moodle sanity
set tags=tags;/

Desktop Applications

Web Browser

Install iceweasel package

Install plugins: Adblock Plus, NoScript, Image Zoom, Save Image in Folder, Thumbnail Zoom Plus, Enhanced Steam.

In about:config, set browser.newtabpage.enabled = False.

Since Firefox follows the freedesktop.org guidelines, tell it to stop creating stupid directories in my homedir. Create ~/.null in homedir. Edit ~/.config/user-dirs.dirs and change all values to point to $HOME/.null. Example below.

# This file is written by xdg-user-dirs-update
# If you want to change or add directories, just edit the line you're
# interested in. All local changes will be retained on the next run
# Format is XDG_xxx_DIR="$HOME/.null/yyy", where yyy is a shell-escaped
# homedir-relative path, or XDG_xxx_DIR="/yyy", where /yyy is an
# absolute path. No other format is supported.
# 
XDG_DESKTOP_DIR="$HOME/.null"
XDG_DOWNLOAD_DIR="$HOME/.null"
XDG_TEMPLATES_DIR="$HOME/.null"
XDG_PUBLICSHARE_DIR="$HOME/.null"
XDG_DOCUMENTS_DIR="$HOME/.null"
XDG_MUSIC_DIR="$HOME/.null"
XDG_PICTURES_DIR="$HOME/.null"
XDG_VIDEOS_DIR="$HOME/.null"

Email

Install package mutt-patched since it includes the sidebar-folder-path.

Installed solarized colorscheme to ~/.mutt/colors_solarized

Configure .muttrc

# .muttrc configuration file

# General Configuration
set editor='vim'
set imap_check_subscribed=yes
set print_cmd="muttprint"
set print_split
set certificate_file=".mutt_certs"
source /home/ataylor/.mutt/colors_solarized/mutt-colors-solarized-light-16.muttrc

# Sidebar
set sidebar_width=20
set sidebar_visible=yes
set sidebar_sort=yes

# View URLs inside mutt
macro index \cd "|urlview\n"
macro pager \cd "|urlview\n"

# Handle HTML emails
auto_view text/html
alternative_order text/plain text/enriched text/html

### Account: ataylor@subgeniuskitty.com
source "~/.mutt/ataylor_subgeniuskitty_com"
folder-hook 'imaps://ataylor\@subgeniuskitty.com@mail.subgeniuskitty.com:993' 'source ~/.mutt/ataylor_subgeniuskitty_com'

# Macros to handle multiple accounts
macro index <f2> '<sync-mailbox><enter-command>source ~/.mutt/ataylor_subgeniuskitty_com<enter><change-folder>!<enter>'

# ~/.mutt/ataylor_subgeniuskitty_com

# Read from IMAP server 
set imap_user="ataylor@subgeniuskitty.com"
set imap_pass="pass"
set folder="imaps://ataylor\@subgeniuskitty.com@mail.subgeniuskitty.com:993"
set spoolfile="+INBOX"

# Send through SMTP server
set smtp_url="smtps://ataylor\@subgeniuskitty.com@mail.subgeniuskitty.com:465"
set smtp_pass="pass"
set from="ataylor@subgeniuskitty.com"
set realname="Aaron Taylor"
set postponed="=Drafts"
set record="=Sent"

# Account Hook -- Important
account-hook $folder "set imap_user=ataylor@subgeniuskitty.com imap_pass=pass"

Install package elinks and add following line to .mailcap

text/html; elinks -dump %s ; copiousoutput

Install packages muttprint and ospics, and create .muttprintrc file with contents shown below.

# Muttprint Configuration File

PRINT_COMMAND="lp"
PENGUIN=/usr/share/ospics/Debian_color.eps

Install package urlview.

IRC

Install package irssi and add relevant nick/pass/channel/server for autostart with

/server add -auto -network freenode chat.freenode.net 6667 <password>
/network add -nick <nickname> freenode
/channel add -auto #hoggit freenode

Cut down on the chatter

/ignore * JOINS QUITS PARTS

Enable autologging and quasi-rotation by making log dir and setting ownership. Then, in irssi,

/set autolog_path /path/to/logdir/$tag/$0.%Y%m%d.log
/set autolog on
/save

Add the following scripts to ~/.irssi/scripts and symlink to ~/.irssi/scripts/autostart: adv_windowlist nickcolor trackbar

Add to ~/.xinitrc but for some reason, must manually specify xterm colors otherwise they default to black text on white background rather than system defaults.

xterm -fg AliceBlue -bg Black irssi &

Misc Software

A list of misc packages in the Debian repository to install.

Text Editor      - vim vim-gtk vim-addon-manager
Science/Data     - texlive texlive-science texlive-math-extra gnuplot scilab octave dx python-scitools paraview
Document Viewers - okular okular-extra-backends
Communication    - pidgin
Office Suite     - libreoffice gnumeric abiword scribus
System Tools     - dvd+rw-tools spacefm virtualbox-ose cellwriter wine smartmontools
Graphics         - gimp rawtherapee inkscape geeqie
Media            - vlc browser-plugin-vlc quodlibet ffmpeg
Programming      - valgrind libgmp-dev libplot-dev plotutils glade libncurses5-dev libmysqlclient-dev
Misc             - kicad golly

Misc

Sun Microsystems Keyboard Codes

name               sun code    sun name                usb code    usb name           alternative    alt USB code    alt windows vkey

help               0x76        lf(16)                  0x75        help               f13            0x68            124
stop               0x01        buckybits+systembit     0x78        stop               f14            0x69            125
again              0x03        lf(2)                   0x79        again              f15            0x6A            126
props              0x19        lf(3)                   0x76        keyboard menu      f16            0x6B            127
undo               0x1A        lf(4)                   0x7A        undo               f17            0x6C            128    
front              0x31        lf(5)                   0x77        select             f18            0x6D            129
copy               0x33        lf(6)                   0x7C        copy               f19            0x6E            130
open               0x48        lf(7)                   0x74        execute            f20            0x6F            131
paste              0x49        lf(8)                   0x7D        paste              f21            0x70            132
find               0x5F        lf(9)                   0x7E        find               f22            0x71            133
cut                0x61        lf(10)                  0x7B        cut                f23            0x72            134

mute               0x2D        rf(4)                   0x7F        mute               f24            0x73            135
vol down           0x02        -                       0x81        volume down        intl'1         0x87            193    
vol up             0x04        -                       0x80        volume up          intl'6         0x8C            234
power              0x30        bf(13)                  0x66        keyboard power*    -              -               -

compose            0x43        COMPOSE                 0x65        app                right gui
left meta          0x78        BUCKYBITS+METABIT       0xE3        left gui           left alt
right meta         0x7A        BUCKYBITS+METABIT       0xE7        right gui          right alt
escape**           0x1D        ESC                     0x29        escape             tilde
tilde**            0x2A        `                       0x35        tilde              escape
caps lock**        0x77        SHIFTKEYS+CAPSLOCK      0x39        caps lock          control
control**          0x4C        SHIFTKEYS+LEFTCTRL      0xE0        control            caps lock
alt                0x13        SHIFTKEYS+ALT           0xE2        left alt           left gui
alt graph          0x0D        -                       0xE6        right alt          right control

Keyboard Shortcuts: mutt

D ~A     - Delete all in folder
$        - Purge
c        - Change folder
T ~A     - Tag all in folder
;s       - Save all tagged messages
Ctrl-B   - Show URLs

Burning CD/DVD

Create ISO from filesystem(maximizing compatiblity with long filenames):

genisoimage -r -J -l -d -joliet-long -allow-multidot -V undergrad_files -o target.iso /path/to/source/directory

For DVD ISO burning:

growisofs -dvd-compat -Z /dev/sro=name.of.iso

For CD ISO burning:

wodim -v -sao dev=/dev/sr0 name.of.iso

Multipage PDFs

First scan and get everything ready as TIFFs

tiffcp scan_???.tiff multipage.tiff
tiff2pdf -j -o output.pdf multipage.tiff

Files