Installing An Arch Desktop: Difference between revisions

From The Brainwrecked Wiki
Jump to navigation Jump to search
m Networking: Added PXE information, changed wifi-select to wifi-menu
m NFS: Removed obsolete NFS configuration information
 
(16 intermediate revisions by the same user not shown)
Line 8: Line 8:
* Choices for piecing together your own system can be staggering.
* 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.
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 LXDM and Compiz + Emerald.  These are by no means the only choice for a desktop system.


=Pre-Installation=
=Pre-Installation=
Line 18: Line 18:
  pacman -Sy arch-install-scripts
  pacman -Sy arch-install-scripts


'''''The remmainder of thsi wiki article will assume that you have theses script installed.'''''
'''''The remmainder of this wiki article will assume that you have theses script installed.'''''


==Networking==
==Networking==
Line 28: Line 28:
If you do not use DHCP, you will have to use these commands to use static addressing:
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 addr [ip-address]/[net-mask] broacast [broadcast] dev eth0
  ip route add default via $GTWY
  ip route add default via $GTWY
  ip link set dev $NDIF up
  ip link set dev $NDIF up
Line 50: Line 50:
You can now use <tt>reflector</tt> to automatically choose the fastest mirrors for you.
You can now use <tt>reflector</tt> to automatically choose the fastest mirrors for you.


  CNTY="United States" && reflector -l 5 -c "$CNTY" --sort rate --save /etc/pacman.d/mirrorlist
  reflector -l 5 -c "[country]" --sort rate --save /etc/pacman.d/mirrorlist


==Creating Target Filesystem==
==Creating Target Filesystem==
Line 56: Line 56:
Use <tt>parted</tt> and/or <tt>fdisk</tt> to create the target partition(s) for your installation.  Then format and mount the partition(s).
Use <tt>parted</tt> and/or <tt>fdisk</tt> to create the target partition(s) for your installation.  Then format and mount the partition(s).


TRGT=/dev/sda2 && FSYS=ext4
  mkfs -t [fs-type] [device] && mount [device] /mnt/system
  mkfs -t $FSYS $TRGT && mount $TRGT /mnt


==Swap Space==
==Swap Space==


SWPG=1 && SWPL=/mnt/swapfile
  dd if=/dev/zero of=/mnt/system/swapfile bs=1M count=[megabytes]
  dd if=/dev/zero of=$SWPL bs=1M count=`expr 1024 \* $SWPG`
chmod 600 /mnt/system/swapfile
  mkswap $SWPL && swapon $SWPL
  mkswap /mnt/system/swapfile
swapon /mnt/system/swapfile


=Installing The System=
=Installing The Base System=


You can pick and choose from the following lines.
  PKGS+=" base acpid dcfldd iotop ix ncdu parted rsync sudo tmux"               # General Utilities
 
  PKGS+=" dosfstools mtools ntfs-3g smbclient nfs-utis"                         # Filesystem Utilities
PKGS="acpid base cpupower lm_sensors ncdu ntp reflector sudo"
  PKGS+=" cpupower dmidecode hddtemp hdparm hwdetect lm_sensors lshw inxi smartmontools" # Hardware Utilities
PKGS="$PKGS grub-bios os-prober"                                        # GRUB2 boot loader
  PKGS+=" dnsutils net-tools nfs-utils ntp openssh reflector whois wget"       # Network Utilities
PKGS="$PKGS alsa-utils alsa-plugins libsamplerate"                       # ALSA
  PKGS+=" arj lzop p7zip unrar zip"                                            # Compression Utilities
PKGS="$PKGS dosfstools ntfsprogs"                                        # Microsoft filesystems
   
PKGS="$PKGS hdparm parted smartmontools"                                 # Extra drive utils
  pacstrap /mnt/system $PKGS
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
<!--
PKGS="$PKGS openbox openbox-themes cairo-compmgr"                          # OpenBox
-->


