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

ASUS P8H77-I

Linux has poor support for the Realtek 8168F ethernet chip. If possible, buy a motherboard with an Intel ethernet chip instead. Firmware files for the Realtek are available from the Debian firmware-nonfree repository and must be supplied on a USB stick if using the netinst CD.

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 the 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 fglrx-driver and fglrx-control packages.

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

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

#!/bin/sh
xrandr --output DFP10 --mode 2560x1600 --pos 0x0 --output DFP11 --rotate left --mode 1920x1200 --pos -1200x-150
. /etc/X11/Xsession

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

Package Repositories

Add the following line to /etc/apt/sources.list to enable the backports repository.

deb http://backports.debian.org/debian-backports squeeze-backports main

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 containing 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.

ZFS File Archive

Obtain latest .deb package for ZFSonLinux and install.

wget http://archive.zfsonlinux.org/debian/pool/main/z/zfsonlinux/zfsonlinux_2%7Ewheezy_all.deb
dpkg -i zfsonlinux_2~wheezy_all.deb
apt-get update
apt-get install debian-zfs

Do modprobe zfs and add “zfs” to /etc/modules so it loads on boot.

Can now use normal ZFS commands to manage existing, or create new zpools.

Remember to add zpool scrubs and status update to cron with delivery to email so you know if a drive develops problems.

Data Partitions

Partition with cfdisk /dev/sda

Use NTFS format for drives that will be shared. If needed, install package ntfs-3g.

Entries in /etc/fstab should be of the form:

UUID=4A0E269F181DD6BB  /mnt/int_share  ntfs    uid=1000,gid=1000,dmask=027,fmask=137,utf8            0       0

UUID can be determined with blkid /dev/sda1.

Use option “noauto” in /etc/fstab for external USB drives otherwise they will give timeout errors as they spin up. The usb automounting will put them in the right place if they have an entry in /etc/fstab.

Dropbox

Download .deb from dropbox.com rather than using the nautilus-dropbox package. After package installation, install the daemon with dropbox start -i. Create the following init script as /etc/init.d/dropbox and install with update-rc.d dropbox defaults

#!/bin/sh
### BEGIN INIT INFO
# Provides: dropbox
# Required-Start: $local_fs $remote_fs $network $syslog $named
# Required-Stop: $local_fs $remote_fs $network $syslog $named
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# X-Interactive: false
# Short-Description: dropbox service
### END INIT INFO
DROPBOX_USERS="ataylor"
DAEMON=.dropbox-dist/dropbox
start() {
   echo "Starting dropbox..."
   for dbuser in $DROPBOX_USERS; do
       HOMEDIR=`getent passwd $dbuser | cut -d: -f6`
       if [ -x $HOMEDIR/$DAEMON ]; then
           HOME="$HOMEDIR" start-stop-daemon -b -o -c $dbuser -S -u $dbuser -x $HOMEDIR/$DAEMON
       fi
   done
}
stop() {
   echo "Stopping dropbox..."
   for dbuser in $DROPBOX_USERS; do
       HOMEDIR=`getent passwd $dbuser | cut -d: -f6`
       if [ -x $HOMEDIR/$DAEMON ]; then
           start-stop-daemon -o -c $dbuser -K -u $dbuser -x $HOMEDIR/$DAEMON
       fi
   done
}
status() {
   for dbuser in $DROPBOX_USERS; do
       dbpid=`pgrep -u $dbuser dropbox`
       if [ -z $dbpid ] ; then
           echo "dropboxd for USER $dbuser: not running."
       else
           echo "dropboxd for USER $dbuser: running (pid $dbpid)"
       fi
   done
}
case "$1" in
   start)
       start
       ;;
   stop)
       stop
       ;;
   restart|reload|force-reload)
       stop
       start
       ;;
   status)
       status
       ;;
   *)
       echo "Usage: /etc/init.d/dropbox {start|stop|reload|force-reload|restart|status}"
       exit 1
esac
exit 0

NFS Server/Client

Server: install portmap and nfs-kernel-server

Client: install portmap and nfs-common

Configure /etc/exports on the server. For example:

/example 192.168.1.0/255.255.255.0(rw,no_root_squash,subtree_check)

Configure /etc/fstab for any filesystems you want to automount at boot.

GUI

X, Fluxbox

Install the following packages:

apt-get install xorg fluxbox

Modify ~/.fluxbox/keys file to change Mouse[4,5] when On[Desktop,Toolbar] to [Prev,Next]Window instead of [Prev,Next]Workspace. Also, add the following key shortcuts:

