Installing An Arch Desktop

From BrainwreckedTech's Wiki
Jump to: navigation, search
Stop hand nuvola.svg

WARNING: The scripts on this page have NOT been completely verified

The following scripts need verification:

netcfg, rc.conf, NFS, AWN Network Error In Weather Fix

Keep a backup copy handy in case something goes horribly wrong.

Arch Linux is quite different from other distributions. It focuses on minimalism, ease of configuration, and keeping a hand-off approach. This can be daunting for those accustomed to other Linux distributions.

  • Rather than maintaining fixed releases, Arch uses a rolling release system. There is no "Arch n.n"
  • There is no branding whatsoever outside of the boot-up screen. And even then, it's only the unique way in which Arch brings up the system.
  • The Arch installer presents only a base system. There are no pre-sets for common server types or desktop environments.
  • Choices for piecing together your own system can be staggering.

This article will attempt to get you up an running with a base desktop system. The choices will lean towards being light (slim, deadbeef, epdfview, etc.) but some heavy punches will be thrown in (compiz, firefox, umplayer, etc.).

Contents

Installation

Choosing a Mirror

This is the only tricky part of the installation. Arch presents a list of mirrors in a set-but-non-apparent order. If you don't have an existing Arch installation you can visit http://www.archlinux.org/mirrorlist/ and manually enter in the top mirror from that list. Otherwise, you can run Reflector on another Arch installation and use the top mirror from that list.

Post-Installation

Remote Control

It may be easier to set up a new box from another computer using SSH.

pacman -Sy --needed --noconfirm openssh
/etc/rc.d/sshd start

You can now use use SSH (PuTTY if using Windows) to set up the target computer remotely.

Console Configuration

Stronger Password Hashes

By default Arch uses SHA-512 now. If you have an older installation you may still be using MD5 to hash passwords in /etc/shadow. These commands change the hashing algorithm to SHA-512.

sed -i 's/md5 shadow nullok/sha15 shadow nullok/g' /etc/pam.d/passwd
sed -i 's/^CRYPT=des/CRYPT=sha512/g' /etc/default/passwd
echo 'ENCRYPT_MEHTOD SHA512' >> /etc/login.defs
passwd

Persistent Network Names

By default Arch lets detection order determine network name order. Even if you specify the order to load network modules in, you still have a 1% chance that the order changes. The only guaranteed way is to use udev rules.

for DEVICE in /sys/class/net/*; do
  MACADDR=`udevadm info -a -p $DEVICE | grep address | cut -d'"' -f2 | tr [A-E] [a-e]`
  DEVNAME=`echo $DEVICE | cut -d/ -f5`
  [ "$DEVNAME" != "lo" ] &&
    echo 'SUBSYSTEM=="net", ATTR{address}=="'$MACADDR'", NAME="'$DEVNAME'"' >> \
    /etc/udev/rules.d/10-network.rules
 done

Determine And Use Best Mirror

The reflector package can determine the best mirror for you to use. You should put this in /etc/rc.local so you get the best mirror every time you boot the computer.

pacman -Sy reflector
echo 'reflector -l 3 -c [country] --sort rate --save /etc/pacman.d/mirrorlist' >> /etc/rc.local
/etc/rc.local

If your country name has spaces, you will have to escape it using a backslash. Example: United\ States.

Additional Programs

These are recommended programs that should be installed regardless of everything else.

pacman -Sy --needed --noconfirm \
acpid cpufrequtils cups hdparm hplip lm_sensors netcfg smartmontools sudo \
base-devel curl jshon git \
nfs-utils rpcbind
  • cpufrequtils is useless if you don't have a CPU that supports frequency scaling
  • cups is useless if you don't have any printers
  • hplip is useless if you don't have an HP printer
  • netcfg is useless if you only have one ethernet card (not including wireless)
  • base-devel is useless if you don't plan on using the AUR
  • curl jshon and git are useless if you don't plan on using packer
  • nfs-utils and rpcbind are useless if you don't plan on using NFS

Netcfg

This will copy some examples to /etc/network.d to work with.

cp /etc/network.d/examples/ethernet-static /etc/network.d/${HOSTNAME}-net
cp /etc/network.d/examples/ethernet-static /etc/network.d/${HOSTNAME}-lan
cp /etc/network.d/examples/wireless-wpa-static /etc/network.d/${HOSTNAME}-wpa

To configure an ethernet connection with a router:

sed -i 's/^ADDR=.*/ADDR=''[ip-address]''/g' /etc/network.d/${HOSTNAME}-net
sed -i 's/^GATEWAY=.*/GATEWAY=''[gateway]''/g' /etc/network.d/${HOSTNAME}-net
sed -i 's/^DNS=.*/DNS=\(''[dns-address]''\)/g' /etc/network.d/${HOSTNAME}-net

