Installing An Arch Desktop: Difference between revisions
m →Preliminary System Setup: Removed Packer Setup |
m →Make InitRAM Images: changed -p linux to -P |
||
Line 266: | Line 266: | ||
==Make InitRAM Images== | ==Make InitRAM Images== | ||
mkinitcpio - | mkinitcpio -P | ||
==Install GRUB2== | ==Install GRUB2== |
Revision as of 09:42, 6 March 2014
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.
One of the side-benefits from Arch's KISS approach is that it is relatively trivial to install Arch from an existing Arch system, including the installation ISO. For the sake of simplicity, this article will only cover the setup of an Arch system using SLiM and Compiz + Emerald. These are by no means the only choice for a desktop system.
Pre-Installation
Arch Install Scripts
If you are using the Arch Installation Media, the arch-install-scripts package is already installed. If you are installing from an existing installation, you can use pacman to install this script to the host machine.
pacman -Sy arch-install-scripts
The remmainder of thsi wiki article will assume that you have theses script installed.
Networking
By default, the Arch installation ISO will bring up and try to get a DHCP lease for all detected network devices. PXE boot will give the adapter an IP but no routing information. A fresh install of Arch does absolutely nothing with networking interfaces by default.
dhcpcd [interface]
If you do not use DHCP, you will have to use these commands to use static addressing:
ip addr $IPAD/$NMSK broacast $BCST dev eth0 ip route add default via $GTWY ip link set dev $NDIF up
If you are using wifi, the Arch Installation Media has wifi-menu installed for easy CLI configuration of wifi.
Remote Setup Via SSH
If you are using the Arch Installation Media, you may want to use SSH to set up the machine remotely. The most common reason for this is so you can use another machine to look things up for you new installation, and so you can do other work while the Arch is being installed. If you are using an existing Arch system to set up another Arch system, there is no need for SSH.
By default, SSH will not allow password-less logins. The simplest fix is to run passwd and set one before enabling SSH
passwd && systemctl start sshd.service
Pacman Repository Selection
Once networking is up, you'll want to be sure you are using the fastest mirror. To do this, install reflector. You can safely skip upgrading pacman (for now -- this may change in the future.)
pacman -Sy reflector
You can now use reflector to automatically choose the fastest mirrors for you.
CNTY="United States" && reflector -l 5 -c "$CNTY" --sort rate --save /etc/pacman.d/mirrorlist
Creating Target Filesystem
Use parted and/or fdisk to create the target partition(s) for your installation. Then format and mount the partition(s).
TRGT=/dev/sda2 && FSYS=ext4 mkfs -t $FSYS $TRGT && mount $TRGT /mnt
Swap Space
SWPG=1 && SWPL=/mnt/swapfile dd if=/dev/zero of=$SWPL bs=1M count=`expr 1024 \* $SWPG` mkswap $SWPL && chmod 600 $SWPL && swapon $SWPL
Installing The System
You can pick and choose from the following lines.
PKGS="acpid base cpupower lm_sensors ncdu ntp reflector sudo" PKGS="$PKGS grub-bios os-prober" # GRUB2 boot loader PKGS="$PKGS alsa-utils alsa-plugins libsamplerate" # ALSA PKGS="$PKGS dosfstools ntfsprogs" # Microsoft filesystems PKGS="$PKGS hdparm parted smartmontools" # Extra drive utils PKGS="$PKGS hwdetect lshw" # Extra hardware tools PKGS="$PKGS arj lzop p7zip unrar unzip zip" # Compressed archives PKGS="$PKGS base-devel wget" # For compiling (AUR) PKGS="$PKGS curl jshon git" # For compiling packer PKGS="$PKGS cups sane" # For printing/scanning PKGS="$PKGS openssh" # For remote control PKGS="$PKGS nfs-utils" # For NFS client/server PKGS="$PKGS samba" # For Samba Server PKGS="$PKGS rsync" # For remote file sync PKGS="$PKGS xorg-server xorg-utils xorg-xinit xorg-xrandr" # For GUI Desktop PKGS="$PKGS xf86-video-vesa" # Generic VESA driver PKGS="$PKGS xf86-video-intel" # Intel opensrc PKGS="$PKGS xf86-video-ati" # ATI opensrc PKGS="$PKGS xf86-video-nouveau" # NVIDIA opensrc PKGS="$PKGS nvidia nvidia-utils vdpau-video" # NVIDIA closed all PKGS="$PKGS ttf-droid ttf-ubuntu-font-family" # Extra fonts PKGS="$PKGS gtk-engines librsvg lxappearance" # GTK2 Themes & Config PKGS="$PKGS hplip pil" # HPLIP PKGS="$PKGS python2-reportlab python2-notify python2-dbus python2-pyqt" # HPLIP PKGS="$PKGS xsane-gimp" # Scanner support PKGS="$PKGS slim slim-themes archlinux-themes-slim" # SLIM Display Manager PKGS="$PKGS compizconfig-backend-gconf compiz-fusion-plugins-extra" # Compiz PKGS="$PKGS ccsm emerald-themes" # Compiz + Emerald PKGS="$PKGS galculator gucharmap lxtask mcomix sakura viewnior xdialog" # Miscellaneous PKGS="$PKGS xfburn gnucash gtk-recordmydesktop" # Miscellaneous PKGS="$PKGS virtualbox virtualbox-guest-iso wine_gecko" # Emulation PKGS="$PKGS gksu gparted gsmartcontrol" # GUI Frontends PKGS="$PKGS audacity deadbeef" # Audio PKGS="$PKGS gimp-help-en inkscape" # Graphics PKGS="$PKGS avidemux-gtk libdvdcss mediainfo mencoder mkvtoolnix-gtk" # Multimedia PKGS="$PKGS chromium firefox flashplugin midori opera" # Browsers PKGS="$PKGS epdfview geany" # Doc View/Edit PKGS="$PKGS libreoffice-calc libreoffice-en-US libreoffice-writer" # LibreOffice PKGS="$PKGS hunspell-en hyphen-en mythes-en aspell-en" # Dict,Thes,etc. PKGS="$PKGS pidgin-libnotify purple-plugin-pack skype xchat" # IM / Chat / VoIP PKGS="$PKGS thunderbird" # Email PKGS="$PKGS lib32-nvidia-utils lib32-alsa-plugins lib32-libsamplerate" # 32-libs for 64-bit
pacstrap /mnt $PKGS genfstab -pL /mnt >> /mnt/etc/fstab echo -e "/swapfile\tnone\tswap\tdefaults\t0 0" >> /mnt/etc/fstab arch-chroot /mnt
Preliminary System Setup
DAEMONS Setup
systemctl enable acpid.service lm_sensors.service smartd.service nfs-wait-online.service ntpd.service cups.service cronie.service cpupower.service slim.service
Hardware Clock
It is usually best to have the hardware clock set to UTC. If you aboslutely must have the hardware clock set to local time:
echo -e "0.0 0.0 0.0\n0\nLOCALTIME" > /etc/adjtime
Time Zone
ln -s /usr/share/zoneinfo/[Country]/[City] /etc/localtime
NB: You can use [TAB] completion to help yourself out.
Host Name
read -p "Enter the host name of the new system: " NHST && echo $NHST > /etc/hostname
Locale
The system will bitch during mkinitcpio if this is not set up.
LANG=en_US.UTF-8 && LCCL=POSIX sed -i "s/#${LOCL:0:5}/${LOCL:0:5}/g" /etc/locale.gen echo "LANG=$LANG\nLC_COLLATE=$LCCL" > /etc/locale.conf locale-gen
Console Font
KYMP=us echo -e "FONT=Lat2-Terminus16\nKEYMAP=$KYMP" > /etc/vconsole.conf
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-common.conf sed -i 's/^NEED_IDMAPD=""/NEED_IDMAPD="yes"/g' /etc/conf.d/nfs-common.conf read -p "Enter NFS server IP: " NFIP && read -p "Enter NFS mount point: " NFMT && echo -e "$NFIP:/\t$NFMT\tnfs\tasync,rw,exec\t0 0" >> /etc/fstab sed -i "s/network/network rpcbind nfs-common netfs/g" /etc/rc.conf
Netcfg
Netcfg is a more robust solution compared to using the settings available in rc.conf.
This will copy some examples to /etc/network.d to work with.
cp /mnt/etc/network.d/examples/ethernet-static /etc/network.d/${NHST}-net cp /mnt/etc/network.d/examples/ethernet-static /etc/network.d/${NHST}-lan cp /mnt/etc/network.d/examples/wireless-wpa-static /etc/network.d/${NHST}-air
This will disable the DNS and GATEWAY directives for ${HOSTNAME}-lan:
sed -i 's/^GATEWAY=/#GATEWAY=/g' /etc/network.d/${NHST}-lan sed -i 's/^DNS=/#DNS=/g' /etc/network.d/${NHST}-lan
This will set the DNS and GATEWAY directives for ${HOSTNAME}-net and ${HOSTNAME}-air:
read -p "Enter router's IP address: " RTIP && \ sed -i 's/^GATEWAY=.*/GATEWAY="'$RTIP'"/g' /etc/network.d/${NHST}-net && \ sed -i 's/^GATEWAY=.*/GATEWAY="'$RTIP'"/g' /etc/network.d/${NHST}-air && \ sed -i 's/^DNS=.*/DNS=\("'$RTIP'"\)/g' /etc/network.d/${NHST}-net && \ sed -i 's/^DNS=.*/DNS=\("'$RTIP'"\)/g' /etc/network.d/${NHST}-air
This will set the IP addresses for all three connections:
read -p "Enter IP addresses for NET, LAN, and WPA: " -a IPAD && \ sed -i "s/^ADDR=.*/ADDR='${IPAD[0]}'/g" /etc/network.d/${NHST}-net && \ sed -i "s/^ADDR=.*/ADDR='${IPAD[1]}'/g" /etc/network.d/${NHST}-lan && \ sed -i "s/^ADDR=.*/ADDR='${IPAD[2]}'/g" /etc/network.d/${NHST}-air
To configure a wireless connection to a router:
read -p "Enter the wireless SSID: " -n ESID && read -p "Enter the wireless password: " -n WPSK && sed -i 's/^ESSID=.*/ESSID=''$ESID''/g' /etc/network.d/${NHST}-wpa && sed -i 's/^KEY=.*/KEY=''$WPSK''/g' /etc/network.d/${NNHST}-wpa
Now it's time to edit /etc/conf.d/netcfg and /etc/rc.conf.
For desktops with constant connections, edit the NETWORKS array to bring up all interfaces at boot time.
sed -i "s/NETWORKS=.*/NETWORKS=$NHST-lan $NHST-net $NHST-air/g" /etc/conf.d/netcfg sed -i 's/network/net-profiles/g' /etc/rc.conf
For laptops with connections that are not guaranteed, all you need to touch (by default) is the AUTO_PROFILES string.
sed -i 's/#WIRED_INTERFACE.*/WIRED_INTERFACE="'$NHST'-net"/g' /etc/conf.d/netcfg sed -i 's/#WIRELESS_INTERFACE.*/WIRELESS_INTERFACE="'$NHST'-air"/g' /etc/conf.d/netcfg sed -i 's/#AUTO_PROFILES.*/AUTO_PROFILES="\('$NHST'-net '$NHST'-air\)"/g' /etc/conf.d/netcfg sed -i 's/network/net-auto-wired net-auto-wireless/g' /etc/rc.conf
mkinitcpio
The default HOOKS should work fine. Just need to add the consolefont and keymap hooks.
eval $(cat /etc/mkinitcpio.conf | grep ^HOOKS) $HOOKS+=" consolefont keymap" sed -i "s/^HOOKS=.*/HOOKS=\"$HOOKS\"/g" /etc/mkinitcpio.conf
makepkg
The first thing to do to optimize compiled code is to specify that we're using the PC architecture.
sed -i 's/-unknown-linux-gnu/-pc-linux-gnu/g' /etc/makepkg.conf
Next, allow GCC to auto-detect CPU features.
sed -i 's/-march=\S* -mtune=generic/-march=native/g' /etc/makepkg.conf
Lastly, take advantage of SMP if available.
CORS=`cat /proc/cpuinfo | grep -i cpu\ cores | uniq | cut -d: -f2` sed -i 's/#MAKEFLAGS=.*/MAKEFLAGS="-j'`expr 1 + $CORS`'"/g' /etc/makepkg.conf
Enable [multilib] on 64-bit systems
CPUTYPE=`lscpu | grep Architecture | cut -d: -f2 | sed 's/[ \t]*//g'` [[ $CPUTPYE == x86_64 ]] && sed -i ':a;N;$!ba;s/#\[multilib\]\n#SigLevel\(.*\)\n#Include\(.*\)/\[multilib\]\nSigLevel\1\nInclude\2/g' /etc/pacman.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) ALL/%wheel ALL=(ALL) ALL/g' /etc/sudoers echo 'Defaults rootpw' >> /etc/sudoers
SLiM (GUI Only)
sed -i 's/exec \/bin\/bash/exec dbus-launch \/bin\/bash/g' /etc/slim.conf
Make InitRAM Images
mkinitcpio -P
Install GRUB2
grub-mkconfig -o /boot/grub/grub.cfg grub-install ${TRGT:0:8}
Stuff That Can Only Be Done If Current Machine Is Installation Target
Persistent Network Names
By default Arch lets detection order determine device 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
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/^#governor=.*/governor=ondemand/g' /etc/conf.d/cpupower sed -i 's/@crond/@crond cpupower/g' /etc/rc.conf echo 'echo -n "50" > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold' >> /etc/rc.local echo 'echo -n "10" > /sys/devices/system/cpu/cpufreq/ondemand/sampling_down_factor' >> /etc/rc.local
Finish System Setup
exit umount /mnt reboot
Post-Installation
Sensors
Sensors cannot be configured in chroot. It must be done once the target installation machine has booted the new system.
sensors-detect
GUI Configuration
ATI Video Drivers
ATI is a little...special...when it comes to the proprietary driver. As ATI is slow to adopt new revisions of Xorg, the proprietary driver is NOT in the official repositories.
sed -i 's/\[core\]/\[catalyst\] SigLevel = Never Server = http:\/\/catalyst.apocalypsus.net\/repo\/catalyst\/\$arch \n[core\]/g' /etc/pacman.conf pacman -S --noconfirm catalyst catalyst-utils xvba-video lib32-catalyst-utils
aticonfig --initial
GTK Themes
The defaults are not going to be pretty outside of the GNOME desktop environment. You may want to install some packages and set some defaults for GTK.
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 = Clearlooks-Phenix gtk-icon-theme = elementary' > ~/.config/gtk-3.0/settings.ini
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