pacstrap /mnt $PKGS
=Configuring The Base System=
genfstab -pL /mnt >> /mnt/etc/fstab
echo -e "/swapfile\tnone\tswap\tdefaults\t0 0" >> /mnt/etc/fstab
arch-chroot /mnt


=Preliminary System Setup=
==fstab==


==DAEMONS Setup==
genfstab -pL /mnt/system >> /mnt/system/etc/fstab
echo -e "/swapfile\tnone\tswap\tdefaults\t0 0" >> /mnt/system/etc/fstab


  systemctl enable acpid.service lm_sensors.service smartd.service nfs-wait-online.service ntpd.service cups.service cronie.service cpupower.service slim.service
==Host Name==
 
==Hardware Clock==


read -p "Is the hardware clock set to LOCALTIME or UTC? " HWCS &&
  echo [hostname] > /mnt/system/etc/hostname
  echo -e "0.0 0.0 0.0\n0\n$HWCS" > /etc/adjtime


==Time Zone==
==Time Zone==


  ln -s /usr/share/zoneinfo/[Country]/[City] /etc/localtime
  ln -s /usr/share/zoneinfo/[Country]/[City] /mnt/system/etc/localtime


NB: You can use <tt>[TAB]</tt> completion to help yourself out.
NB: You can use <tt>[TAB]</tt> completion to help yourself out.


==Host Name==
==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:


read -p "Enter the host name of the new system: " NHST && echo $NHST > /etc/hostname
{{hc|/etc/adjtime|2=
0.0 0 0
0
LOCAL
}}


==Locale==
==Locale==


The system will bitch during <tt>mkinitcpio</tt> if this is not set up.
cat << EOF > /mnt/system/etc/locale.conf
LANG=en_US.UTF-8
LANGUAGE=en_US
LC_COLLATE=POSIX
EOF
   
   
  LANG=en_US.UTF-8 && KYMP=us
  cat << EOF > /mnt/system/etc/locale.gen
sed -i "s/#${LOCL:0:5}/${LOCL:0:5}/g" /etc/locale.gen
  en_US.UTF-8 UTF-8
  echo "LANG=\"$LANG\"" > /etc/locale.conf
  EOF
  locale-gen


==Console Font==
==Console==


  echo 'FONT="Lat2-Terminus16"' > /etc/vconsole.conf
  cat << EOF > /mnt/system/etc/vconsole.conf
  echo "KEYMAP=\"$KYMP\"" >> /etc/vconsole.conf
  KEYMAP=us
FONT=Lat2-Terminus16
EOF


==NFS==
==Enabling [multilib] on 64-bit systems==


For servers ONLY:
<nowiki>[[ $(uname -m) == x86_64 ]]</nowiki> &&
sed -i ':a;N;$!ba;s/#\[multilib\]\n#/\[multilib\]\n/g' /mnt/system/etc/pacman.conf


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


For clients ONLY:
This will configure <tt>sudo</tt> to give members of the <tt>wheel</tt> group access and also configure it to request <tt>root</tt>'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/^NEED_STATD=""/NEED_STATD="no"/g' /etc/conf.d/nfs-common.conf
  sed -i 's/# %wheel ALL=(ALL) ALL/%wheel ALL=(ALL) ALL/g' /mnt/system/etc/sudoers
sed -i 's/^NEED_IDMAPD=""/NEED_IDMAPD="yes"/g' /etc/conf.d/nfs-common.conf
  echo 'Defaults rootpw' >> /mnt/system/etc/sudoers
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==
==NFS==
 
<tt>Netcfg</tt> is a more robust solution compared to using the settings available in <tt>rc.conf</tt>. 
 
This will copy some examples to <tt>/etc/network.d</tt> 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:
  echo -e "[nfs-ip]:/\t[nfs-mount]\tnfs4\tnoatime,user,exec,soft,timeo=14\t0 0" >> /mnt/system/etc/fstab
 
  <nowiki>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</nowiki>
 
This will set the IP addresses for all three connections:
 
<nowiki>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</nowiki>
 
To configure a wireless connection to a router:
 