To configure an ethernet connection with no router/gateway/DNS:

sed -i 's/eth0/eth1/g' /etc/networ.d/${HOSTNAME}-lan
sed -i 's/^ADDR=.*/ADDR=''[ip-address]''/g' /etc/network.d/${HOSTNAME}-lan
sed -i 's/^GATEWAY=/#GATEWAY=/g' /etc/network.d/${HOSTNAME}-lan
sed -i 's/^DNS=/#DNS=/g' /etc/network.d/${HOSTNAME}-lan

To configure a wireless connection to a router:

sed -i 's/^ESSID=.*/ESSID=''[ESSID]''/g' /etc/network.d/${HOSTNAME}-wpa
sed -i 's/^KEY=.*/KEY=''[WPA-PSK]''/g' /etc/network.d/${HOSTNAME}-wpa
sed -i 's/^ADDR=.*/ADDR=''[ip-address]''/g' /etc/network.d/${HOSTNAME}-wpa
sed -i 's/^GATEWAY=.*/GATEWAY=''[gateway]''/g' /etc/network.d/${HOSTNAME}-wpa
sed -i 's/^DNS=.*/DNS=\(''[dns-address]''\)/g' /etc/network.d/${HOSTNAME}-wpa

CPU Frequency Scaling

AFD="acpi-cpufreq"
[ "`cat /proc/cpuinfo | grep AMD`" != "" ] &&
  AFD="powernow-k8 powernow-k7 cpufreq-nforce2"
[ "`cat /proc/cpuinfo | grep Intel`" != "" ] &&
  AFD="acpi-cpufreq speedstep-centrino speedstep-ich speedstep-smi p4-clockmod"

for CFD in $AFD; do
  modprobe $CFD 2> /dev/null && [ $? == 0 ] && WFD=$CFD && break
done

[ "$WFD" != "" ] && 
  sed -i 's/MODULES=\(.*\)/MODULES=('$WFD')/g' /etc/rc.conf &&
  echo 'echo -n "50" > /sys/devices/system/cpu/cpufreq/on_demand/up_threshold' >> /etc/rc.local
  echo 'echo -n "10" > /sys/devices/system/cpu/cpufreq/ondemand/sampling_down_factor' >> /etc/rc.local

rc.conf

sed -i 's/^interfaces=.*/interfaces=/g' /etc/rc.conf
sed -i 's/NETWORKS=\(.*\)/NETWORKS=('$HOSTNAME'-net '$HOSTNAME'-lan)/g' /etc/rc,conf 
sed -i 's/DAEMONS=\(.*\)/DAEMONS=(hwclock syslog-ng net-profiles rpcbind nfs-common netfs cpufreq @dbus @crond @cupsd @acpid @sensors)/g' /etc/rc.conf

sudo

This will configure sudo to give members of the wheel group access and also configure it to request root's password instead of your own. (So you don't have to use a very strong password for your primary login and worry about it being an access point for hackers.)

sed -i 's/#%wheel ALL=\(ALL\)\n/%wheel ALL=\(ALL\)\n/g' /etc/sudoers
echo 'Defaults rootpw' >> /etc/sudoers

NFS

For servers ONLY:

sed -i 's/^STATD_OPTS=""/STATD_OPTS="--no-notify"/g' /etc/conf.d/nfs-common.conf

For clients ONLY:

sed -i 's/^NEED_STATD=""/NEED_STATD="no"/g' /etc/conf.d/nfs-commmon.conf
sed -i 's/^NEED_IDMAPD=""/NEED_IDMAPD="yes"/g' /etc/conf.d/nfs-common.conf
echo [nfs-server-ip]:/[nfs-share] [local-mount] nfs async,rw,exec

Packer

wget https://aur.archlinux.org/packages/pa/packer/PKGBUILD -O /tmp/PKGBUILD
makepkg --asroot --install /tmp/PKGBUILD

GUI Configuration

If using a desktop, you will want to install these programs.

pacman -Sy --needed --noconfirm \
consolekit slim-themes archlinux-themes-slim gtk-engines librsvg ttf-droid \
ttf-ubuntu-font-family lxappearance ccsm compizconfig-backend-gconf \
compiz-fusion-plugins-extra emerald-themes \

SLiM

This will configure inittab so that you start at runlevel 5 and start slim automatically.

sed -i 's/^id:3/#id:3/g' /etc/inittab
sed -i 's/^#id:5/id:5/g' /etc/inittab
sed -i 's/#x:5:respawn:\/usr\/bin\/slim/x:5:respawn:\/usr\/bin\/slim/g' /etc/inittab

