Monday, November 11, 2013

Debian 7 "Wheezy"
Personal Installation Guide

Jump to:

1. First steps

2. Install some extremelly important stuff

3. JAVA JRE installation

4. Install fluxbox

5. Install LightDM and/or SLIM greeters

6. Set-up Debian Backports repository

1. First steps

As root, execute the following commands.
root$ apt-get install vim vim-scripts vim-doc vim-common vim-gui-common vim-gtk
Modify /etc/sudoers
foo$ vi /etc/sudoers
Add the following lines at the end of the file.
# Add users to list:
foo ALL=(ALL:ALL) ALL

Now, as normal user install the following useful stuff:
foo$ sudo apt-get install dkms
Also, certify that all mouse and touchpad related software is installed.
foo$ sudo apt-get install xserver-xorg-input-mouse xserver-xorg-input-synaptics tpconfig gpointing-device-settings

Bash-completion: install and enable it.
foo$ sudo apt-get install bash-completion
foo$ sudo vim /etc/bash.bashrc
Uncomment or add the following lines:
# enable bash completion in interactive shells
if ! shopt -oq posix; then
   if [ -f /usr/share/bash-completion/bash_completion ]; then
      . /usr/share/bash-completion/bash_completion
   elif [ -f /etc/bash_completion ]; then
      . /etc/bash_completion
   fi
fi