<nowiki>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</nowiki>
 
Now it's time to edit <tt>/etc/conf.d/netcfg</tt> and <tt>/etc/rc.conf</tt>.
 
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==
==mkinitcpio==


The default HOOKS should work fine.  However, a couple of tweaks can be made here by removing the default <tt>pata</tt> and <tt>scsi</tt> hooks if you have no PATA/SATA-IDE or SCSI devices, respectively.  In the following script, <tt>HKDD</tt> has all available disk devices.  Simply remove the ones you do not need.
The default HOOKS should work fine.  Just need to add the <tt>consolefont</tt> and <tt>keymap</tt> hooks.
 
The last tweak is to add the <tt>consolefont</tt> and <tt>keymap</tt> hooks.
    
    
HKDD="pata scsi sata lvm2 mdadm_udev dmraid encrypt usr"
  sed -i 's/^HOOKS="(.*)"/HOOKS="\1 consolefont keymap"/g' /mnt/system/etc/mkinitcpio.conf
HKNW="base udev autodetect usbinput $HKDD filesystems fsck consolefont keymap"
  sed -i "s/^HOOKS=.*/HOOKS=\"$HKNW\"/g" /etc/mkinitcpio.conf


It's also nice to use compression.  The default in Arch is to use <tt>xz</tt> compression.
If you are using software RAID, you will also need to add the <code>mdadm_udev</code> hook.


  sed -i 's/^#\(COMPRESSION="xz"\)/\1/g' /etc/mkinitcpio.conf
  sed -i 's/^HOOKS="(.*)autodetect(.*)"/HOOKS="\1autodetect mdadm_udev\2"/g' /mnt/system/etc/mkinitcpio.conf


==makepkg==
==makepkg==
''If you do not plan on compiling your own packages, you can skip this section.''


The first thing to do to optimize compiled code is to specify that we're using the PC architecture.
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
  sed -i 's/-unknown-linux-gnu/-pc-linux-gnu/g' /mnt/system/etc/makepkg.conf


Next, allow GCC to auto-detect CPU features.
Next, allow GCC to auto-detect CPU features.


  sed -i 's/-march=\S* -mtune=generic/-march=native/g' /etc/makepkg.conf
  sed -i 's/-march=\S* -mtune=generic/-march=native/g' /mnt/system/etc/makepkg.conf


Lastly, take advantage of SMP if available.
Lastly, take advantage of SMP if available.


CORS=`cat /proc/cpuinfo | grep -i cpu\ cores | uniq | cut -d: -f2`
  sed -i 's/#MAKEFLAGS="-j."/MAKEFLAGS="-j[cores + 1]"/g' /mnt/system/etc/makepkg.conf
  sed -i 's/#MAKEFLAGS=.*/MAKEFLAGS="-j'`expr 1 + $CORS`'"/g' /etc/makepkg.conf
 
==Networking==
 
===DHCP===


==Enable [multilib] on 64-bit systems==
The easiest way is to just rely on DHCP


CPUTYPE=`lscpu | grep Architecture | cut -d: -f2 | sed 's/[ \t]*//g'`
  arch-chroot /mnt/system
<nowiki>[[ $CPUTPYE == x86_64 ]]</nowiki> &&
  systemctl enable dhcpcd
sed -i ':a;N;$!ba;s/#\[multilib\]\n#SigLevel\(.*\)\n#Include\(.*\)/\[multilib\]\nSigLevel\1\nInclude\2/g' /etc/pacman.conf
  exit


==Sudo==
===NetworkManager===


This will configure <tt>sudo</tt> to give members of the <tt>wheel</tt> group access and also configure it to request <tt>root</tt>'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.)
If you're using a laptop or other computer with no guaranteed connection, you may prefer Network Manager


sed -i 's/# %wheel ALL=(ALL) ALL/%wheel ALL=(ALL) ALL/g' /etc/sudoers
  pacstrap /mnt/system networkmanager