This will configure slim to use ck-launch-session and dbus-launch:

sed -i 's/exec \/bin\/bash/exec ck-launch-session dbus-launch \/bin\/bash/g' /etc/slim.conf

xinitrc

You will also want to configure a window manager to start up once you log in.

echo 'export LOGOUT_COMMAND=killall\ ck-launch-session &
exec compiz ccp' > ~/.xinitrc

GTK Themes

The defaults are not going to be pretty. You may want to install some packages and set some defaults for GTK.

packer -S --noedit --noconfirm elementary-icons newlooks-theme
 
echo 'gtk-theme-name="Clearlooks"
gtk-icon-theme-name="elementary"
gtk-font-name="Droid Sans 10"' > ~/.gtkrc-2.0

echo '[Settings]
gtk-application-prefer-dark-theme = false
gtk-theme-name = Newlooks
gtk-fallback-icon-theme = elementary' > ~/.config/gtk-3.0/settings.ini

Common GUI Programs (Non-AUR)

pacman -Sy --needed --noconfirm \
audacity awn-extras-applets avidemux-gtk chromium deadbeef epdfview firefox \
flashplugin galculator geany gimp-help-en gsmartcontrol gtk-recordmydesktop \
icedtea-web-java7 lxtask libreoffice-calc  libreoffice-en-us libreoffice-gnome \
libreoffice-writer hunspell-en hyphen-en mythes-en mencoder mkvtoolnix-gtk\
purple-plugin-pack pidgin-libnotify aspell-en sakura thunderbird vdpau-video \
viewnior xarchiver xchat arj lzop p7zip unrar unzip zip

Common GUI Programs (AUR)

packer -S --noedit --noconfirm mplayer2-git
packer -S --noedit --noconfirm \
graveman guvcview nautilus-elementary-bzr synapse umplayer ttf-ms-fonts ttf-tahoma

Fixes

AWN Network Error In Weather

The Weather Channel changed the HTML on its web site and broke the script.

sed -i 's/outlook\/travel\/businesstraveler/weather/g' \
/usr/share/avant-window-navigator/applets/weather/weather.py

sed -i 's/IMG/img/g' /usr/share/avant-window-navigator/applets/weather/weather.py 
sed -i 's/SRC/src/g' /usr/share/avant-window-navigator/applets/weather/weather.py
sed -i 's/NAME/name/g' /usr/share/avant-window-navigator/applets/weather/weather.py
sed -i 's/WIDTH=/width="/g' /usr/share/avant-window-navigator/applets/weather/weather.py
sed -i 's/ HEIGHT=/" height="/g' /usr/share/avant-window-navigator/applets/weather/weather.py
sed -i 's/ BORDER/" border/g' /usr/share/avant-window-navigator/applets/weather/weather.py
sed -i 's/xoap\.weather/xml\.weather/g' /usr/share/avant-window-navigator/applets/weather/weather.py

Nautilus Video Previews

The default setting for Nautilus is to use the GStreamer backend for previews. However, if you don't have the full-fledged GNOME desktop, nothing is set up. Instead of trying to mess around with GStreamer plugins, you can use ffmpegthumbnailer.

Make use you have the requirements

pacman -Sy --needed gconf ffmpegthumbnailer

Now run this script (can be copy-pasted into a terminal):

VIDEO_EXTENSIONS="video@flv video@webm video@mkv video@mp4 video@mpeg \
video@avi video@ogg video@quicktime video@x-avi video@x-flv video@x-mp4 \
video@x-mpeg video@x-webm video@x-mkv application@x-extension-webm \
video@x-matroska video@x-ms-wmv video@x-msvideo video@x-msvideo@avi \
video@x-theora@ogg video@x-theora@ogv video@x-ms-asf video@x-m4v"

THUMBNAIL_COMMAND="/usr/bin/ffmpegthumbnailer -s %s -i %i -o %o -c png -f -t 10"

for i in $VIDEO_EXTENSIONS; do
   gconftool-2 -s "/desktop/gnome/thumbnailers/$i/command" -t string "$THUMBNAIL_COMMAND"
   gconftool-2 -s "/desktop/gnome/thumbnailers/$i/enable" -t boolean 'true'
done

Pacman Cleanup

To clear out orphaned packages (useful for purging stuff needed to build but not run AUR packages):

pacman -Rcss $(pacman -Qtdq)

To clear the cache of all packages save the ones that are currently installed on the machine:

pacman -Sc
Personal tools
Namespaces
Variants
Actions
Navigation
Add data
Help
Data export
Toolbox