18 July 2012

Debian Fluxbox Setup


Sections:


The major install:

After running the installer (from cd/iso), login as root for the remainder of the install (unless instruced otherwise)
Then:
nano /etc/apt/sources

replace "main" at the end of each us.debian.org line with "main contrib non-free"
ie replace:
deb http://ftp.us.debian.org/debian testing main
deb-src http://ftp.us.debian.org/debian testing main

with
deb http://ftp.us.debian.org/debian testing main contrib non-free
deb-src http://ftp.us.debian.org/debian testing main contrib non-free


a basic apt sources file:
deb http://ftp.us.debian.org/debian wheezy main contrib non-free
deb-src http://ftp.us.debian.org/debian wheezy main contrib non-free

# testing-backports doesn't exist. Comment these line out if using "testing"
deb http://backports.debian.org/debian-backports wheezy-backports main contrib non-free
deb-src http://backports.debian.org/debian-backports wheezy-backports main contrib non-free

# testing-updates doesn't exist. Comment these line out if using "testing"
deb http://ftp.us.debian.org/debian wheezy-updates main contrib non-free
deb-src http://ftp.us.debian.org/debian wheezy-updates main contrib non-free

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

[12]

APT will update for all translations available. Skipping unnecessary translations will make apt faster.[14]
This can be controlled using apt.conf[15].

Append the following to the bottom of /etc/apt/apt.conf.d/70debconf

Acquire::Languages { "environment"; "en"; "ta"; };

If apt-get update still gets translations for other languages, you may have to clear /var/lib/apt/lists as mentioned in [15] after which apt-get update will only pull the translations as configured in APT conf.
For more information check man apt.conf

Now run:
apt-get update -y
apt-get dist-upgrade -y
# Essentials
aptitude install bash-completion bzip2 gzip unzip zip xinit wget xutils fluxbox sudo vim xterm libreoffice chrony
# Images, Videos, Web Browsers
aptitude install feh gimp imagemagick vlc ffmpeg iceweasel
# Audio support
aptitude install alsa-utils alsa-tools alsa-tools-gui
# Printing services
aptitude install cups
# GUI Extras, fonts, spellchecker and more
aptitude install rox-filer default-jre myspell-en-us numlockx gnuplot gv
# exFat drivers for writing and reading exFat partitions (see KB955704 for windows XP) aptitude install exfat-fuse exfat-utils

# Fonts
aptitude install xfonts-utils ttf-mscorefonts-installer xfonts-terminus xfonts-scalable xfonts-encodings xfonts-base xfonts-mathml xfonts-nexus gsfont-x11 xfonts-100dpi-transcoded
# Extra codecs
aptitude install libavcodec-extra-53 libavdevice-extra-53 libavfilter-extra-2 libavformat-extra-53 libavutil-extra-51 libpostproc-extra-52 libswscale-extra-2
# Build essentials include this if you're going to be compiling and installing propitiatory drivers or custom software 

# aptitude install build-essentials linux-headers-`uname -r` 
# Laptop extras
setup your user account so you can use sudo
adduser YOUR-USER-NAME sudo
logout

login as YOUR-USER-NAME
sudo ls

this should ask for your password then list the files in the current directory (this verifies sudo is working)
logout

Install Apt-fast:

[1] Run:
apt-get install axel
mkdir ~/aptfast
cd ~/aptfast
wget https://raw.github.com/ilikenwf/apt-fast/master/README
wget https://raw.github.com/ilikenwf/apt-fast/master/apt-fast
wget https://raw.github.com/ilikenwf/apt-fast/master/apt-fast.comp
wget https://raw.github.com/ilikenwf/apt-fast/master/apt-fast.conf
nano ./apt-fast.conf # find the line corresponding to the axel download manager and uncomment it (remove the pound symbol)
cp ./apt-fast /usr/sbin/
chmod +x /usr/sbin/apt-fast
cp ./apt-fast.conf /etc
chown root /etc/apt-fast.conf
chown root /usr/sbin/apt-fast
cp ./apt-fast.comp /etc/bash_completion.d/apt-fast
chown root /etc/bash_completion.d/apt-fast
. /etc/bash_completion


Install vmware-tools (if a virtual machine):

[2] Start by doing:
aptitude install linux-headers-`uname -r` libx11-6 libx11-dev xorg libxtst6 psmisc build-essential ia32-libs ia32-libs-gtk

