Importing some older note files.
[website_subgeniuskitty.com] / data / notes / debian_7.md
CommitLineData
0fb93fcc
AT
1# Overview #
2
3These 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.
4
5# Installation #
6
7## Hardware ##
8
9### ASUS P8H77-I ###
10
11Linux 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.
12
13### SSD Hard Drive ###
14
15Use a TRIM enabled filesystem such as ext4.
16
17Locate 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](http://lifehacker.com/5837769/make-sure-your-partitions-are-correctly-aligned-for-optimal-solid-state-drive-performance lifehacker).
18
19Set AHCI mode in the BIOS.
20
21Install package `hdparm` and check for TRIM support with
22
23 hdparm -I /dev/<your device>
24
25under "Data Set Management TRIM supported".
26
27Create daily TRIM cronjob by creating the following file in `/etc/cron.daily/fstrim` (remember to make it executable)
28
29 #!/bin/sh
30 # Perform manual filesystem TRIM
31 #
32 LOG=/var/log/trim.log
33 echo "*** $(date -R) ***" >> $LOG
34 fstrim -v / >> $LOG
35
36To reduce disk writes, mount the SSD filesystems with the relatime option in `/etc/fstab` to reduce file and directory access time updates.
37
38### USB Automounting ###
39
40Install package `usbmount` and add "ntfs" to valid partition types in `/etc/usbmount/usbmount.conf` so the line reads
41
42 FILESYSTEMS="ntfs vfat ext2 ext3 ext4 hfsplus
43
44### Graphics Drivers ###
45
46Add the `contrib` and `non-free` repositories to `/etc/apt/sources.list` and then install the `fglrx-driver` and `fglrx-control` packages.
47
48As root, execute `aticonfig --initial` to generate an initial Xorg config file.
49
50For my dual head configuration (30" 2560x1600 in landscape and 24" 1920x1200 in portrait) create new file `~/.xinitrc` with the following contents:
51
52 #!/bin/sh
53 xrandr --output DFP10 --mode 2560x1600 --pos 0x0 --output DFP11 --rotate left --mode 1920x1200 --pos -1200x-150
54 . /etc/X11/Xsession
55
56### Audio ###
57
58Install relevant packages and then use `alsamixer` to set audio levels. Later, after fluxbox is installed, can add key bindings for volume control.
59
60 apt-get install libasound2 libasound2-doc alsa-base alsa-utils alsa-oss alsamixergui
61
62### Printer ###
63
64Install packages `cups` and `cups-client`.
65
66 /etc/init.d/cups start
67 usermod -a -G lpadmin ataylor
68
69In a browser, visit [http://localhost:631](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.
70
71### Scanner ###
72
73Install relevant packages:
74
75 apt-get install xsane sane sane-utils xsltproc libtiff-tools
76
77Download Epson ImageScan software and install
78
79 dpkg -i iscan-data_1.22.0-1_all.deb
80 dpkg -i iscan_2.29.1-5~usb0.1.ltdl7_amd64.deb
81 dpkg -i iscan-plugin-gt-x770_2.1.2-1_amd64.deb
82
83## Basic Services ##
84
85### Package Repositories ###
86
87Add the following line to `/etc/apt/sources.list` to enable the backports repository.
88
89 deb http://backports.debian.org/debian-backports squeeze-backports main
90
91### Install basic packages ###
92
93 apt-get install openssh-server bzip2 zip
94
95### Email Forwarding ###
96
97The 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.
98
99Create file `~/.forward` containing destination email address.
100
101Check `/etc/aliases` to make sure system/daemon users are routed the way you want.
102
103### NTP Configuration ###
104
105Install package `ntp` and check servers with `ntpq -p`. Default configuration should cause daemon to start at boot and sync automatically.
106
107### ZFS File Archive ###
108
109Obtain latest .deb package for ZFSonLinux and install.
110
111 wget http://archive.zfsonlinux.org/debian/pool/main/z/zfsonlinux/zfsonlinux_2%7Ewheezy_all.deb
112 dpkg -i zfsonlinux_2~wheezy_all.deb
113 apt-get update
114 apt-get install debian-zfs
115
116Do `modprobe zfs` and add "zfs" to `/etc/modules` so it loads on boot.
117
118Can now use normal ZFS commands to manage existing, or create new zpools.
119
120Remember to add zpool scrubs and status update to cron with delivery to email so you know if a drive develops problems.
121
122### Data Partitions ###
123
124Partition with `cfdisk /dev/sda`
125
126Use NTFS format for drives that will be shared. If needed, install package `ntfs-3g`.
127
128Entries in `/etc/fstab` should be of the form:
129
130 UUID=4A0E269F181DD6BB /mnt/int_share ntfs uid=1000,gid=1000,dmask=027,fmask=137,utf8 0 0
131
132UUID can be determined with `blkid /dev/sda1`.
133
134Use 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`.
135
136### Dropbox ###
137
138Download .deb from [dropbox.com](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`
139
140 #!/bin/sh
141 ### BEGIN INIT INFO
142 # Provides: dropbox
143 # Required-Start: $local_fs $remote_fs $network $syslog $named
144 # Required-Stop: $local_fs $remote_fs $network $syslog $named
145 # Default-Start: 2 3 4 5
146 # Default-Stop: 0 1 6
147 # X-Interactive: false
148 # Short-Description: dropbox service
149 ### END INIT INFO
150 DROPBOX_USERS="ataylor"
151 DAEMON=.dropbox-dist/dropbox
152 start() {
153 echo "Starting dropbox..."
154 for dbuser in $DROPBOX_USERS; do
155 HOMEDIR=`getent passwd $dbuser | cut -d: -f6`
156 if [ -x $HOMEDIR/$DAEMON ]; then
157 HOME="$HOMEDIR" start-stop-daemon -b -o -c $dbuser -S -u $dbuser -x $HOMEDIR/$DAEMON
158 fi
159 done
160 }
161 stop() {
162 echo "Stopping dropbox..."
163 for dbuser in $DROPBOX_USERS; do
164 HOMEDIR=`getent passwd $dbuser | cut -d: -f6`
165 if [ -x $HOMEDIR/$DAEMON ]; then
166 start-stop-daemon -o -c $dbuser -K -u $dbuser -x $HOMEDIR/$DAEMON
167 fi
168 done
169 }
170 status() {
171 for dbuser in $DROPBOX_USERS; do
172 dbpid=`pgrep -u $dbuser dropbox`
173 if [ -z $dbpid ] ; then
174 echo "dropboxd for USER $dbuser: not running."
175 else
176 echo "dropboxd for USER $dbuser: running (pid $dbpid)"
177 fi
178 done
179 }
180 case "$1" in
181 start)
182 start
183 ;;
184 stop)
185 stop
186 ;;
187 restart|reload|force-reload)
188 stop
189 start
190 ;;
191 status)
192 status
193 ;;
194 *)
195 echo "Usage: /etc/init.d/dropbox {start|stop|reload|force-reload|restart|status}"
196 exit 1
197 esac
198 exit 0
199
200### NFS Server/Client ###
201
202Server: install `portmap` and `nfs-kernel-server`
203
204Client: install `portmap` and `nfs-common`
205
206Configure `/etc/exports` on the server. For example:
207
208 /example 192.168.1.0/255.255.255.0(rw,no_root_squash,subtree_check)
209
210Configure `/etc/fstab` for any filesystems you want to automount at boot.
211
212## GUI ##
213
214### X, Fluxbox ###
215
216Install the following packages:
217
218 apt-get install xorg fluxbox
219
220Modify `~/.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:
221
222 # open a terminal
223 Mod1 F1 :Exec xterm
224 # open a dialog to run programs
225 Mod1 F2 :Exec fbrun
226 # Open file manager
227 Mod1 F3 :Exec nautilus
228 # Take a screenshot
229 107 :Exec /home/ataylor/bin/take_screenshot.sh
230 # volume settings, using common keycodes
231 # if these don't work, use xev to find out your real keycodes
232 123 :Exec amixer sset Master,0 1+
233 122 :Exec amixer sset Master,0 1-
234 121 :Exec amixer sset Master,0 toggle
235 # Start screensaver, lock screen
236 127 :Exec xscreensaver-command -lock
237 # current window commands
238 Mod1 F4 :Close
239 Mod1 F5 :MacroCmd {ResizeTo 1200 950} {Moveto 0 0 UpperLeft}
240 Mod1 F6 :MacroCmd {ResizeTo 1200 950} {Moveto 0 0 LowerLeft}
241 Mod1 F7 :MacroCmd {ResizeTo 1250 1600} {Moveto 0 0 UpperLeft}
242 Mod1 F8 :MacroCmd {ResizeTo 1250 1600} {Moveto 0 0 UpperRight}
243 Mod1 F9 :Minimize
244 Mod1 F10 :Maximize
245 Mod1 F11 :Fullscreen
246 # Window sizing commands
247 136 :MacroCmd {ResizeTo 1200 950} {Moveto 0 0 UpperLeft}
248 137 :MacroCmd {ResizeTo 1200 950} {Moveto 0 0 LowerLeft}
249 138 :MacroCmd {ResizeTo 1250 1600} {Moveto 0 0 UpperLeft}
250 139 :MacroCmd {ResizeTo 1250 1600} {Moveto 0 0 UpperRight}
251 140 :Maximize
252 141 :Minimize
253 142 :Fullscreen
254
255Use "meta" style in fluxbox
256
257Install `numlockx` package and add `numlockx &` to `~/.fluxbox/startup`
258
259Ensure `~/.xinitrc` ends in `. /etc/X11/Xsession` if the file doesn't already exist.
260
261Add any apps that I want to autostart in `~/.fluxbox/startup` (pidgin, deluge-gtk, etc)
262
263Set "focus on mouse" and NOT "raise on focus" in the right-click menu.
264
265### Screensaver ###
266
267Install the following packages:
268
269 xscreensaver xscreensaver-gl xscreensaver-gl-extra xscreensaver-screensaver-bsod xscreensaver-screensaver-webcollage
270
271Execute `xscreensaver-demo` to configure the screensaver.
272
273Add `xscreensaver -nosplash &` to `~/.xinitrc`.
274
275### Wallpaper Rotation ###
276
277Install `nitrogen` package. Execute `nitrogen` once and set wallpaper manually to create initial config files.
278
279Create file `~/bin/wallpaper_rotation.sh` as shown below and add to `~/.xinitrc` as `sh /home/ataylor/bin/wallpaper_rotation.sh &`
280
281 #!/bin/sh
282 #
283 # Automatic wallpaper rotation, multi-monitor aware
284
285 CONFIG="$HOME/.config/nitrogen/bg-saved.cfg"
286
287 while true; do
288
289 rm ${CONFIG}
290
291 cat <<CREATECONFIG > ${CONFIG}
292 [xin_0]
293 file=$(find ~/documents/wallpaper/ratio_16_10 -type f | sort -R | tail -1)
294 mode=0
295 bgcolor=#000000
296 [xin_1]
297 file=$(find ~/documents/wallpaper/ratio_10_16 -type f | sort -R | tail -1)
298 mode=0
299 bgcolor=#000000
300 CREATECONFIG
301
302 nitrogen --restore
303 sleep 1m
304 done
305
306### Screenshots ###
307
308Create screenshot directory `~/screenshots`.
309
310Write the following to `~/bin/take_screenshot.sh`
311
312 #!/bin/bash
313
314 SAVEDIR="$HOME/documents/screenshots"
315 DATE=`date +%Y%m%d-%T`
316
317 if [! -d ${SAVEDIR} ]
318 then
319 mkdir -p {$SAVEDIR}
320 fi
321
322 xwd | xwdtopnm | pnmtopng > "${SAVEDIR}"/"${DATE}".png
323
324Update `~/.fluxbox/keys` with line `107 :Exec /home/ataylor/documents/screenshots/take_screenshot.sh` or use `xev` to select a different key.
325
326### xterm ###
327
328Set xterm fonts by creating `~/.Xresources` with contents shown below. Afterward, restart X or run `xrdb -merge ~/.Xresources`.
329
330 xterm*faceName: Liberaqtion Mono:size=12:antialias=true
331 xterm*font: 7x13
332
333## Desktop Applications ##
334
335### Web Browser ###
336
337Download 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`.
338
339Install `iceweasel` package with plugins: Adblock Plus, NoScript, Image Zoom, Save Image in Folder, Thumbnail Zoom Plus, Enhanced Steam.
340
341Install `icedtea-plugin`.
342
343### Email ###
344
345Install package `mutt-patched` since it includes the sidebar-folder-path.
346
347Configure `~/.muttrc`
348
349 # .muttrc configuration file
350
351 # General Configuration
352 set editor='vim'
353 set imap_check_subscribed=yes
354 set print_cmd="muttprint"
355 set print_split
356 set certificate_file=".mutt_certs"
357
358 # Sidebar
359 set sidebar_width=20
360 set sidebar_visible=yes
361 set sidebar_sort=yes
362
363 # View URLs inside mutt
364 macro index \cd "|urlview\n"
365 macro pager \cd "|urlview\n"
366
367 # Handle HTML emails
368 auto_view text/html
369 alternative_order text/plain text/enriched text/html
370
371 ### Account: ataylor@subgeniuskitty.com
372 source "~/.mutt/ataylor_subgeniuskitty_com"
373 folder-hook 'imaps://ataylor\@subgeniuskitty.com@mail.subgeniuskitty.com:993' 'source ~/.mutt/ataylor_subgeniuskitty_com'
374
375 # Macros to handle multiple accounts
376 macro index <f2> '<sync-mailbox><enter-command>source ~/.mutt/ataylor_subgeniuskitty_com<enter><change-folder>!<enter>'
377
378Configure `~/.mutt/ataylor_subgeniuskitty_com`
379
380 # Read from IMAP server
381 set imap_user="ataylor@subgeniuskitty.com"
382 set imap_pass="pass"
383 set folder="imaps://ataylor\@subgeniuskitty.com@mail.subgeniuskitty.com:993"
384 set spoolfile="+INBOX"
385
386 # Send through SMTP server
387 set smtp_url="smtps://ataylor\@subgeniuskitty.com@mail.subgeniuskitty.com:465"
388 set smtp_pass="pass"
389 set from="ataylor@subgeniuskitty.com"
390 set realname="Aaron Taylor"
391 set postponed="=Drafts"
392 set record="=Sent"
393
394 # Account Hook -- Important
395 account-hook $folder "set imap_user=ataylor@subgeniuskitty.com imap_pass=pass"
396
397Install package `elinks` and add following line to `~/.mailcap`.
398
399 text/html; elinks -dump %s ; copiousoutput
400
401Install packages `muttprint` and `ospics`, and create `~/.muttprintrc` file with contents shown below.
402
403 # Muttprint Configuration File
404
405 PRINT_COMMAND="lp"
406 PENGUIN=/usr/share/ospics/Debian_color.eps
407
408Install package `urlview`
409
410### IRC ###
411
412Install package `irssi` and add relevant nick/pass/channel/server for autostart with
413
414 /server add -auto -network freenode chat.freenode.net 6667 <password>
415 /network add -nick <nickname> freenode
416 /channel add -auto #hoggit freenode
417
418Cut down on the chatter
419
420 /ignore * JOINS QUITS PARTS
421
422Enable autologging and quasi-rotation by making log dir and setting ownership. Then, in irssi,
423
424 /set autolog_path /path/to/logdir/$tag/$0.%Y%m%d.log
425 /set autolog on
426 /save
427
428Add the following scripts to `~/.irssi/scripts` and symlink to `~/.irssi/scripts/autostart`:
429
430 adv_windowlist
431 nickcolor
432 trackbar
433
434Add to `~/.xinitrc` but for some reason, must manually specify xterm colors otherwise they default to black text on white background rather than system defaults.
435
436 xterm -fg AliceBlue -bg Black irssi &
437
438### Sage ###
439
440Might 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.
441
442 useradd sage
443 mkdir /home/sage /usr/local/sage /var/log/sage
444 chown -R sage:sage /home/sage /usr/local/sage /var/log/sage
445 su sage
446 cd /usr/local/sage
447 (download the sage source)
448 (untar source)
449 export MAKE="make -j4" (or whatever is appropriate for current machine)
450 make ("apt-get install build-essential" if necessary)
451 ./sage -upgrade
452 ./sage
453 sage: optional_packages()
454 sage: install_package('openmpi-xxx') (if needed)
455 sage: install_package('mpi4py-xxx') (if needed)
456 sage: quit
457 ./sage -notebook (answer onscreen prompts)
458
459Create script `/etc/init.d/SGKsage` with contents:
460
461 #!/bin/bash
462
463 ### BEGIN INIT INFO
464 # Provides: sage
465 # Required-Start: $remote_fs $syslog
466 # Required-Stop: $remote_fs $syslog
467 # Default-Start: 2 3 4 5
468 # Default-Stop: 0 1 6
469 # Short-Description: Start daemon at boot time
470 # Description: Enable service provided by daemon.
471 ### END INIT INFO
472
473 # Aaron Taylor
474 # Start/Stop init script for sage mathematics program
475 # Stop method is hacky
476
477 # Configuration
478 SAGE_HOME="/usr/local/sage"
479 SAGE_OPTS="-notebook"
480 SAGE_LOG="/var/log/sage"
481 USER="sage"
482 NAME="sage"
483
484 sage_start() {
485 echo "Starting Sage..."
486 start-stop-daemon --start --background --chuid "$USER" --chdir "$SAGE_HOME" --exec $SAGE_HOME/sage -- $SAGE_OPTS
487 }
488
489 sage_stop() {
490 echo "Stopping Sage..."
491 kill `cat "/home/$USER/.sage/sage_notebook.sagenb/sagenb.pid"`
492 }
493
494 case $1 in
495 start)
496 sage_start
497 ;;
498 stop)
499 sage_stop
500 ;;
501 restart)
502 sage_stop
503 sleep 5
504 sage_start
505 ;;
506 *)
507 echo "Usage: $0 {start|stop|restart}"
508 exit 1
509 ;;
510 esac
511 exit 0
512
513Then install with an appropriate priority.
514
515 chmod +x /etc/init.d/SGKsage
516 update-rc.d SGKsage defaults 95
517 /etc/init.d/SGKsage start
518
519### Programming IDE ###
520
521Can use Netbeans from Debian repository but it only works with specific JDK versions. Prefer to install directly from Oracle with Oracle JDK.
522
523### Torrent ###
524
525Install package `deluge-gtk`.
526
527Set to autorun in `~/.fluxbox/startup`.
528
529Configure to autostart torrents from `/mnt/downloads/torrent/torrents` and to use relevant directories for in-progress and finished torrents.
530
531Install the scheduler plugin and set reasonable limits.
532
533### Misc Software ###
534
535A list of misc packages in the Debian repository to install.
536
537 Text Editor - vim vim-gtk vim-addon-manager
538 Science/Data - texlive texlive-science texlive-math-extra gnuplot scilab octave dx python-scitools paraview
539 Document Viewers - okular okular-extra-backends
540 Communication - pidgin
541 Office Suite - libreoffice gnumeric abiword scribus
542 System Tools - dvd+rw-tools nautilus virtualbox-ose cellwriter wine
543 Graphics - gimp rawtherapee inkscape geeqie
544 Media - vlc browser-plugin-vlc quodlibet ffmpeg
545 Programming - valgrind libgmp-dev libplot-dev plotutils glade libncurses5-dev libmysqlclient-dev
546 Misc - kicad golly
547
548Note: After installing `pidgin`, do the following to add Steam chat support:
549
550* Install the build dependencies via `apt-get build-dep pidgin`. This should grab all the required dependencies. If it doesn't grab `libnss3-dev`, `libnspr4-dev` and `libjson-glib-dev`, manually install those packages.
551* Manually install `libgnome-keyring-dev` package.
552* Download the [pidgin-opensteamworks plugin source](http://code.google.com/p/pidgin-opensteamworks/). Compile with `make libsteam.so`.
553* Copy the library to `~/.purple/plugins` (create if necessary).
554* Download the pixmaps and place in `/usr/share/pixmaps/pidgin/protocols`
555* Files:
556 * [pixmaps](debian_7.files/Pidgin-opensteamworks_pixmaps.zip)
557 * [source code](debian_7.files/Steam-mobile-1.4.tar.gz)
558
559# Misc #
560
561## Sun Microsystems Keyboard Codes ##
562
563 name sun code sun name usb code usb name alternative alt USB code alt windows vkey
564
565 help 0x76 lf(16) 0x75 help f13 0x68 124
566 stop 0x01 buckybits+systembit 0x78 stop f14 0x69 125
567 again 0x03 lf(2) 0x79 again f15 0x6A 126
568 props 0x19 lf(3) 0x76 keyboard menu f16 0x6B 127
569 undo 0x1A lf(4) 0x7A undo f17 0x6C 128
570 front 0x31 lf(5) 0x77 select f18 0x6D 129
571 copy 0x33 lf(6) 0x7C copy f19 0x6E 130
572 open 0x48 lf(7) 0x74 execute f20 0x6F 131
573 paste 0x49 lf(8) 0x7D paste f21 0x70 132
574 find 0x5F lf(9) 0x7E find f22 0x71 133
575 cut 0x61 lf(10) 0x7B cut f23 0x72 134
576
577 mute 0x2D rf(4) 0x7F mute f24 0x73 135
578 vol down 0x02 - 0x81 volume down intl'1 0x87 193
579 vol up 0x04 - 0x80 volume up intl'6 0x8C 234
580 power 0x30 bf(13) 0x66 keyboard power* - - -
581
582 compose 0x43 COMPOSE 0x65 app right gui
583 left meta 0x78 BUCKYBITS+METABIT 0xE3 left gui left alt
584 right meta 0x7A BUCKYBITS+METABIT 0xE7 right gui right alt
585 escape** 0x1D ESC 0x29 escape tilde
586 tilde** 0x2A ` 0x35 tilde escape
587 caps lock** 0x77 SHIFTKEYS+CAPSLOCK 0x39 caps lock control
588 control** 0x4C SHIFTKEYS+LEFTCTRL 0xE0 control caps lock
589 alt 0x13 SHIFTKEYS+ALT 0xE2 left alt left gui
590 alt graph 0x0D - 0xE6 right alt right control
591
592## Keyboard Shortcuts: mutt ##
593
594 D ~A - Delete all in folder
595 $ - Purge
596 c - Change folder
597 T ~A - Tag all in folder
598 ;s - Save all tagged messages
599 Ctrl-B - Show URLs
600
601## Burning CD/DVD ##
602
603Create ISO from filesystem(maximizing compatiblity with long filenames):
604
605 genisoimage -r -J -l -d -joliet-long -allow-multidot -V undergrad_files -o target.iso /path/to/source/directory
606
607For DVD ISO burning:
608
609 growisofs -dvd-compat -Z /dev/sro=name.of.iso
610
611For CD ISO burning:
612
613 wodim -v -sao dev=/dev/sr0 name.of.iso
614
615## Multipage PDFs ##
616
617First scan and get everything ready as TIFFs
618
619 tiffcp scan_???.tiff multipage.tiff
620 tiff2pdf -j -o output.pdf multipage.tiff