echo 'Defaults rootpw' >> /etc/sudoers
  arch-chroot /mnt/system
  systemctl enable NetworkManager
  exit


==SLiM (GUI Only)==
Network Manger works best with a complimentary GUI applet.


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


==Packer Setup==
For ethernet connections that connect to a local LAN that does not have an internet connection


  wget <nowiki>https://aur.archlinux.org/packages/pa/packer/PKGBUILD</nowiki> -O /tmp/PKGBUILD
  cp /mnt/etc/netctl/examples/ethernet-static /etc/netctl/$(cat /mnt/system/etc/hostname)-ethernet
  cd /tmp && makepkg --asroot --install --noconfirm PKGBUILD
  sed -i "s/^ADDR=.*/ADDR='[ip-address]'/g" /etc/netctl/$(cat /mnt/system/etc/hostname)-ethernet


UMPlayer requires MPlayer.  By default the dependency system will try to install the MPlayer from the repos, which is the old MPlayer. To get the new MPlayer2, use the AUR.
If your ethernet connection can connect to the internet


  packer -S --noedit --noconfirm mplayer2-git
  sed -i 's/^GATEWAY=.*/GATEWAY="[gateway-address]"/g' /etc/netctl/$(cat /mnt/system/etc/hostname)-ethernet
sed -i 's/^DNS=.*/DNS=\("[dns-address]"\)/g' /etc/netctl/$(cat /mnt/system/etc/hostname)-ethernet


Synapse requires GTK HotKey, which currently won't compile without some help.
Otherwise:


  packer -S --noedit --noconfirm gtkhotkey
  sed -i 's/^GATEWAY=/#GATEWAY=/g' /etc/netctl/$(cat /mnt/system/etc/hostname)-ethernet
sed -i 's/^DNS=/#DNS=/g' /etc/netctl/$(cat /mnt/system/etc/hostname)-ethernet


After the failed build, add these lines to the PKGBUILD build() function and run makepkg:
For network connections that connect to a wireless AP


  sed -i "s|glib/gquark\.h|glib.h|" src/gtk-hotkey-error.h
cp /mnt/etc/netctl/examples/wireless-wpa-static /etc/netctl/$(cat /mnt/system/etc/hostname)-wireless
  sed -i "s|glib/gtypes\.h|glib.h|" src/x11/tomboykeybinder.h
  sed -i 's/^GATEWAY=.*/GATEWAY="[gateway-address]"/g' /etc/netctl/$(cat /mnt/system/etc/hostname)-wireless
sed -i 's/^DNS=.*/DNS=\("[dns-address]"\)/g' /etc/netctl/$(cat /mnt/system/etc/hostname)-wireless
sed -i "s/^ADDR=.*/ADDR='[ip-address]'/g" /etc/netctl/$(cat /mnt/system/etc/hostname)-wireless
sed -i 's/^ESSID=.*/ESSID='[esid]'/g' /etc/network.d/$(cat /mnt/system/etc/hostname)-wireless
  sed -i 's/^KEY=.*/KEY='[wpsk]'/g' /etc/network.d/$(cat /mnt/system/etc/hostname)-wireless


packer -S --noedit --noconfirm awn-extras-applets clearlooks-phenix-gtk-theme-git \
Finally, to enable the network connection(s) at boot time:
elementary-icons guvcview nautilus-elementary-bzr synapse ttf-ms-fonts ttf-tahoma \
umplayer-svn xarchiver


==Make InitRAM Images==
  arch-chroot /mnt/system
  netctl enable [profile]
  exit


mkinitcpio -p linux
==Generate initramfs==


==Install GRUB2==
  arch-chroot /mnt/system
  mkinitcpio -P
  exit


grub-mkconfig -o /boot/grub/grub.cfg
==Boot Loader==
grub-install ${TRGT:0:8}


==Stuff That Can Only Be Done If Current Machine Is Installation Target==
===Sylinux===


===Persistent Network Names===
  pacstrap /mnt/system syslinux
  arch-chroot /mnt/system
  syslinux-install_update -iam
  exit


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 <tt>udev</tt> rules.
===Grub===


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