The Debian wiki mentions x-window-system and x-window-system-core but those packages are now provided by xorg. Now install the open-vm-tools packages:
aptitude install open-vm-tools open-vm-dkms open-vm-tools-dev open-vm-toolbox

We have to load the kernel modules via dkms (Dynamic kernel module support). To install required kernel modules.
The last number (20xx.xx.xx) is the module version, you can get this number by using:
aptitude show open-vm-tools #Look for version string (after the + sign) ignore anything after the date (20xx.xx.xx-12324.a32)
dkms add open-vm-tools/20xx.xx.xx
dkms build open-vm-tools/20xx.xx.xx
dkms install open-vm-tools/20xx.xx.xx

Run modinfo and verify that we have the required modules.
After the installation, try querying the vmware tools modules.
modinfo vmxnet
modinfo vmhgfs

Shut down the VM.
halt

Map shares using VMware player settings. Start the VM. Now we should have VMware tools loaded.
ls /mnt/hgfs/ # returns a list of shared directories

Now we install vmware tools proper. vmware player should offer to download and mount the tools iso image.
mount /dev/sr0
cp /media/cdrom/VMwareT*tar.gz ~
cd ~
tar zxvf VMwareT*tar.gz
cd VMwareTools*
./install

shutdown the VM and retart it.
login
startx

try resizeing the VM window

if window re-sizing doesn't work[3][4]:
apt-get remove xserver-xorg-video-vmware
apt-get install xserver-xorg-video-vmware

Then log out and log back in again.

Install Chromium browser:

Choosing Chrome vs Chromium: see technical details at [16], and human-friendly details at [17].

aptitude install chromium-browser

You may wish to include[18][19]: flashplayer-nonfree, xpdf

Install Chrome:

Choosing Chrome vs Chromium: see technical details at [16], and human-friendly details at [17].
Start by adding this line to the file /etc/apt/sources:
deb http://dl.google.com/linux/chrome/deb/ stable main
Add the google chrome repository, install the google key and finally install Chrome.
nano /etc/apt/sources # addthis line: deb http://dl.google.com/linux/chrome/deb/ stable main
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
aptitude install google-chrome-stable
#use the beta channel if you want. skip the line above use the one below (comment/uncomment as necessary)
#aptitude install google-chrome-beta


Use your system:

login as YOUR_USER_NAME
start the x windows system and fluxbox
startx

right click on the desktop go "terminal enulators" and select "xterm"
an new terminal window should appear.
do stuff.

Customize Fluxbox:

[6] This referece is great for learning how to customize your fluxbox
I prefer to manually edit these files. In the past the Fluxconf [7] utility has proved more trouble than it is worth.
try "nano ~/.fluxbox/menu" this is the file that defines the fluxbox menu you can add new programs here.
~/.fluxbox/startup defines programs that run when fluxbox starts
~/.fluxbox/init defines fluxbox initial parameters (background image command can be found here)
~/.fluxbox/fbkeys defines keybindings in fluxbox (alt-f4 to close, alt-x for a new terminal etc..)

HALT:

[8]Add a line to sudoers so that members of the sudo group can halt the system (and do so from the fluxbox menu)
visudo #find the line that reads "%sudo ALL=(ALL) ALL" and add this just below
%sudo ALL= NOPASSWD: /bin/halt


Manually install fonts:

[9]Copy a TTF, OTF, or TTC font file to the directory /usr/local/share/fonts (for all users) or ~/.fonts (for a specific user).
A good place to start when loking for new fonts is [10]

fc-list - lists fonts
fc-cache -fv - rebuilds cached list of fonts

To view list of monospaced clint-side fonts (available from Xft, so it is possible to apply font hinting and antialiasing):

$ fc-list :spacing=mono


To view list of server-side (available directly from X server, so font hinting and antialiasing are not available) monospaced fonts:

$ xlsfonts -fn '*-*-*-*-*-*-*-*-*-*-*-m*'
$ xlsfonts -fn '*-*-*-*-*-*-*-*-*-*-*-c*'


You may find the following useful to change default font rendering:

$ dpkg-reconfigure fontconfig-config
$ dpkg-reconfigure fontconfig



APT Preferences and Pinning

[13] Add testing and/or unstable repositories to sources.list

/etc/apt/sources.list

nano /etc/apt/sources.list
# I start by duplicating all existing repos, but the following line should get you started

#### testing #########
deb http://ftp.us.debian.org/debian testing main contrib non-free

#### unstable #########
deb http://ftp.us.debian.org/debian unstable main contrib non-free

