17 November 2010
Setting up my Arch-Linux-based production environment II
I wrote about this topic before. Here, I want to record my experience on Arch Linux after migrating from GNOME to awesome as my major window manager. GNOME is a great desktop environment; it also provides a lot of useful utilities I love (Evince, for an instance). Nevertheless, I find awesome window manager significantly increase my desktop productivity, so a migration is worthwhile.
Here is an index of the topics.
Initial Setup
According to here, as root
pacman -Syu useradd -m -g users -G audio,lp,optical,storage,video,wheel,games,power -s /bin/bash wei passwd wei
With visudo
, edit /etc/sudoers
to enable
%wheel ALL=(ALL) ALLand now we should login and work as the regular user
wei
, and use sudo
for privileged operations. For the sake of clarity, we omit sudo
in the following command snippet; the context should make it clear if a sudo
is warranted.
I choose to use the simple and robust netcfg utility to manage my network connectivity. According to here, install the following packages with
pacman -S wpa_actiond ifplugd wifi-selectand add to
rc.conf
the following lines
WIRELESS_INTERFACE="wlan0" WIRED_INTERFACE="eth0" ... DAEMONS=(... !network net-auto-wireless net-auto-wired ...)
Install and configure Advanced Linux Sound Architecture (ALSA) has been detailedly described here. Basically, after pacman -S alsa-utils
, run alsamixer
as wei
(rather than root
) and store the setting with sudo alsactl store
. Of course, do not forget to add alsa
to the DAEMONS
array in /etc/rc.conf
.
If you find the system beeping annoying as I do, you may disable it by adding !snd_pcsp !pcspkr
to the MODULES
array in /etc/rc.conf
as
# Scan hardware and load required modules at bootand unload it with
MOD_AUTOLOAD="yes"
# Load the following modules (do not load with the ! prefix)
MODULES=(... !snd_pcsp !pcspkr ...)
lsmod | grep -i spkrif you already have loaded it.
rmmod pcspkr
Having NTPD to automatically synchronize with time server is handy. See the instructions.
pacman -S ntpand add
ntpd
to DAEMONS
in /etc/rc.conf
. We can enable it right away by /etc/rc.d/ntpd start
.
Since we are going to pull a lot of stuff from AUR, we are better off to install an AUR helper at this point. I used to use the tried yaourt; but now I use packer.
wget http://aur.archlinux.org/packages/packer/packer.tar.gz tar xvfz packer.tar.gz cd packer makepkg -s pacman -U packer-....pkg.tar.xz packer -S pacman-colorNow, we can use
packer -S
to pull from AUR or simply replace pacman
for installation.
On my laptop, I do the following according to these instructions
packer -S acpi acpid laptop-mode-tools cpufrequtils pm-utils
I install the "outdated" batterymon
by
packer -S batterymonIt does not run out of the box due to Python's 2 to 3 migration. An easy fix is to edit the shebang of
/usr/bin/battery
to /usr/bin/env python2
. For it to work, be sure to start dbus and hal by /etc/rc.d/dbus start
and /etc/rc.d/hal start
. Add (... dbus hal ...)
to DAEMONS
in /etc/rc.conf
. As noted here, dbus should procedes hal.
Setup the Desktop
The instructions are here. Basically, we need to do
packer -S xorg mesa
lspci | grep -i vga
packer -S xf86-video-<chip>
Install fonts with
packer -S ttf-ms-fonts ttf-dejavu ttf-bitstream-vera
We can start installing awesome according to these instructions.
packer -S --noedit awesome rlwrap feh xscreensaver
Edit $HOME/.xinitrc
. I use
/usr/bin/xscreensaver -no-splash & xset dpms 600 900 1200 { sleep 1 && xmodmap -e 'remove lock = Caps_Lock' -e 'add shift = Caps_Lock' \ -e 'remove mod1 = Alt_R' -e 'add mod4 = Alt_R'; } & exec ck-launch-session awesome
Install slim
for display manager (Login interface) by
packer -S slim slim-themes archlinux-themes-slimand edit
/etc/slim.conf
. This file is nicely commented and you should be able to figure it out without much difficulty. A few tweaks I use are
sessions awesome #current_theme rear-window current_theme archlinux-soft-grey default_user weiThe themes are listed in
/usr/share/slim/themes/
.
Edit /etc/inittab
as follows
id:5:initdefault: ... x:5:respawn:/usr/bin/slim >/dev/null 2>&1
Now we can reboot and log into awesome via slim.
Install Utilities
General
To make the rest of the procedure goes smoothly,
packer -S bash-completion
echo 'set show-all-if-ambiguous on' >> ~/.inputrc
Install the following packages (YMMV)
packer -S rxvt-unicode sakura gksu gvim gnupg conky wmname packer -S openssh putty firefox chromium uzbl-browser lynx mutt lftp git nmap aircrack-ng packer -S --noedit tmux byobu screen irssi packer -S emacs racket sbcl slime-cvs packer -S gimp graphviz gnuplot xfig transfig fig2eps octave octave-forge r sage-mathematics packer -S ntfs-3g gstreamer0.10-plugins gstreamer0.10-pulse mplayer mpd mpc ncmpcpp radiotray #packer -S thunar thunar-volman thunar-archive-plugin xarchiver #packer -S thunar-media-tags-plugin thunar-thumbnailers packer -S qtfm mc autofs lsof sshfs packer -S xarchiver gzip bzip2 zip unzip unrar p7zip packer -S totem totem-plparser totem-plugin vlc vlc-plugin packer -S gstreamer0.10-ugly-plugins gstreamer0.10-bad-plugins gstreamer0.10-ffmpegHere are my configurations for Vim, Emacs, Conky, qtfm, MPD, and uzbl.
autofs needs some initial setup; make sure to check this ArchWiki entry out! In summary, you need to
modprobe autofs4 fuse
; also add them to theMODULES
line to your/etc/rc.conf
.- Edit
/etc/autofs/auto.master
. Set proper--timeout
, e.g.,--timeout=600
sets auto-umount timeout to 600 seconds (10 minutes). - A good suggestion is to
visudo
yoursudoers
file with the lineALL ALL=(ALL) NOPASSWD: /usr/bin/killall -USR1 automount
, which allows non-privileged user to umount withkillall -USR1 automount
. Seeautomount(8)
for the explanation of-USR1
signal. - Add a line
automount: files
to/etc/nsswitch.conf
. - Add
automount
's startup option to/etc/conf.d/autofs
'sdaemonoptions
option, e.g.,daemonoptions='--verbose'
. Start the service with/etc/rc.d/autofs start
/etc/autofs/auto.master
is
/media /etc/autofs/auto.media --timeout=600 /media/ssh /etc/autofs/auto.ssh --timeout=600My
/etc/autofs/auto.media
is
# This is an automounter map and it has the following format # key [ -mount-options-separated-by-comma ] location # Details may be found in the autofs(5) manpage cdrom -fstype=iso9660,ro,nodev,nosuid :/dev/cdrom #floppy -fstype=auto,async,nodev,nosuid,umask=000 :/dev/fl usb1 -fstype=auto,async,nodev,nosuid,umask=000 :/dev/sdb1 usb2 -fstype=auto,async,nodev,nosuid,umask=000 :/dev/sdc1 usb3 -fstype=auto,async,nodev,nosuid,umask=000 :/dev/sdd1 usb4 -fstype=auto,async,nodev,nosuid,umask=000 :/dev/sde1Now you can automount your USB by simply accessing
/media/usb*
;
Relevant references are autofs(5), auto.master(5), automount(8), automount mini-howtos, and GentooWiki entry.My
/etc/autofs/auto.ssh
looks like (server.my.net
is my server's hostname)
server -fstype=fuse.sshfs.sshfs,rw,allow_other,IdentityFile=/home/wei/.ssh/id_dsa,port=22 \ :pw@server.my.net\:/home/pw/Before
killall -HUP automount
or /etc/rc.d/autofs restart
, follow the procedure outlined in this
ArchWiki entry first. In particular,
ssh-keygen -t dsa ssh-copy-id -i /home/pw/.ssh/id_dsa.pub pw@server.my.net sudo ssh -i /home/pw/.ssh/id_dsa pw@server.my.netAs noted in the entry, the last line is important: it adds the remote servers to
root
's ~/.ssh/known_hosts
list; otherwise, ssh
will get hung on the server fingerprint warning and wait in the background (of autofs
) forever.
Now I can access the files on server.my.net
through /media/ssh/server/
. Convenient, isn't it?
Use Firefox's Add-On manager to add the following extensions:
Vimperator
(the reason to stay with Firefox; a recommended try for any Vim user),
Forecastfox Weather
,
Adblock Plus
,
mozplugger
.
A few quickmarks are handy for Vimperator
(use M<char>
to add a quickmark <char>
; then we can use go<char>
or gn<char>
to quickly access the page)
g -> www.google.comand so on.
s -> scholar.google.com
d -> docs.google.com
c -> www.google.com/calendar/render
m -> www.gmail.com
M -> maps.google.com
u -> umail.iu.edu
o -> onestart.iu.edu
e -> edas.info
f -> www.facebook.com
r -> www.renren.com
h -> www.cs.iupui.edu/~pengw/
k -> slickdeals.net
y -> www.youtube.com
S -> mitpress.mit.edu/sicp/full-text/book/book-Z-H-4.html#%_toc_start
If you find Firefox a bit sluggish sometimes, try Chromium. A few of the extensions I use are Adblock, Forecastfox Weather, Speed Dial, Ultimate Chrome Flag, Facebook Photo Zoom, Google Mail Checker Plus. Wish Vimperator will be ported to Chromium some day.
[multilib]
In our Arch64 setup, since we have enabled[multilib]
in /etc/pacman.conf
, packer -S libdvdread libdvdcss flashplugin skype
Networking
Do not forget to allow others to use your SSH service by adding to the file /etc/hosts.allow
sshd: ALL
Enable SSH's X11 forwarding by editing /etc/ssh/sshd_config
with
X11Forwarding yesbut be aware of the hazard of doing so (forewarned is forearmed). Add
sshd
to the DAEMONS
array in /etc/rc.conf
and start it with /etc/rc.d/sshd start
.
Install optional dependencies for Empathy (packer -Qi empathy
) to make it work correctly
packer -S telepathy-butterfly telepathy-farsight telepathy-gabble telepathy-glib \
telepathy-haze telepathy-idle telepathy-salut telepathy-sofiasip
Pidgin serves as an alternative to Empathy. Install with packer -S pidgin purple-plugin-pack aspell-en pidgin-otr pidgin-libnotify guifications microblog-purple
. Use pacman -Ss aspell
to list aspell's dictionary in other languages.
As regard to Skype microphone or voice problem, first check ALSA's configurations
alsamixerIn particular, press
sudo alsactl store
[F4]
and press [SPACE]
on Capture
to enable it (press [F1]
for usage). See here for more information.
Documentation
packer -S texlive-most lyx jabref xchm evinceSee here for a few LaTeX styles (e.g., IEEEtran). Simply extract the package into
packer -S openjdk6
packer -S ttf-dejavu artwiz-fonts ttf-ms-fonts
packer -S libreoffice
$HOME
should work, i.e., tar xvf texmf.tgz
.
Chinese Language Environment
Install Chinese fonts with
packer -S ttf-arphic-ukai ttf-arphic-uming ttf-fireflysung
A Chinese input method is essential for everyday use. For this purpose, I find ibus-pinyin
a good choice.
packer -S ibus-pinyinand configure it via
/usr/bin/ibus-setup
.
Remember to install LibreOffice's Chinese language support
packer -S libreoffice-zh-CN
Desktop
Crispy Look
One thing I like about Ubuntu is its crispy look out of the box. Fortunately, it is easy to get the look by using the LCD filter patched packages Do not panic if you find the look turns worse, because this is the caterpillar about to transform into butterfly
packer -S --noedit freetype2-ubuntu fontconfig-ubuntu libxft-ubuntuLogout and login again. Enjoy the new look. :-)
Configuration Revisit
The following is the $HOME/.xinitrc
on my laptop
source $HOME/.bashrc ibus-daemon -d -x -r -n awesome #urxvtd -q -o -f #thunar --daemon & #batterymon -n 10 & mpd $HOME/.mpd/mpd.conf radiotray & ## Fun with XRandR settings # Scenario 1 #xrandr --output LVDS1 --preferred #xrandr --output VGA1 --preferred #xrandr --output LVDS1 --primary #xrandr --output VGA1 --right-of LVDS1 # Scenario 2 #xrandr --fb 1920x1080 --output LVDS1 --scale 1.33x1.2 --output VGA1 --preferred # Scenario 3 #xrandr --fb 1920x1080 --output LVDS1 --off --output VGA1 --preferred xscreensaver -no-splash & #xrdb -merge $HOME/.Xresources xset dpms 600 900 1200 ( sleep 1 && xmodmap -e 'remove lock = Caps_Lock' -e 'add shift = Caps_Lock' \ -e 'remove mod1 = Alt_R' -e 'add mod4 = Alt_R'; ) & ( sleep 1; wmname LG3D && true ) & # fix JDK problem exec ck-launch-session awesome
The awesome
configuration I use is here, which you can use by extracting it into your $HOME
. Highlights of my tweaks are
- Remove a few layouts which I reckon as less useful
-
Add a few key bindings to the default for quick access of programs. Such as
modkey+c -> Edit awesome configuration modkey+F1 -> Awesome manual page modkey+Mod1+o -> Terminal ("sakura") modkey+Mod1+r -> Terminal as root ("gksudo urxvt") modkey+Mod1+l -> File manager ("qtfm") modkey+Mod1+m -> File manager ("mc") modkey+Mod1+b -> Browser ("chromium") modkey+Mod1+i -> Editor ("gvim") modkey+Mod1+p -> Remote terminal ("putty") modkey+Mod1+c -> System monitor ("conky") modkey+Mod1+Return -> Lock screen ("xscreensaver-command -l")
-
Add a few keyboard shortcuts, for example, control
MPD
with multimedia key, controlALSA
volume with sound keys, US Standard keyboard layout (modkey+Shift+F1
), US Dvorak keyboard layout (modkey+Shift+F2
), switch between keyboard layouts (modkey+mod1+space
),awesome
manual page (modkey+F1
), and editawesome
configuration filerc.lua
withGVim
(modkey+c
); please readrc.lua
for the detail.
... and Remember to Update the System
Do update and upgrade your system from time to time with
packer -SyuThis is the beauty of a rolling release distro like Arch.