This helps me to setup my Ubuntu workstations and maybe it’s useful for you as well! I am currently using Ubuntu 16.04, but most of the stuff should also work with older/newer releases.

I used to use a config management system to do all of this, but I got tired of all the work and am now just writing the important things down into this article. Works for me.

Packages

Prepare

Some packages need to be installed first to make sure all the other commands work.

  • apt-transport-https
  • software-properties-common
sudo apt-get install apt-transport-https software-properties-common 

PPA Repositories

I am using some PPA repositories for packages which are not included in Ubuntu or where newer versions are available. Install before installing the Core packages!

  • ppa:webupd8team/java
  • ppa:git-core/ppa
  • ppa:yktooo/ppa
sudo add-apt-repository ppa:webupd8team/java
sudo add-apt-repository ppa:git-core/ppa
sudo add-apt-repository ppa:yktooo/ppa

Custom Repositories

Some repositories need manual steps to set them up.

  • docker - for the latest Docker releases
  • heroku - Heroku provides a CLI application
  • iridiumbrowser - Iridium browser
  • nodesource - the latest Node.js stable versions - make sure to check the version!
  • owncloud
  • packagecloud - My personal package repo
  • screencloud
  • spotify
  • syncthing
# docker
sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
sudo sh -c 'echo "deb [arch=amd64] https://apt.dockerproject.org/repo ubuntu-xenial main" > /etc/apt/sources.list.d/docker.list'

# heroku
curl -sLS https://toolbelt.heroku.com/apt/release.key | sudo apt-key add -
sudo sh -c 'echo "deb http://toolbelt.heroku.com/ubuntu ./" > /etc/apt/sources.list.d/heroku.list'

# iridiumbrowser
curl -sLS https://downloads.iridiumbrowser.de/ubuntu/iridium-release-sign-01.pub | sudo apt-key add -
sudo sh -c 'echo "deb [arch=amd64] https://downloads.iridiumbrowser.de/deb/ stable main" > /etc/apt/sources.list.d/iridiumbrowser.list'

# nodesource
curl -sLS https://deb.nodesource.com/gpgkey/nodesource.gpg.key | sudo apt-key add -
sudo sh -c 'echo "deb https://deb.nodesource.com/node_6.x xenial main" > /etc/apt/sources.list.d/nodesource.list'

# owncloud
curl -sLS http://download.opensuse.org/repositories/isv:ownCloud:desktop/Ubuntu_16.04/Release.key | sudo apt-key add -
sudo sh -c 'echo "deb http://download.opensuse.org/repositories/isv:/ownCloud:/desktop/Ubuntu_16.04/ /" > /etc/apt/sources.list.d/owncloud.list'

# packagecloud
curl -sLS https://packagecloud.io/bernd/tools/gpgkey | sudo apt-key add -
sudo sh -c 'echo "deb https://packagecloud.io/bernd/tools/ubuntu/ xenial main" > /etc/apt/sources.list.d/packagecloud.list'

# screencloud
curl -sLS http://download.opensuse.org/repositories/home:olav-st/xUbuntu_16.04/Release.key | sudo apt-key add -
sudo sh -c 'echo "deb http://download.opensuse.org/repositories/home:/olav-st/xUbuntu_16.04/ /" > /etc/apt/sources.list.d/screencloud.list'

# spotify
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys BBEBDCB318AD50EC6865090613B00F1FD2C19886
sudo sh -c 'echo "deb http://repository.spotify.com stable non-free" > /etc/apt/sources.list.d/spotify.list'

# syncthing
curl -sLS https://syncthing.net/release-key.txt | sudo apt-key add -
sudo sh -c 'echo "deb http://apt.syncthing.net/ syncthing release" > /etc/apt/sources.list.d/syncthing.list'

sudo apt-get update