In this example, we're pulling from testing and unstable. You could, of course, modify this to pull from stable (or wheezy) as well.

/etc/apt/preferences

nano /etc/apt/preferences
Package: *
Pin: release a=stable
Pin-Priority: 300

Package: *
Pin: release a=testing
Pin-Priority: 900

Package: *
Pin: release a=unstable
Pin-Priority: 600

Package defaults to any, as specified by the asterisk. Pin specifies the release (testing and unstable). Pin-Priority specifies the priority level. 'apt-get' defaults to something along the lines of "highest package version wins". The above restructures this priority so that packages in testing are given a higher priority.
I use testing so i want stable to be low priority. If you are using stable or an named version (wheezy) then adjust the release and priorities to suit your needs.
be sure to run apt-get update after making modifications to APT config files.

Installing from unstable

there are two basic options. I usually go with the second one. apt-get install package-name/unstable apt-get -t unstable install package-name
The first will not attempt to upgrade any packages on your system, so if specific dependencies are not met, the install will fail. The second method will attempt to install/upgrade any dependencies. Of course, given the above example, 'apt-get' will ask you before proceeding.

E: Dynamic MMap ran out of room

You may find that you receive an error like the following:
E: Dynamic MMap ran out of room
E: Error occured while processing sqlite3 (NewPackage)
E: Problem with MergeList /var/lib/apt/lists/ftp.us.debian.org_debian_dists_wheezy_contrib_binary-amd64_Packages
E: The package lists or status file could not be parsed or opened.

This is caused because apt's cache is too small to handle all of the packages that are included with stable, testing, and unstable. This is also very easy to fix. Add the following line to /etc/apt/apt.conf
APT::Cache-Limit "8388608";

For Laptops

Do:
apt-get install wmbattery wmnd volumeicon xbacklight
Add to .fluxbox/startup:
wmbattery &
wmnd &
volumeicon &


In volume icon preferences (right click on the icon) set the hot keys XF86AudioMute, XF86AudioVolumeUp, XF86AudioVolumeDown. I also set Left Mouse to "Show Slider" There are lots of ways to control screen brightness. I had to google my specifics and use what I found online. Good Luck.

To make you screen brightness keys work use Xev to find the key codes for you backlight and add them to ~/.fluxbox/keys with a command like:
xbacklight -inc 10
This will increase your screen brightness by 10% each time its called. xbacklight -dec 10
Like wise this will decrease your screen brightness by 10% each time.
EDIT:
I now use "cbatticon" to replace wmbattery and xtrlock for locking my computer when i close the lid. The original source code didn't work for me. I ended stripping out a bunch of elements I didn't need. Unfortunatly I lost the source code changes I made and haven't had the time to re-create them.


References:

 [1] https://github.com/ilikenwf/apt-fast
 [2] http://rjha94.blogspot.com/2012/05/vmware-tools-on-debian-wheezy-inside.html
 [3] http://communities.vmware.com/message/2045689#2045689
 [4] http://communities.vmware.com/message/1651366#1651366
 [5] removed
 [6] http://fluxbox.sourceforge.net/docs/en/newdoc.menuedit.php
 [7] http://maketecheasier.com/beginners-guide-to-fluxbox-configuration/2010/01/19
 [8] http://www.ducea.com/2006/06/18/linux-tips-password-usage-in-sudo-passwd-nopasswd/
 [9] http://wiki.debian.org/Fonts/
 [10] http://fonts.debian.net/
 [11] http://spf13.com/post/perfect-vimrc-vim-config-file
 [12] http://backports-master.debian.org/Instructions/
 [13] http://wiki.debian.org/AptPreferences
 [14] http://sathyz.wordpress.com/2011/12/22/apt-get-update-only-required-translations/
 [15] http://lists.debian.org/debian-user/2011/09/msg00059.html
 [16] http://code.google.com/p/chromium/wiki/ChromiumBrowserVsGoogleChrome
 [17] http://news.softpedia.com/news/Google-Chrome-vs-Chromium-Understanding-Stable-Beta-Dev-Releases-and-Version-No-140060.shtml
 [18] http://wiki.debian.org/PDF
 [19] http://wiki.debian.org/FlashPlayer
 [20] https://github.com/valr/cbatticon

1 comment:

  1. Thank you burnclouds for the awesome installation tutorial. I've been trying for two weeks to tune fluxbox. Your post helped me a lot.

    ReplyDelete