===CPU Frequency Scaling===
==Daemon Setup==


AFD="acpi-cpufreq"
  arch-chroot /mnt/system
[ "`cat /proc/cpuinfo | grep AMD`" != "" ] &&
  for daemon in acpid cronie smartd ntpd nfs-wait-online lm_sensors spupower cups; do
  AFD="powernow-k8 powernow-k7 cpufreq-nforce2"
  systemctl enable $daemon
[ "`cat /proc/cpuinfo | grep Intel`" != "" ] &&
  done
  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==
==Finish System Setup==


exit
  umount /mnt/system
  umount /mnt
  reboot
  reboot
<!--
You can pick and choose from the following lines.
PKGS+=" alsa-utils alsa-plugins libsamplerate"                      # ALSA
[[ $CPUTYP == x86_64 ]] && PKGS+=" lib32-libsamplerate
PKGS+=" xorg-server xorg-xinit xorg-xrandr"                          # For GUI Desktop
PKGS+=" xf86-video-vesa"                                            # Generic VESA driver
PKGS+=" xf86-video-intel"                                            # Intel opensrc
PKGS+=" xf86-video-ati"                                              # ATI opensrc
PKGS+=" xf86-video-nouveau"                                          # NVIDIA opensrc
PKGS+=" nvidia nvidia-utils vdpau-video"                            # NVIDIA closed all
PKGS+=" ttf-droid ttf-ubuntu-font-family"                            # Extra fonts
PKGS+=" gtk-engines librsvg lxappearance"                            # GTK2 Themes & Config
PKGS+=" hplip python2-{pillow,reportlab,notify,dbus,pyqt}"          # HPLIP
PKGS+=" xsane-gimp"                                                  # Scanner support
PKGS+=" lxdm"                                                        # LXDM Display Manager
PKGS+=" compizconfig-backend-gconf compiz-fusion-plugins-extra"      # Compiz
PKGS+=" ccsm emerald-themes"                                        # Compiz + Emerald
PKGS+=" galculator gucharmap lxtask mcomix sakura viewnior xdialog"  # Miscellaneous
PKGS+=" xfburn gnucash gtk-recordmydesktop"                          # Miscellaneous
PKGS+=" qemu wine_gecko"                                            # Emulation
PKGS+=" gksu gparted gsmartcontrol"                                  # GUI Frontends
PKGS+=" audacity deadbeef"                                          # Audio
PKGS+=" gimp-help-en inkscape"                                      # Graphics
PKGS+=" avidemux-gtk libdvdcss mediainfo mencoder mkvtoolnix-gtk"    # Multimedia
PKGS+=" chromium firefox flashplugin midori opera"                  # Browsers
PKGS+=" epdfview geany"                                              # Doc View/Edit
PKGS+=" libreoffice-calc libreoffice-en-US libreoffice-writer"      # LibreOffice
PKGS+=" hunspell-en hyphen-en mythes-en aspell-en"                  # Dict,Thes,etc.
PKGS+=" pidgin-libnotify purple-plugin-pack skype xchat"            # IM / Chat / VoIP
PKGS+=" thunderbird"                                                # Email
PKGS+=" lib32-nvidia-utils lib32-alsa-plugins lib32-libsamplerate"  # 32-libs for 64-bit
PKGS="$PKGS openbox openbox-themes cairo-compmgr"                          # OpenBox
-->


=Post-Installation=
=Post-Installation=
Line 348: Line 296:
==GUI Configuration==
==GUI Configuration==


===ATI Video Drivers===
===GTK Themes===
 
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.  <!-- The easiest way to handle the proprietary drivers is to add the following unofficial repositories and then use pacman to install.
 