Core

  • apt-file
  • compizconfig-settings-manager
  • curl
  • dstat
  • ffmpeg
  • git-crypt
  • gufw
  • htop
  • indicator-multiload
  • iotop
  • ipcalc
  • jq
  • libavcodec-extra
  • keepassx
  • libsecret-tools
  • linux-generic-hwe-16.04
  • linux-tools-generic-hwe-16.04
  • lftp
  • msmtp-gnome
  • msmtp-mta
  • multitail
  • mupdf
  • mutt
  • network-manager-openvpn-gnome
  • ngrep
  • nmap
  • owncloud-client-nautilus
  • pass
  • passwdqc
  • psensor
  • python-pip
  • qiv
  • redshift-gtk
  • rpm
  • ruby
  • ruby-dev
  • s3cmd
  • sqlite3
  • sysstat
  • terminator
  • tilda
  • tmux
  • tree
  • ttf-mscorefonts-installer
  • ubuntu-restricted-extras
  • unity-tweak-tool
  • vim
  • virtualbox
  • w3m
  • zeal
sudo apt-get install apt-file compizconfig-settings-manager curl dstat ffmpeg git-crypt gufw htop indicator-multiload iotop ipcalc jq libavcodec-extra keepassx libsecret-tools linux-generic-hwe-16.04 linux-tools-generic-hwe-16.04 lftp msmtp-gnome msmtp-mta multitail mupdf mutt network-manager-openvpn-gnome ngrep nmap owncloud-client-nautilus pass passwdqc psensor python-pip qiv redshift-gtk rpm ruby ruby-dev s3cmd sqlite3 sysstat terminator tilda tmux tree ttf-mscorefonts-installer ubuntu-restricted-extras unity-tweak-tool vim virtualbox w3m zeal 

PPA

These are provided by the PPA repositories mentioned above.

  • oracle-java8-installer
  • oracle-java8-unlimited-jce-policy
  • oracle-java8-set-default
  • git
  • indicator-sound-switcher
sudo apt-get install oracle-java8-installer oracle-java8-unlimited-jce-policy oracle-java8-set-default git indicator-sound-switcher 

Custom

These are provided by the custom repositories mentioned above.

sudo apt-get install desk devd docker-engine git-radar glide heroku-toolbelt hub hugo iridium-browser jid nodejs noti offlineimap owncloud-client-nautilus portecle screencloud snzip spotify-client syncthing 

Ruby Gem Packages

These are installed via rubygems.

  • bundler
  • dnsimple
  • ghi
  • gist
  • tmuxinator
  • travis
gem install --no-document bundler dnsimple ghi gist tmuxinator travis 

Python Pip Packages

These are installed via pip.

  • glances
  • httpie
  • pinboard
  • proselint
pip install --user glances httpie pinboard proselint 

Uninstall

sudo apt-get purge nano linux-generic linux-image-generic
dpkg -l 'linux-*-4.4.0*' | grep '^ii' | awk '{print $2}' | xargs sudo apt-get -y purge

Manual

Some packages are not available in package repositories.

Chrome

Sublime Text

Download the latest version from the homepage.

Packages

godeb

The godeb tool creates golang packages based on the current golang versions.

Vagrant

The Vagrant debian package can be downloaded from the downloads page. Take the latest version.

JetBrains Toolbox App

The Toolbox app helps with installing JetBrains products.

It also offers a Chrome extension that makes it possible to open GitHub projects in IntelliJ without having to clone it manually.

youtube-dl

There are frequent releases and the binary can update itself, just download the latest version from the homepage.

ngrok

Also a self-updating binary, just download the latest version from the homepage.

Chef Development Kit

There is no repo, download the latest version from the homepage.

Settings & Configuration

System Settings

  • Appearance
    • Behavior
    • Auto-hide the Launcher: ON
    • Enable workspaces: true
    • Show the menus for a window: In the window’s title bar
  • Brightness & Lock
    • Turn screen off when inactive for: 30 Minutes
  • Language Support
    • Install “German” language in addition to the others
  • Security & Privacy

    • Diagnostics
    • Send error reports to Canonical: false
    • Send occasional system information to Canonical: false
  • Displays

    • Scale for menu and title bars: 1.12
  • Keyboard - Typing

    • Repeat Keys
    • Delay: set to 12.5%
    • Speed: set to 89.9%
  • Keyboard - Shortcuts

    • Launchers
    • Key to show the HUD: disabled
    • Launch terminal: Ctrl+Alt+Return
    • Navigation
    • Move window to workspace 1: disabled
    • Switch to workspace 1-9: Alt+1 … Alt+9
    • Windows
    • Maximize window: Ctrl+Super+M
  • Power

    • When power is critically low: Power off
    • When lid is closed: Do nothing (for both)
  • Software & Updates

    • Updates
    • Automatically check for updates: Daily
    • When there are security updates: Display immediately
    • When there are other updates: Display immediately
  • Time & Date

    • Clock
    • Show a clock in the menu bar: true
    • In the clock, show:
      • Weekday: true
      • Date and month: true
      • Year: false
      • 24-hour time: true
    • In the clock’s menu, show:
      • Monthly calendar: true
      • Include week numbers: true
      • Time in other locations:
      • Portland
      • San Francisco
      • Austin
      • Houston
      • UTC
      • Tokyo

