tips-computer-fujitsuT580-hardwareIndependent

Favorite Ubuntu desktop preferences and applications configuration HOWTO


Desktop configuration

window manager prefs

Note: some of this may be a waste of time, see http://askubuntu.com/questions/28538/will-gnome-2-aka-ubuntu-classic-desktop-continue-to-be-developed-after-11-04

After installing compizconfig-settings-manager, run it and go to General->General Settings->Desktop Size and set Horizontal Virtual Size to 5 and Vertical Virtual Size to 2. In Desktop->Desktop Wall->Viewpoint Switch Preview, deselect Show Viewport Switcher Preview. In Viewport Switching, set Wall Sliding Duration to 0 and Allow Wrap-Around. In Edge Flipping, select both of Move, Dnd (drag and drop). I left Pointer Edge Flipping disabled, it was too hard for me to avoid edge flipping while i was scrolling.

Disable the Fading Windows and the Animations plugins.

In Preferencs->Keyboard Shortcuts, set Switch to Workspace N to Ctrl-N for N from 1-10

Preferences->Appearance, change Theme to Clearlooks

In a Gnome Terminal, Edit->Profile Preferences->Colors, uncheck Use colors from system theme, select White on Black

I'd like to have a clean, readable, cheerful theme that has all text areas by default use white on black, but i can't find one. the popular ones that do this seem to try to be goth/edgy/stylish rather than clean and easy to read. i'm sure there is one somewhere though. If you want to look around, maybe these sites have stuff: http://art.gnome.org/themes/, http://gnome-look.org/index.php?xcontentmode=100 (selecting GTK 2.x?), https://help.ubuntu.com/community/UbuntuEyeCandy .

Install "desktopnova" (sudo apt-get install desktopnova) and add the wallpapers folder using "add folder", then in Settings, "Change wallpaper every launch", "Launch daemon every session", click Modules, enable the Gnome 0.2 module.