<nowiki>CurCatXorg=`wget http://catalyst.apocalypsus.net/repo/ -qO- | \
grep "xorg[0-9]*/" |                  # get only lines that contain xorg000
cut -d\> -f3,4 |                      # use > to get repo name and date
sed 's/\/<\/a>/\t/g' |                # replace extraneous </a> with space
sed 's/\(201.\) /\1-/g' |              # replace space between year and time with -
sed 's/ *//g' | tr '-' ' ' |          # trim extra white space characters
awk -F" " '{print $1,$4,$3,$2,$5}' |  # re-order columns
sort -rMk3 | sort -rk2 |              # sort by month then by year
cut -d\  -f1 | head -1`                # only grab repo name, and only first one -->
sed -i 's/\[core\]/\[catalyst\]
SigLevel = Never
Server = http:\/\/catalyst.apocalypsus.net\/repo\/catalyst\/\$arch
\n[core\]/g' /etc/pacman.conf
<!--
sed -i 's/\[core\]/\['$CurCatXorg'\]
Server = http:\/\/catalyst.apocalypsus.net\/repo\/'$CurCatXorg'\/\$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.
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.
Line 389: Line 310:


==Fixes==
==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===
===Nautilus Video Previews===

Latest revision as of 01:18, 14 March 2022

WARNING: Proceed carefully and verify everything until the author(s) of this article have had a chance to do so themselves.

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 LXDM 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 this 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 [ip-address]/[net-mask] broacast [broadcast] 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.

reflector -l 5 -c "[country]" --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).

mkfs -t [fs-type] [device] && mount [device] /mnt/system

Swap Space

dd if=/dev/zero of=/mnt/system/swapfile bs=1M count=[megabytes]
chmod 600 /mnt/system/swapfile
mkswap /mnt/system/swapfile
swapon /mnt/system/swapfile

Installing The Base System

 PKGS+=" base acpid dcfldd iotop ix ncdu parted rsync sudo tmux"               # General Utilities
 PKGS+=" dosfstools mtools ntfs-3g smbclient nfs-utis"                         # Filesystem Utilities
 PKGS+=" cpupower dmidecode hddtemp hdparm hwdetect lm_sensors lshw inxi smartmontools" # Hardware Utilities
 PKGS+=" dnsutils net-tools nfs-utils ntp openssh reflector whois wget"        # Network Utilities
 PKGS+=" arj lzop p7zip unrar zip"                                             # Compression Utilities

 pacstrap /mnt/system $PKGS

Configuring The Base System

fstab

genfstab -pL /mnt/system >> /mnt/system/etc/fstab
echo -e "/swapfile\tnone\tswap\tdefaults\t0 0" >> /mnt/system/etc/fstab

Host Name

echo [hostname] > /mnt/system/etc/hostname

Time Zone

ln -s /usr/share/zoneinfo/[Country]/[City] /mnt/system/etc/localtime

NB: You can use [TAB] completion to help yourself out.

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:

/etc/adjtime
0.0 0 0
0
LOCAL

Locale

cat << EOF > /mnt/system/etc/locale.conf
LANG=en_US.UTF-8
LANGUAGE=en_US
LC_COLLATE=POSIX
EOF

cat << EOF > /mnt/system/etc/locale.gen
en_US.UTF-8 UTF-8
EOF

Console

cat << EOF > /mnt/system/etc/vconsole.conf
KEYMAP=us
FONT=Lat2-Terminus16
EOF

Enabling [multilib] on 64-bit systems

[[ $(uname -m) == x86_64 ]] &&
sed -i ':a;N;$!ba;s/#\[multilib\]\n#/\[multilib\]\n/g' /mnt/system/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' /mnt/system/etc/sudoers
echo 'Defaults rootpw' >> /mnt/system/etc/sudoers

NFS

echo -e "[nfs-ip]:/\t[nfs-mount]\tnfs4\tnoatime,user,exec,soft,timeo=14\t0 0" >> /mnt/system/etc/fstab

mkinitcpio

The default HOOKS should work fine. Just need to add the consolefont and keymap hooks.

sed -i 's/^HOOKS="(.*)"/HOOKS="\1 consolefont keymap"/g' /mnt/system/etc/mkinitcpio.conf