# open a terminal
Mod1 F1 :Exec xterm
# open a dialog to run programs
Mod1 F2 :Exec fbrun
# Open file manager
Mod1 F3 :Exec nautilus
# Take a screenshot
107 :Exec /home/ataylor/bin/take_screenshot.sh
# volume settings, using common keycodes
# if these don't work, use xev to find out your real keycodes
123 :Exec amixer sset Master,0 1+
122 :Exec amixer sset Master,0 1-
121 :Exec amixer sset Master,0 toggle
# Start screensaver, lock screen
127 :Exec xscreensaver-command -lock
# current window commands
Mod1 F4 :Close
Mod1 F5 :MacroCmd {ResizeTo 1200 950} {Moveto 0 0 UpperLeft}
Mod1 F6 :MacroCmd {ResizeTo 1200 950} {Moveto 0 0 LowerLeft}
Mod1 F7 :MacroCmd {ResizeTo 1250 1600} {Moveto 0 0 UpperLeft}
Mod1 F8 :MacroCmd {ResizeTo 1250 1600} {Moveto 0 0 UpperRight}
Mod1 F9 :Minimize
Mod1 F10 :Maximize
Mod1 F11 :Fullscreen
# Window sizing commands
136 :MacroCmd {ResizeTo 1200 950} {Moveto 0 0 UpperLeft}
137 :MacroCmd {ResizeTo 1200 950} {Moveto 0 0 LowerLeft}
138 :MacroCmd {ResizeTo 1250 1600} {Moveto 0 0 UpperLeft}
139 :MacroCmd {ResizeTo 1250 1600} {Moveto 0 0 UpperRight}
140 :Maximize
141 :Minimize
142 :Fullscreen

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.

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 ~/.xinitrc.

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 ~/.xinitrc as sh /home/ataylor/bin/wallpaper_rotation.sh &

#!/bin/sh
# 
# Automatic wallpaper rotation, multi-monitor aware

CONFIG="$HOME/.config/nitrogen/bg-saved.cfg"

while true; do

rm ${CONFIG}

cat <<CREATECONFIG > ${CONFIG}
[xin_0]
file=$(find  ~/documents/wallpaper/ratio_16_10 -type f | sort -R | tail -1)
mode=0
bgcolor=#000000
[xin_1]
file=$(find  ~/documents/wallpaper/ratio_10_16 -type f | sort -R | tail -1)
mode=0
bgcolor=#000000
CREATECONFIG

nitrogen --restore
sleep 1m
done

Screenshots

Create screenshot directory ~/screenshots.

Write the following to ~/bin/take_screenshot.sh

#!/bin/bash

SAVEDIR="$HOME/documents/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 by creating ~/.Xresources with contents shown below. Afterward, restart X or run xrdb -merge ~/.Xresources.

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

Desktop Applications

Web Browser

Download Chrome .deb directly from Google. Then, dpkg -i chrome.file.deb and apt-get -f install to clear up dependencies. Create symlink in ~/bin for chrome->google-chrome.

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

Install icedtea-plugin.

Email

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

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"

# 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>'

Configure ~/.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 &

Sage

Might want to install mpmath package first. I had problems with Bessel functions when I installed it after Sage. Also, install PDF viewer and LaTeX environment before compiling Sage.

useradd sage
mkdir /home/sage /usr/local/sage /var/log/sage
chown -R sage:sage /home/sage /usr/local/sage /var/log/sage
su sage
cd /usr/local/sage
(download the sage source)
(untar source)
export MAKE="make -j4" (or whatever is appropriate for current machine)
make ("apt-get install build-essential" if necessary)
./sage -upgrade 
./sage
sage: optional_packages()
sage: install_package('openmpi-xxx')   (if needed)
sage: install_package('mpi4py-xxx')    (if needed)
sage: quit
./sage -notebook   (answer onscreen prompts)

Create script /etc/init.d/SGKsage with contents:

#!/bin/bash

### BEGIN INIT INFO
# Provides:          sage
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start daemon at boot time
# Description:       Enable service provided by daemon.
### END INIT INFO

# Aaron Taylor
# Start/Stop init script for sage mathematics program
# Stop method is hacky

# Configuration
SAGE_HOME="/usr/local/sage"
SAGE_OPTS="-notebook"
SAGE_LOG="/var/log/sage"
USER="sage"
NAME="sage"

sage_start() {
        echo "Starting Sage..."
        start-stop-daemon --start --background --chuid "$USER" --chdir "$SAGE_HOME" --exec $SAGE_HOME/sage -- $SAGE_OPTS
}

sage_stop() {
        echo "Stopping Sage..."
        kill `cat "/home/$USER/.sage/sage_notebook.sagenb/sagenb.pid"`
}

case $1 in
        start)
                sage_start
                ;;
        stop)
                sage_stop
                ;;
        restart)
                sage_stop
                sleep 5
                sage_start
                ;;
        *)
                echo "Usage: $0 {start|stop|restart}"
                exit 1
                ;;
esac
exit 0

Then install with an appropriate priority.

chmod +x /etc/init.d/SGKsage
update-rc.d SGKsage defaults 95
/etc/init.d/SGKsage start

Programming IDE

Can use Netbeans from Debian repository but it only works with specific JDK versions. Prefer to install directly from Oracle with Oracle JDK.

Torrent

Install package deluge-gtk.

Set to autorun in ~/.fluxbox/startup.

Configure to autostart torrents from /mnt/downloads/torrent/torrents and to use relevant directories for in-progress and finished torrents.

Install the scheduler plugin and set reasonable limits.

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 nautilus virtualbox-ose cellwriter wine
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

Note: After installing pidgin, do the following to add Steam chat support:

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