Unity Tweak Tool

  • Unity
    • Switcher
    • Display “Show Desktop” icon: false
    • Web Apps
    • Preauthorized domains
      • Amazon: false
      • Ubuntu One: false
  • Window Manager
    • Workspace Settings
    • Workspace switcher: ON
    • Horizontal workspaces: 9
    • Vertical workspaces: 1
    • Window snapping Top Left Corner - Maximize - Top Right Corner Left Half - - Right Half Bottom Left Corner - Do nothing - Bottom Right Corner
    • Hotcorners
    • General
      • Hotcorners: ON
    • Behavior Disabled - Disabled - Disabled Disabled - - Disabled Spread all Windows - Disabled - Disabled
  • System
    • Scrolling
    • Scrollbars
      • Overlay or Legacy - Overlay seems to be okay in 16.04

CompizConfig Settings Manager

  • Desktop
    • Desktop Wall
    • Viewport switching
      • Wall Sliding Duration: 0.0000
    • Ubuntu Unity Plugin
    • Decorations
      • Override Theme Settings: true
      • Disable shadow

Locale

Replace all de_DE.UTF-8 with en_US.UTF-8 in /etc/default/locale and run update-locale.

Sudo

<username> ALL=(ALL:ALL) NOPASSWD: ALL

Emacs key bindings

gsettings set org.gnome.desktop.interface gtk-key-theme "Emacs"

Change GNOME default terminal

gsettings get org.gnome.desktop.default-applications.terminal exec
gsettings set org.gnome.desktop.default-applications.terminal exec 'terminator'

Configure Terminator

[global_config]
  focus = mouse
  handle_size = 2
  inactive_color_offset = 1.0
[keybindings]
  help = None
  next_tab = None
  prev_tab = None
[layouts]
  [[default]]
    [[[child1]]]
      parent = window0
      type = Terminal
    [[[window0]]]
      parent = ""
      type = Window
[plugins]
[profiles]
  [[default]]
    background_image = None
    cursor_color = "#ff003c"
    custom_command = TERM=xterm-256color bash -l
    font = Monospace 12
    login_shell = True
    scroll_on_output = False
    scrollback_lines = 50000
    scrollbar_position = hidden
    show_titlebar = False
    use_custom_command = True
    use_system_font = False

Change GNOME screenshot default location

gsettings set org.gnome.gnome-screenshot auto-save-directory "file:///home/$USER/Desktop/"

Shell profile

The following snipped should be appended to $HOME/.profile.

# Custom shell init code
umask 022

extra_paths="$extra_paths $HOME/local/bin"
extra_paths="$extra_paths $HOME/.local/bin"
extra_paths="$extra_paths $HOME/.gem/ruby/2.3.0/bin"
extra_paths="$extra_paths $HOME/.local/node_modules/.bin"

for path in $extra_paths; do
    if [ -d "$path" ]; then
        PATH="$path:$PATH"
    fi
done