If you are using software RAID, you will also need to add the mdadm_udev hook.

sed -i 's/^HOOKS="(.*)autodetect(.*)"/HOOKS="\1autodetect mdadm_udev\2"/g' /mnt/system/etc/mkinitcpio.conf

makepkg

If you do not plan on compiling your own packages, you can skip this section.

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' /mnt/system/etc/makepkg.conf

Next, allow GCC to auto-detect CPU features.

sed -i 's/-march=\S* -mtune=generic/-march=native/g' /mnt/system/etc/makepkg.conf

Lastly, take advantage of SMP if available.

sed -i 's/#MAKEFLAGS="-j."/MAKEFLAGS="-j[cores + 1]"/g' /mnt/system/etc/makepkg.conf

Networking

DHCP

The easiest way is to just rely on DHCP

 arch-chroot /mnt/system
 systemctl enable dhcpcd
 exit

NetworkManager

If you're using a laptop or other computer with no guaranteed connection, you may prefer Network Manager

 pacstrap /mnt/system networkmanager
 arch-chroot /mnt/system
 systemctl enable NetworkManager
 exit

Network Manger works best with a complimentary GUI applet.

netctl

For ethernet connections that connect to a local LAN that does not have an internet connection

cp /mnt/etc/netctl/examples/ethernet-static /etc/netctl/$(cat /mnt/system/etc/hostname)-ethernet
sed -i "s/^ADDR=.*/ADDR='[ip-address]'/g" /etc/netctl/$(cat /mnt/system/etc/hostname)-ethernet

If your ethernet connection can connect to the internet

sed -i 's/^GATEWAY=.*/GATEWAY="[gateway-address]"/g' /etc/netctl/$(cat /mnt/system/etc/hostname)-ethernet
sed -i 's/^DNS=.*/DNS=\("[dns-address]"\)/g' /etc/netctl/$(cat /mnt/system/etc/hostname)-ethernet

Otherwise:

sed -i 's/^GATEWAY=/#GATEWAY=/g' /etc/netctl/$(cat /mnt/system/etc/hostname)-ethernet
sed -i 's/^DNS=/#DNS=/g' /etc/netctl/$(cat /mnt/system/etc/hostname)-ethernet

For network connections that connect to a wireless AP

cp /mnt/etc/netctl/examples/wireless-wpa-static /etc/netctl/$(cat /mnt/system/etc/hostname)-wireless
sed -i 's/^GATEWAY=.*/GATEWAY="[gateway-address]"/g' /etc/netctl/$(cat /mnt/system/etc/hostname)-wireless
sed -i 's/^DNS=.*/DNS=\("[dns-address]"\)/g' /etc/netctl/$(cat /mnt/system/etc/hostname)-wireless
sed -i "s/^ADDR=.*/ADDR='[ip-address]'/g" /etc/netctl/$(cat /mnt/system/etc/hostname)-wireless
sed -i 's/^ESSID=.*/ESSID='[esid]'/g' /etc/network.d/$(cat /mnt/system/etc/hostname)-wireless
sed -i 's/^KEY=.*/KEY='[wpsk]'/g' /etc/network.d/$(cat /mnt/system/etc/hostname)-wireless

Finally, to enable the network connection(s) at boot time:

 arch-chroot /mnt/system 
 netctl enable [profile]
 exit

Generate initramfs

 arch-chroot /mnt/system
 mkinitcpio -P
 exit

Boot Loader

Sylinux

 pacstrap /mnt/system syslinux
 arch-chroot /mnt/system
 syslinux-install_update -iam
 exit

Grub

 pacstrap /mnt/system grub
 arch-chroot /mnt/system
 grub-mkconfig -o /boot/grub/grub.cfg
 grub-install [device]
 exit

Daemon Setup

 arch-chroot /mnt/system
 for daemon in acpid cronie smartd ntpd nfs-wait-online lm_sensors spupower cups; do
 systemctl enable $daemon
 done

Finish System Setup

umount /mnt/system
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

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

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