Updating repository list. First install debian-keyring.
foo$ sudo apt-get install debian-keyring debian-archive-keyring
Most repository paths may be retrieved from https://wiki.debian.org/UnofficialRepositories. Edit /etc/apt/sources.list:
foo$ sudo vim /etc/apt/sources.list
Change/add the following lines (don't forget to add contrib and non-free):
deb http://ftp.pt.debian.org/debian/ wheezy main contrib non-free
deb-src http://ftp.pt.debian.org/debian/ wheezy main contrib non-free

deb http://security.debian.org/ wheezy/updates main
deb-src http://security.debian.org/ wheezy/updates main

# wheezy-updates, previously known as 'volatile'
deb http://ftp.pt.debian.org/debian/ wheezy-updates main contrib non-free
deb-src http://ftp.pt.debian.org/debian/ wheezy-updates main contrib non-free

### 3RD PARTY REPOS
## deb-mutimedia (see http://www.deb-multimedia.org/debian-m)
deb http://ftp.eq.uc.pt/software/unix/Linux/deb-multimedia/ stable main
deb-src http://ftp.eq.uc.pt/software/unix/Linux/deb-multimedia/ stable main

## Google
deb http://dl.google.com/linux/chrome/deb/ stable main
deb http://dl.google.com/linux/talkplugin/deb/ stable main

## Skype
deb http://download.skype.com/linux/repos/debian/ stable non-free

## VirtualBox (see https://www.virtualbox.org/wiki/Linux_Downloads)
deb http://download.virtualbox.org/virtualbox/debian wheezy contrib
Update the repositories cache:
foo$ sudo apt-get update

This may yield several errors related with missing GPG keys, such as:
W: GPG error: http://ftp.eq.uc.pt stable Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 07DC563D1F41B907
Add each of the missing public keys. Exemplifying for the deb-mutimedia repository, we know that the key for this repository is 07DC563D1F41B907, as stated in the error. Thus,
foo$ gpg --keyserver hkp://subkeys.pgp.net --recv-keys 07DC563D1F41B907
foo$ gpg --export --armor 07DC563D1F41B907 | sudo apt-key add -

Finally, update and upgrade the system.
foo$ sudo apt-get update
foo$ sudo apt-get upgrade
foo$ sudo apt-get dist-upgrade

2. Install some extremelly important stuff

Tools I need in my system.
foo$ sudo apt-get install rsync curl lftp wget wput colordiff tkdiff meld
foo$ sudo apt-get install pcmanfm roxterm uzbl hnb
foo$ sudo apt-get install redshift conky xdotool libxdo2 x11-utils

OpenSSH
foo$ sudo apt-get install openssh-server openssh-client

Control version software
foo$ sudo apt-get install git git-gui git-cvs git-svn git-email mercurial subversion subversion-tools bzr bzrtools cvs

Packaging
foo$ sudo apt-get install build-essential debhelper devscripts cdbs dh-make diffutils patch gnupg fakeroot lintian devscripts pbuilder dpatch dput quilt

Printer support
foo$ sudo apt-get install cups cups-pdf system-config-printer printer-driver-hpijs

Apache web server
foo$ sudo apt-get install apache2-mpm-itk apache2-mpm-event apache2-mpm-prefork apache2-mpm-worker mysql-server php-pear php5 php5-gd php5-mysql php5-imagick php5-curl phpmyadmin cronolog

Libre Office
foo$ sudo apt-get install libreoffice libreoffice-gtk

Mplayer
foo$ sudo apt-get install mplayer mencoder mplayer2

VLC
foo$ sudo apt-get install vlc vlc-plugin-sdl vlc-plugin-jack

FFMPEG
foo$ sudo apt-get install ffmpeg x264 libav-tools

Transcode and avidemux
foo$ sudo apt-get install transcode transcode-utils
foo$ sudo apt-get install avidemux avidemux-cli avidemux-common avidemux-plugins

Install dvd stuff (including libdvdcss)
foo$ sudo apt-get install libdvdnav4 libdvdread4 libdvdcss2 regionset

CD and DVD cli burners
foo$ sudo apt-get install wodim genisoimage growisofs

Non-free codecs
foo$ sudo apt-get install gstreamer0.10-plugins-ugly
foo$ wget http://www.deb-multimedia.org/pool/non-free/w/w64codecs/w64codecs_20071007-dmo2_amd64.deb
foo$ sudo dpkg -i w64codecs_20071007-dmo2_amd64.deb
foo$ rm w64codecs_20071007-dmo2_amd64.deb

MS core fonts (with following debian repos: contrib non-free)
foo$ sudo apt-get install ttf-mscorefonts-installer

Flash player (with following debian repos: contrib non-free)
foo$ sudo apt-get install flashplugin-nonfree

3. JAVA JRE installation

First make sure all openjdk java versions are installed.
foo$ sudo apt-get install openjdk-6-jre oracle-java7-installer icedtea6-plugin icedtea-6-plugin

Java package (https://wiki.debian.org/JavaPackage)
foo$ sudo apt-get install java-package

To install JAVA 7 from Oracle, choose one of the following (either 3.a, 3.b or 3.c)

3.a As in https://wiki.debian.org/JavaPackage

Check both wiki.debian.org/JavaPackage and https://d.stavrovski.net/blog/installing-oracle-java7-on-debian-wheezy. Find the latest version number in www.oracle.com/technetwork/java/javase/downloads. In the present case this was Java Platform (JDK) 7u45, thus the file to download was jdk-7u45-linux-x64.tar.gz. Download JAVA 7 from Oracle’s website using wget:
foo$ wget --no-cookies \
   --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com" \
   "http://download.oracle.com/otn-pub/java/jdk/7/jdk-7u45-linux-x64.tar.gz" \
   -O /tmp/jdk-7u45-linux-x64.tar.gz --no-check-certificate
foo$ make-jpkg /tmp/jdk-7u45-linux-x64.tar.gz
foo$ dpkg -i oracle-j2sdk1.7_1.7.0+update45_amd64.deb

Optionally, for 32 bit systems:
foo$ wget --no-cookies \
   --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com" \
   "http://download.oracle.com/otn-pub/java/jdk/7u21-b11/jdk-7u45-linux-i586.tar.gz" \
   -O /tmp/jdk-7u45-linux-i586.tar.gz --no-check-certificate
foo$ make-jpkg /tmp/jdk-7u45-linux-i686.tar.gz
foo$ dpkg -i oracle-j2sdk1.7_1.7.0+update45_i686.deb

Debian alternatives system will have it already set-up automatically. Use it to choose what java version to use:
foo$ update-alternatives --display java
foo$ sudo update-alternatives --config java

NOTE: if there are any problem with update-alternatives, configure manually:
foo$ JHome=/opt/java-oracle/jdk1.7.0
foo$ update-alternatives --install /usr/bin/java java ${JHome%*/}/bin/java 20000
foo$ update-alternatives --install /usr/bin/javac javac ${JHome%*/}/bin/javac 20000

3.b Using the one from webupd8team (same as for Ubuntu)

Referring to www.webupd8.org/2012/06/how-to-install-oracle-java-7-in-debian.html:
foo$ echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu precise main" | sudo tee -a /etc/apt/sources.list.d/java-oracle-webupd8team.list
foo$ echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu precise main" | sudo tee -a /etc/apt/sources.list.d/java-oracle-webupd8team.list
foo$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EEA14886
foo$ sudo apt-get update
foo$ sudo apt-get install oracle-java7-installer

3.c Using the one from duinsoft

Referring to www.fandigital.com/2012/07/install-latest-java-in-debian-ubuntu.html :
foo$ echo "deb http://www.duinsoft.nl/pkg debs all" | sudo tee -a /etc/apt/sources.list.d/java-oracle-duinsoft.list
foo$ sudo apt-key adv --keyserver keys.gnupg.net --recv-keys 5CB26B26
foo$ sudo apt-get update
foo$ sudo apt-get install oracle-java7-installer

4. Install fluxbox

Install fluxbox:
foo$ sudo apt-get install fluxbox

Configure the x-window-manager in update-alternatives:
foo$ sudo update-alternatives --config x-window-manager
  Selection    Path                   Priority   Status
------------------------------------------------------------
* 0            /usr/bin/openbox        90        auto mode
  1            /usr/bin/openbox        90        manual mode
  2            /usr/bin/startfluxbox   50        manual mode

Enter to keep the current selection[*], or type selection number: 

Choose the startfluxbox (number 2). Same for x-session-manager in update-alternatives.
foo$ sudo update-alternatives --config x-session-manager
  Selection    Path                      Priority   Status
------------------------------------------------------------
  0            /usr/bin/startlxde         50        auto mode
  1            /usr/bin/lxsession         49        manual mode
  2            /usr/bin/openbox-session   40        manual mode
* 3            /usr/bin/startfluxbox      30        manual mode
  4            /usr/bin/startlxde         50        manual mode

Enter to keep the current selection[*], or type selection number: 

Choose the startfluxbox (number 3).
NOTE: If any of the startfluxbox pointer is missing, add them:
For x-window-manager:
foo$ sudo update-alternatives --install /usr/bin/x-window-manager \
    x-window-manager /usr/bin/startfluxbox 30 \
    --slave /usr/share/man/man1/x-window-manager.1.gz \
    x-window-manager.1.gz /usr/share/man/man1/fluxbox.1.gz

For x-session-manager:
foo$ sudo update-alternatives --install /usr/bin/x-session-manager \
    x-session-manager /usr/bin/startfluxbox 30 \
    --slave /usr/share/man/man1/x-session-manager.1.gz \
    x-session-manager.1.gz /usr/share/man/man1/fluxbox.1.gz

As normal user add startfluxbox to ~/.xinitrc.bak (in case one later needs to use it, by copying it to ~/.xinitrc).
foo$ vi ~/.xinitrc.bak

#!/bin/bash
###############
#
# ~/.xinitrc
# Executed by startx (run your window manager from here)
#
###############

if [ -d /etc/X11/xinit/xinitrc.d ]; then
        for f in /etc/X11/xinit/xinitrc.d/*; do
                [ -x "$f" ] && . "$f"
        done
        unset f
fi

## SET LOGIN MANAGER
exec startfluxbox

## SET MOUSE
xset m 2 10 &

## RESTORE AUDIO LEVELS
restore_alsa() {
 while [ -z "`pidof pulseaudio`" ]; do
  sleep 0.5
 done
 alsactl -f /var/lib/alsa/asound.state restore
}
restore_alsa &

5. Install LightDM and/or SLIM greeters

5.a LightDM

Install LightDM
foo$ sudo apt-get install lightdm lightdm-gtk-greeter

Change the currend default Display Manager to LightDM
foo$ sudo dpkg-reconfigure lightdm

For changes the the configuration of lightdm:
foo$ sudo vi /etc/lightdm/lightdm.conf

To change the greeter's background (/etc/lightdm/lightdm-gtk-greeter.conf):
foo$ sudo vi /etc/lightdm/lightdm-gtk-greeter.conf

Find the following line:
[greeter]
background=/usr/share/images/desktop-base/login-background.svg

If it points to /usr/share/images/desktop-base/desktop-background use update-alternatives instead.
foo$ sudo update-alternatives --config desktop-background

5.b SLIM

foo$ sudo apt-get install slim

Change the currend default Display Manager to SLIM
foo$ sudo dpkg-reconfigure slim

For changes the the configuration of SLIM:
foo$ sudo vi /etc/slim.conf

Set hidecursor to false and change current theme if needed. Additionally, for fluxbox users, add startfluxbox to the sessions line.
hidecursor      false

current_theme   debian-joy

sessions        /usr/bin/startfluxbox,/usr/bin/openbox-session,/usr/bin/startlxde

To change the SLIM background, change the current_theme background.png file. For example, with current_theme set as debian-joy:
foo$ ls -la /usr/share/slim/themes/debian-joy/
foo$ ln -sf new_background.png /usr/share/slim/themes/debian-joy/background.png

6. Set-up Debian Backports repository

Quoting from https://wiki.debian.org/Backports:
Backports are recompiled packages from testing (mostly) and unstable (in a few cases only, e.g. security updates), so they will run without new libraries (wherever it is possible) on a stable Debian distribution. It is recommended to pick out single backports which fit your needs, and not to use all backports available.
Add Backports repository. Edit /etc/apt/sources.list:
foo$ sudo vim /etc/apt/sources.list
Change/add the following lines:
deb http://ftp.pt.debian.org/debian/ wheezy main contrib non-free
deb-src http://ftp.pt.debian.org/debian/ wheezy main contrib non-free

deb http://security.debian.org/ wheezy/updates main
deb-src http://security.debian.org/ wheezy/updates main

# wheezy-updates, previously known as 'volatile'
deb http://ftp.pt.debian.org/debian/ wheezy-updates main contrib non-free
deb-src http://ftp.pt.debian.org/debian/ wheezy-updates main contrib non-free

## BACKPORTS REPOSITORY deb http://ftp.debian.org/debian wheezy-backports main contrib non-free
### 3RD PARTY REPOS
## deb-mutimedia (see http://www.deb-multimedia.org/debian-m)
deb http://ftp.eq.uc.pt/software/unix/Linux/deb-multimedia/ stable main
deb-src http://ftp.eq.uc.pt/software/unix/Linux/deb-multimedia/ stable main

## Google
deb http://dl.google.com/linux/chrome/deb/ stable main
deb http://dl.google.com/linux/talkplugin/deb/ stable main

## Skype
deb http://download.skype.com/linux/repos/debian/ stable non-free

## VirtualBox (see https://www.virtualbox.org/wiki/Linux_Downloads)
deb http://download.virtualbox.org/virtualbox/debian wheezy contrib
Update the repositories cache:
foo$ sudo apt-get update

As an example, suppose one want's a newer linux kernel. Before adding the Backports repository the list of available kernels was:
foo$ apt-cache search linux-image
linux-headers-3.2.0-4-amd64 - Header files for Linux 3.2.0-4-amd64
linux-headers-3.2.0-4-rt-amd64 - Header files for Linux 3.2.0-4-rt-amd64
linux-image-3.2.0-4-amd64 - Linux 3.2 for 64-bit PCs
linux-image-3.2.0-4-amd64-dbg - Debugging symbols for Linux 3.2.0-4-amd64
linux-image-3.2.0-4-rt-amd64 - Linux 3.2 for 64-bit PCs, PREEMPT_RT
linux-image-3.2.0-4-rt-amd64-dbg - Debugging symbols for Linux 3.2.0-4-rt-amd64
linux-image-2.6-amd64 - Linux for 64-bit PCs (dummy package)
linux-image-amd64 - Linux for 64-bit PCs (meta-package)
linux-image-rt-amd64 - Linux for 64-bit PCs (meta-package), PREEMPT_RT
nvidia-kernel-3.2.0-4-amd64 - NVIDIA binary kernel module for Linux 3.2.0-4-amd64
After adding the Backports repository:
foo$ apt-cache search linux-image
linux-headers-3.2.0-4-amd64 - Header files for Linux 3.2.0-4-amd64
linux-headers-3.2.0-4-rt-amd64 - Header files for Linux 3.2.0-4-rt-amd64
linux-image-3.2.0-4-amd64 - Linux 3.2 for 64-bit PCs
linux-image-3.2.0-4-amd64-dbg - Debugging symbols for Linux 3.2.0-4-amd64
linux-image-3.2.0-4-rt-amd64 - Linux 3.2 for 64-bit PCs, PREEMPT_RT
linux-image-3.2.0-4-rt-amd64-dbg - Debugging symbols for Linux 3.2.0-4-rt-amd64
linux-image-2.6-amd64 - Linux for 64-bit PCs (dummy package)
linux-image-amd64 - Linux for 64-bit PCs (meta-package)
linux-image-rt-amd64 - Linux for 64-bit PCs (meta-package), PREEMPT_RT
nvidia-kernel-3.2.0-4-amd64 - NVIDIA binary kernel module for Linux 3.2.0-4-amd64
linux-headers-3.12-0.bpo.1-amd64 - Header files for Linux 3.12-0.bpo.1-amd64
linux-headers-3.12-0.bpo.1-rt-amd64 - Header files for Linux 3.12-0.bpo.1-rt-amd64
linux-headers-3.13-0.bpo.1-amd64 - Header files for Linux 3.13-0.bpo.1-amd64
linux-image-3.12-0.bpo.1-amd64 - Linux 3.12 for 64-bit PCs
linux-image-3.12-0.bpo.1-amd64-dbg - Debugging symbols for Linux 3.12-0.bpo.1-amd64
linux-image-3.12-0.bpo.1-rt-amd64 - Linux 3.12 for 64-bit PCs, PREEMPT_RT
linux-image-3.12-0.bpo.1-rt-amd64-dbg - Debugging symbols for Linux 3.12-0.bpo.1-rt-amd64
linux-image-3.13-0.bpo.1-amd64 - Linux 3.13 for 64-bit PCs
linux-image-3.13-0.bpo.1-amd64-dbg - Debugging symbols for Linux 3.13-0.bpo.1-amd64
linux-image-amd64-dbg - Debugging symbols for Linux amd64 configuration (meta-package)
linux-image-rt-amd64-dbg - Debugging symbols for Linux rt-amd64 configuration (meta-package)
nvidia-kernel-3.12-0.bpo.1-amd64 - NVIDIA binary kernel module for Linux 3.12-0.bpo.1-amd64
To install the 3.12 linux kernel:
foo$ sudo apt-get install linux-image-3.12