# Include custom bash completion config
if [ -d $HOME/.bash_completion.d ]; then
        for file in $HOME/.bash_completion.d/*; do
                . $file
        done
fi

case "$TERM" in
xterm*)
        TERM=xterm-256color
        ;;
esac

Chrome

Settings

Update browser settings on chrome://flags:

Plugins

Set GNOME text editor to gvim or Sublime

sudo update-alternatives --config gnome-text-editor

Extend .local/share/applications/mimeapps.list with some of the following entries.

[Default Applications]
application/ecmascript=sublime_text.desktop;
application/javascript=sublime_text.desktop;
application/mathematica=sublime_text.desktop;
application/x-chess-pgn=sublime_text.desktop;
application/x-ccmx=sublime_text.desktop;
application/x-ica=sublime_text.desktop;
application/mathml+xml=sublime_text.desktop;
application/sql=sublime_text.desktop;
application/x-perl=sublime_text.desktop;
application/xml-dtd=sublime_text.desktop;
message/partial=sublime_text.desktop;
message/rfc822=sublime_text.desktop;
message/news=sublime_text.desktop;
model/vrml=sublime_text.desktop;
text/x-java=sublime_text.desktop;
text/xmcd=sublime_text.desktop;
text/x-vhdl=sublime_text.desktop;
text/x-subviewer=sublime_text.desktop;
text/x-adasrc=sublime_text.desktop;
text/x-modelica=sublime_text.desktop;
text/x-objcsrc=sublime_text.desktop;
text/x-ssa=sublime_text.desktop;
text/x-mpsub=sublime_text.desktop;
text/x-txt2tags=sublime_text.desktop;
text/x-svhdr=sublime_text.desktop;
text/x-verilog=sublime_text.desktop;
text/x-troff-ms=sublime_text.desktop;
text/x-mof=sublime_text.desktop;
text/x-readme=sublime_text.desktop;
text/x-uil=sublime_text.desktop;
text/x-scheme=sublime_text.desktop;
text/x-install=sublime_text.desktop;
text/x-log=sublime_text.desktop;
text/x-ooc=sublime_text.desktop;
text/x-uuencode=sublime_text.desktop;
text/x-ms-regedit=sublime_text.desktop;
text/x-ldif=sublime_text.desktop;
text/x-mup=sublime_text.desktop;
text/x-makefile=sublime_text.desktop;
text/x-nfo=sublime_text.desktop;
text/x-lua=sublime_text.desktop;
text/x-pascal=sublime_text.desktop;
text/x-cmake=sublime_text.desktop;
text/x-dsrc=sublime_text.desktop;
text/x-rpm-spec=sublime_text.desktop;
text/x-tex=sublime_text.desktop;
text/x-markdown=sublime_text.desktop;
text/x-microdvd=sublime_text.desktop;
text/x-idl=sublime_text.desktop;
text/x-scala=sublime_text.desktop;
text/x-setext=sublime_text.desktop;
text/x-python=sublime_text.desktop;
text/x-literate-haskell=sublime_text.desktop;
text/x-copying=sublime_text.desktop;
text/x-ocl=sublime_text.desktop;
text/x-dsl=sublime_text.desktop;
text/x-texinfo=sublime_text.desktop;
text/x-dcl=sublime_text.desktop;
text/x-fortran=sublime_text.desktop;
text/x-gettext-translation=sublime_text.desktop;
text/x-erlang=sublime_text.desktop;
text/x-gettext-translation-template=sublime_text.desktop;
text/x-emacs-lisp=sublime_text.desktop;
text/x-iptables=sublime_text.desktop;
text/x-haskell=sublime_text.desktop;
text/x-lilypond=sublime_text.desktop;
text/x-patch=sublime_text.desktop;
text/x-matlab=sublime_text.desktop;
text/x-reject=sublime_text.desktop;
text/x-tcl=sublime_text.desktop;
text/x-svsrc=sublime_text.desktop;
text/x-troff-mm=sublime_text.desktop;
text/x-moc=sublime_text.desktop;
text/x-troff-me=sublime_text.desktop;
text/cache-manifest=sublime_text.desktop;
text/x-eiffel=sublime_text.desktop;
text/enriched=sublime_text.desktop;
text/htmlh=sublime_text.desktop;
text/rfc822-headers=sublime_text.desktop;
text/plain=sublime_text.desktop;
text/troff=sublime_text.desktop;
text/x-vala=sublime_text.desktop;
text/css=sublime_text.desktop;
text/x-c++hdr=sublime_text.desktop;
text/x-c++src=sublime_text.desktop;
text/x-chdr=sublime_text.desktop;
text/x-csharp=sublime_text.desktop;
text/x-csrc=sublime_text.desktop;

Disable some startup programs

Make autostarted apps visible:

cd /etc/xdg/autostart/
sudo sed -i 's/NoDisplay=true/NoDisplay=false/g' *.desktop

Start the “Startup Applications” app and disable everything you don’t want.

Swappiness

The Linux kernel likes to swap even though there is lots of memory available.

sudo sh -c 'echo vm.swappiness = 1 > /etc/sysctl.d/99-swappiness.conf'

Inotify watches

Some applications like IntelliJ need more user watches for inotify than the default.

sudo sh -c 'echo fs.inotify.max_user_watches = 524288 > /etc/sysctl.d/99-inotify.conf'

Golang

I like to install applications via go get into a special GOPATH so they don’t pollute my development GOPATH.

Add the following script to $HOME/bin/goget.

#!/bin/bash

export GOPATH="$LOCALGOPATH"

exec go get "$@"

Make sure the LOCALGOPATH variable is set in .profile and the PATH includes the bin/ directory of the LOCALGOPATH.

Rubygems

Create $HOME/.gemrc with the following content to ensure installation in the user directory and to avoid generating the documentation.

install: --user-install --no-document
update: --user-install --no-document

NPM

Create $HOME/.npmrc with the following content to make sure npm modules will be installed in the user directory.

prefix=/home/<username>/.local/node_modules
progress=false

Python pip

Create $HOME/.config/pip/pip.conf with the following to only use local packages and ignore system ones.

[global]
user = true

Ensure working Solarized colors in terminal

TERM needs to be xterm-256color for solarized colors to work in i.e. Terminator.

case "$TERM" in
xterm*)
        TERM=xterm-256color
        ;;
esac

Problem Solutions

Laptop does not suspend properly with USB HDD attached

The following might help. The XHCI and EHC* devices are enabled.

cat /proc/acpi/wakeup
Device	S-state	  Status   Sysfs node
LID	  S4	*enabled   platform:PNP0C0D:00
SLPB	  S3	*enabled   platform:PNP0C0E:00
IGBE	  S4	*enabled   pci:0000:00:19.0
EXP3	  S4	*disabled  pci:0000:00:1c.2
XHCI	  S3	*enabled   pci:0000:00:14.0
EHC1	  S3	*enabled   pci:0000:00:1d.0
EHC2	  S3	*enabled   pci:0000:00:1a.0
HDEF	  S4	*disabled  pci:0000:00:1b.0

To disable them, just echo their names into /proc/acpi/wakeup.

echo XHCI > /proc/acpi/wakeup
echo EHC1 > /proc/acpi/wakeup
echo EHC2 > /proc/acpi/wakeup

Make SSH Key Work

gnome-keyring requires the id_rsa file to have theProc-Type and DEK-Info in it. Otherwise the ssh agent does not work. A key missing this information can be converted by executing ssh-keygen -t to change the passphrase.

If the gnome-keyring stuff should be disabled:

http://dtek.net/blog/how-stop-gnome-keyring-clobbering-opensshs-ssh-agent-ubuntu-1204

IntelliJ IDEA

There used to be a problem with IntelliJ and I-Bus where I had to restart the ibus daemon from time to time to fix the cursor in the IDE again. I didn’t see it lately but I am keeping the link here if it ever happens again.

https://youtrack.jetbrains.com/issue/IDEA-78860

NetworkManager VPN DNS Issue

When connecting to a VPN, NetworkManager does not take the pushed DNS settings into account and continues to use the local dnsmasq server. This leads to non-working DNS.

Comment the dns=dnsmasq line in /etc/NetworkManager/NetworkManager.conf file to fix it.

UEFI Restore Menu Item

If the “ubuntu” menu item is gone from the UEFI boot manager, it can be restored with the following command.

sudo grub-install --bootloader-id ubuntu /dev/sda

This might happen after enabling/disabling the Secure Boot option.

See also: https://www.thomas-krenn.com/de/wiki/Ubuntu_UEFI_Booteintr%C3%A4ge_nach_BIOS/Grub_Update_wiederherstellen

rEFInd Boot Manager

Useful to find EFI boot partition if the “ubuntu” entry is gone from the UEFI boot manager.

Panel and Sidebar disappear

$ rm .config/dconf/user

Guides

Some more or less useful links that provide some tips and guides for Ubuntu or Linux in general.

Thinkpad BIOS Update

Download the bootable ISO image from the Lenovo site.

Extract the BIOS image from the ISO file and put it onto a USB thumb drive.

sudo apt-get install genisoimage
geteltorito gjuj23us.iso > gjuj23us.img
sudo dd if=gjuj23us.img of=/dev/sdb bs=512K

After that, the USB drive can be booted.