Rightclick on desktop, "change desktop background", set to "scale" and set background color to black (#000000)

Preferences->Windows->Select windows as mouse moves over them, raise automatically with a delay of 2 seconds

In a Gnome terminal, go to Edit->keyboard shortcuts, select Help->Contents (by default bound to F1), and type backspace to unbind it. I do this because some applications (notably mutt) offer their own help when you press F1.

In a Gnome terminal, go to Edit->Profile Preferences->Scrolling, change scrollback to 100000 lines. Go to Edit->Profile Preferences->General, uncheck "Use the system fixed width font", and increase the font size (i use 13 instead of 12).

Programs that automatically appear at startup

Note that session saving is being removed from Ubuntu 11.04 (natty) (see https://bugs.launchpad.net/unity/+bug/726431 ), so there's not much point bothering to configure it. I think this is a shame because session saving provided a convenient way for me to place various application on various virtual workspaces (I like to have Firefox, an emacs server, and 5 shells each in a separate virtual workspace, each maximized), save that configuration, and then have it appear at each startup. This can be done using devilspie (possibly in conjunction with the gdevilspie GUI frontend to devilspie), but it's more of a pain and probably difficult for non-experts to understand. Nevertheless, that's what I did.

First, I used Preferences->Startup Applications to configure a list of applications that I want to start automatically:

Here are the entries in my .devilspie. Some notes on using devilspie with compiz (the default Ubuntu window manager): (a) you have to use "set_viewport" instead of "set_workspace" (thanks to [1] (b) you can only place windows on viewports in the first row (i.e highest vertical position) (see https://bugs.launchpad.net/ubuntu/+source/devilspie/+bug/380880 ).

Compiz's Place Windows can't be used instead of Devilspie because Compiz doesnt seem to Place Windows that are opened in Starting Applications ( https://bugs.launchpad.net/ubuntu/+source/ubuntu-meta/+bug/727098 ).

keyboard

Preferences->Keyboard->Accessibility, check Simulate simultaneous keypresses, uncheck Disable stick keys if two keys are pressed together.

my modified Colemak layout

I use a variant of the Colemak keyboard layout, an alternative to QWERTY that seems to me to be both more ergonomic and more efficen. Although I recommend it, I'm guessing that most readers won't want to switch their keyboard layout and most of the remainder will want to just use standard Colemak, so most people will want to skip this subsection.

Preferences->Keyboard->Layoutsm Add.., by language, English, USA Colemak. Move Up, select the old default layout and Remove the default layout. Options..., CapsLock? key behavior, Make CapsLock? an additional ESC. Key to choose 3rd level, none (deselect all)

To swap parentheses and braces, put the following in your .Xmodmap (thanks [2] -- i had had this idea independently, but e supplied the xmodmap recipe) (i put it in .xmodmap instead of .Xmodmap, it worked):

keysym bracketleft = parenleft braceleft
keysym bracketright = parenright braceright
keysym 9 = 9 bracketleft
keysym 0 = 0 bracketright

Next time you login, you'll get Gnome's "Load modmap files" dialog. Move .Xmodmap to the Load side, then exit the dialog, leaving the don't-show-this-again box checked.

Passwords

To remove the need to enter your password in order to connect to wireless network, Preferences->Passwords and Encryption keys, first tab (Passwords). Right click on the entry "Passwords: login", select Change Password, and change it to blank. There is an insecurity warning for you to accept. (thanks to [3])

To remove the need to login at boot, Administration -> Login Screen Settings, unlock it, and enable Log in as ____ automatically (thanks to [4])

To make the screen stop prompting for a password upon resume from suspend:

gconftool-2 --type boolean -s /apps/gnome-power-manager/lock/use_screensaver_settings false
gconftool-2 --type boolean -s /apps/gnome-power-manager/lock/hibernate false
gconftool-2 --type boolean -s /apps/gnome-power-manager/lock/suspend false
gconftool-2 --type boolean -s /desktop/gnome/lockdown/disable_lock_screen true

power management

System -> Preferences -> Power management

On AC Power tab:

On Battery Power tab:

(thanks to [5])


Favorite applications

Install a bunch of programs i like

sudo apt-get install aptitude sudo aptitude install emacs unison ipython wmctrl xkbset iotop devilspie mutt compizconfig-settings-manager desktopnova libgetopt-declare-perl texlive-full xpdf mercurial git subversion cvs bzr ack-grep python-scipy octave python-matplotlib qiv python-setuptools ssh offlineimap postfix mutt-patched skype atop gnupg urlview acpidump iptraf xournal python-mode graphviz python-virtualenv gimp vlc-nox gstreamer0.10-plugins-ugly gstreamer0.10-plugins-ugly-multiverse gstreamer0.10-plugins-ugly-multiverse gstreamer0.10-plugins-bad gstreamer0.10-plugins-bad-multiverse gstreamer0.10-ffmpeg gv

notes:


Firefox 4

sudo add-apt-repository ppa:ubuntu-mozilla-daily/ppa && sudo apt-get update
sudo apt-get install firefox-4.0

now it's in applications/internet/minefield

Now, what i actually did was a little different. I temporarily enabled the natty repos in /etc/apt/sources.list (by adding the line "deb http://us.archive.ubuntu.com/ubuntu/ maverick main restricted"), then i ran "sudo aptitude update; sudo aptitude install firefox" to upgrade Ubuntu's primary Firebox to a 4.0 beta. Then i took out the line that i had added to /etc/apt/sources.list and ran "sudo aptitude update" again, to prevent any other natty packages from being installed in the future. But I don't recommend doing that unless you know what you're doing.

syncing

Go to about:config

Type in services.sync.log.appender.debugLog.enabled (case matters!)

Set it to true

Restart Firefox

This will allow you to monitor your initial sync so that you know when it is done.

Now do Tools->Set up sync

After your initial sync is successful, go back to about:config and set services.sync.log.appender.debugLog.enabled to false again.

addons

Install add-on compatibility reporter if you want to use the old, "incompatible" versions of addons with a newer firefox. Currently I use this to be able to use Delicious.

I listed the addons I like here: https://addons.mozilla.org/en-US/firefox/collections/bayle-shanks/bshanks/ . Other firefox tips are here: http://bayleshanks.com/tips-computer-firefox


Email (mutt + postfix + offlineimap + gmail)

offlineimap

sudo aptitude install offlineimap

for syncing email with an IMAP server -- i use gmail.

here's my .offlineimap. I did mkdir -p Mail Mail/mygmail to get the directory ready for offlineimap.

To add a cron job that calls offlineimap every 3 mintues, I did crontab -e and then added this line:

*/3 * * * * offlineimap -o -u Noninteractive.Quiet

note: to import an existing Maildir folder into Gmail with this setup, you must not only move it into the mygmail folder, but you must also create a matching label with "create new label" in the Gmail web interface, and then sync. Everytime you create a new folder in mutt, you must do the same thing; "create new label" in the Gmail web interface.

postfix

for sending email to an SMTP server -- i use gmail. postfix will also queue up email and i believe it will automatically send it later if you are offline when you try to send it.

sudo aptitude install postfix

in the configuration questions that come up, i left the defaults, except for:

steps from ubuntu tutorials

i used this method to configure it so that it will send using different gmail accounts depending on what the "from:" address is in the message i'm sending: http://ubuntu-tutorials.com/2009/03/13/configure-postfix-for-multiple-isp-client-smtp-authentication/ and http://ubuntu-tutorials.com/2008/11/11/relaying-postfix-smtp-via-smtpgmailcom/

sudo aptitude install postfix libsasl2 ca-certificate libsasl2-modules

here's my /etc/postfix/main.cf, with some lines that i don't want to post publically changed to OMITTED:

# See /usr/share/postfix/main.cf.dist for a commented, more complete version


# Debian specific:  Specifying a file name will cause the first
# line of that file to be used as the name.  The Debian default
# is /etc/mailname.
#myorigin = /etc/mailname

smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no

# appending .domain is the MUA's job.
append_dot_mydomain = no

# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h

readme_directory = no

# TLS parameters
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
smtpd_use_tls=yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.

myhostname = OMITTED
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = OMITTED
relayhost = smtp.gmail.com
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
inet_protocols = all

## custom begin
smtp_sender_dependent_authentication = yes
smtp_sasl_auth_enable = yes
relayhost = [smtp.gmail.com]:587


smtp_sasl_password_maps = hash:/etc/postfix/passwd
sender_dependent_relayhost_maps = hash:/etc/postfix/relayhost_map


smtp_sasl_security_options = noanonymous
smtp_tls_CAfile = /etc/postfix/cacert.pem
smtp_use_tls = yes

# the default is resource, software
# adding 2bounce means that mail that is
# undeliverable and that cannot be returned to
# sender will be send to the postmaster
notify_classes = resource, software, 2bounce

# deliver local mail to ~/Mail maildirs
home_mailbox = Mail/local/

i created a file /etc/postfix/passwd that looks like:

# Per-sender authentication
user1@server1.com user1@server1.com:SecretP@ssw0rd1
user1@server2.com user2@server2.com:SecretP@ssw0rd2
user1@server3.com user2@server3.com:SecretP@ssw0rd3

# Login for the default relayhost
[smtp.gmail.com]:587 GMAIL_USERNAME_TO_BE_USED_BY_DEFAULT:SecretP@ssw0rdDefault

secure and hash passwd by doing:

chmod 400 /etc/postfix/passwd
postmap /etc/postfix/passwd
postmap /etc/postfix/relayhost_map

(did i forgot to specify /etc/postfix/relayhost_map here? mb you need to do that too..)

import the thawte certificate by doing:

cat /etc/ssl/certs/Thawte_Premium_Server_CA.pem | sudo tee -a /etc/postfix/cacert.pem
/etc/init.d/postfix reload

i dunno if this is necessary, but i also edited /etc/aliases to alias postmaster to my user account, and then ran postalias /etc/aliases

link my ~/Mail/local to my Gmail inbox so that i actually see the mails delivered to postmaster or root:\

cd ~/Mail; ln -s bsgmail/INBOX/ local

Now do sudo /etc/init.d/postfix reload

TLS certificate notes

note: there are TLS cert warnings b/c Google's TLS cert doesn't match what we gave it ("Mar 4 02:17:38 bshanks postfix/smtp[19962]: certificate verification failed for smtp.gmail.com[72.14.213.109]:587: untrusted issuer /C=US/O=Equifax/OU=Equifax Secure Certificate Authority"). the mail still seems to go thru. i think this is because we setup a thawte certificate, and now google uses equifax.

if you wanna do the certs the right way, i guess you have to do: http://www.marksanborn.net/linux/send-mail-postfix-through-gmails-smtp-on-a-ubuntu-lts-server/

further reading about postfix

note: to see what is in postfix's outgoing mail queue, run postqueue -p. To flush the queue, postqueue -f.

see also http://www.postfix.org/SOHO_README.html

if you wanna understand postfix, here's a picture: https://help.ubuntu.com/community/PostfixBasicSetupHowto

mutt (the client program for actually reading and sending email

sudo aptitude install mutt-patched wmctrl

heres's my .muttrc. (todo: add non-private files from my .muttrc.d directory)

touch .muttrc-local .muttrc-local-pre # required for my .muttrc

it calls myemacsclient, which calls myemacsclient_graphical, which uses wmctrl to switch to compiz viewport 2 (where i keep my emacsserver running) and then calls emacsclient.

i also put this in my .emacs (i use viper via viperre):

" (defun my-mutt-buffer-init () (text-mode) (auto-fill-mode) (viper-change-state-to-insert) (forward-paragraph) (next-line) )

(add-to-list 'auto-mode-alist '("/tmp/mutt-*" . my-mutt-buffer-init)) "

(thanks to [6], [7], [8], [9], [10], [11], [12])

http://www.clasohm.com/blog/one-entry?entry_id=90957 tells you how to use gnome-keyring to store the offlineimap passwords, encrypted. sudo apt-get install python-gnomekeyring. startup applications: /usr/bin/gnome-keyring-daemon (with no args; the existing entry isn't good enough). doesn't work for me, though, at least not running from cron.


Skype

Administration->Update Manager, go into Settings, Other Software tab, and enable the Canonical Partners tab. Agree to reload. Now sudo apt-get install skype.

works ok, no configuration needed, but at nighttime, the picture from the webcam is dark, much darker than with "cheese". see bug https://jira.skype.com/browse/SCL-566?focusedCommentId=46099 .


Emacs

heres's my .emacs.

touch .emacs-local #required for my .emacs

todo: put up the rest of my .emacs.d


.bashrc

heres's my .bashrc.

touch .bashrc-local #required for my .bashrc

todo: check out bashrc ubuntu default


other things i copied from my previous computer

for my own reference

if i am doing traffic shaping, remember to do 'tc qdisc del dev eth1 ingress' and 'tc qdisc del dev eth1 root' first so that you get full LAN bandwidth.

i used unison to sync the "l2" profile.

and used scp to copy:


Other applications

xpdf

here's my .xpdfrc

screen

here's my .screenrc

vpn

copy /usr/sbin/vpnc* and /etc/vpnc from old computer

stuff that probably really is just for me

Link my running instance of EasyLatex to my development instance:

ln -s prog/easylatex/easylatex/easylatex .easylatex

Install WikiGateway:

sudo aptitude install python-setuptools python-feedparser python-mechanize # required by wikigateway
cd prog/wikigateway/libraries/pythonModule/
python setup.py install

Sysadmin-y stuff

sshd

sudo apt-get install ssh

in /etc/ssh/sshd_config add :

Port xxxx [where xxxx is a port that the router sends to my computer]

(thanks to [13])

pdnsd

sudo aptitude install pdnsd

edit /usr/share/pdnsd/pdnsd-resolvconf.conf appropriately

security

todo (logcheck, tiger, snort, etc)

throttling and traffic shaping

copy mytc to /usr/local/sbin/mytc.

Now do

sudo chmod u+x /usr/local/sbin/mytc
sudo ln -s /usr/local/sbin/mytc /etc/init.d/
sudo update-rc.d mytc defaults

Note: you must edit /usr/local/sbin/mytc and make sure that the three parameters on top, INTERFACES, UPLINK, and DOWNLINK, are appropriate. You must speed test your connecting and then set UPLINK and DOWNLINK to something slower than your max speed.

The README in the comments in /usr/local/sbin/mytc tells you what mytc does.

never force fsck

By default, Ubuntu forces a fsck every 34 boots. To stop this:

sudo tune2fs -c -1 /dev/sda1

Now you should run fsck manually every now and then when you have some time. I think this command will reboot and then run fsck, haven't tried it yet though:

shutdown -rF now

Performance improvements

preload

sudo aptitude install preload

in /etc/preload.conf : mapprefix = /usr/;/lib;/var/cache/;/home;!/

not sure if preload is useful on Ubuntu since it has its own preload-y stuff. i use it because i'm guessing that the built-in stuff doesn't handle desktop applications, but i'm not sure.

(thanks to [14])

enable some sysadmin menus

" The Software Sources have been hidden in the menu Ubuntu 10.10 You can enable them again by doing the following

mount /tmp on tmpfs

Apparently tmpfs is like a ramdisk, but if you run out of physical memory, it can use swap, too.

in /etc/fstab:

tmpfs           /tmp            tmpfs   defaults,noatime,mode=1777,size=12G      0       0

i tried to set /dev/shm to be bigger too using /etc/default/tmpfs but it didn't seem to do anything:

sudo vi /etc/default/tmpfs :

SHM_SIZE=15032385536      # 24 GiB = all of our memory + all of our swap + 8 GiB
  #doesnt seem to have an effect

(thanks to [16], [17])

/etc/sysctl.conf

I added the line "vm.swapiness=0", which tells the system not to use the swap unless it is actually out of memory. The swap is only there for hibernation, or in case its really needed. [18]

I would have used vm.swapiness=10, but I think 0 is better for an SSD, because you don't want to burn it out with spapping.


todo

why is my firefox writing to disk every few minutes? is this from a plugin? you can see when processes write to disk by using atop and pressing "d". also, i may consider putting logs onto tmpfs to minimize disk writes to my SSD..

sshfs/fuse

todo