Arch Linux

From PrgmrWiki
Revision as of 22:58, 3 July 2011 by D.a (talk | contribs) (Bootstrap script broken, added updated prefab)

Pre-made tarball

Initial setup

Setup is nearly identical to Untarring a fresh OS image. This guide will have some extra bloat just to keep everything in one place.

Boot into CentOS 5.5 rescue (2.6.18-194.3.1.el5xen) from pvgrub, and Log in as root.

Set up partitons. This guide will use one partition, starting with a blank disk for simplicity.

[root@host ~]# parted /dev/xvda
GNU Parted 1.8.1
Using /dev/xvda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) mkpart primary 0% 100%
(parted) quit

Make a filesystem, mount it, and enter it.

# mkfs.ext3 -L ARCHLINUX /dev/xvda1
# mount -n /dev/xvda1 /mnt
# cd /mnt

Download and extract Arch.

File ArchLinuxBase-i686.tar.gz ArchLinuxBase-x86_64.tar.gz
Download 257.138234 MiB 363.390111 MiB
Install 469.972863 MiB 653.376709 MiB
# wget
# wget
# tar -zxf ArchLinuxBase*

Don't restart yet.


If you installed to somewhere other than /dev/xvda1, you will need to edit boot/grub/menu.lst to reflect the changes.

Get the configuration details for a working network: Note the inet addr and mask in the output of ifconfig eth0 Note the IP in the gateway column in the output of route Note the search and nameserver outputs of cat /etc/resolv.conf

This is all you need to know to configure Arch to connect to the internet. Reboot into Arch after writing the information down.

# shutdown -r now

Login as root and set the root password.

Arch Linux 2.6.37-xen  ((none)) (hvc0)
(none) login: root
[root@(none) ~]# passwd

Note: nano is installed.


Edit /etc/resolv.conf to look like what you wrote down.

Fill in the blanks of /etc/rc.conf to include your hostname, interface, address, netmask, and gateway. Your hostname can be whatever you like. Your interface is eth0.

Append the hostname you chose to the line with in /etc/hosts


Uncomment your preferred locale in /etc/locale.gen Set the same locale in /etc/rc.conf Apply the locale with locale-gen


Add a user, add your public key, enable ssh privilege separation, and allow ssh connections.

# adduser kino

# mkdir ~kino/.ssh
# echo "paste public key" > ~kino/.ssh/authorized_keys
# chown -R kino:users ~kino
# chmod 700 ~kino/.ssh
# chmod 600 ~kino/.ssh/authorized_keys

# echo "nobody:x:99:99:Nobody:/:/sbin/nologin" >> /etc/passwd

# echo "sshd: ALL" >> /etc/hosts.allow

Add sshd to the startup daemons list.

# vim /etc/rc.conf +/DAEMONS=

If you don't want to reboot, use your new hostname and start ssh.

# hostname tabi
# rc.d start sshd


Bootstrap script

Initial setup

Reboot your VPS and select the CentOS rescue image.

If you don't want to set up partitions (I didn't), just go ahead and make it ext3.

# mkfs.ext3 /dev/xvda1

Mount the drive into /mnt

# mount -n /dev/xvda1 /mnt
# cd /mnt

Download the install script and run it!

# wget
# chmod +x
# ./

When prompted give the following answers.

Installation Directory: /mnt

Architecture: Your choice (32 or 64 bit)

Download Mirror:

Using this old mirror is necessary due to the old kernel version of the CentOS rescue image (2.6.18). Once the install script is complete a full system upgrade can be done using "pacman -Syu".


The install script chroots for you. After entering the root password for your new system, you need to configure your Arch. Specify DNS servers in /etc/resolv.conf. An example, using prgmr nameservers:


Uncomment the desired locale in /etc/locale.gen then run locale-gen. The default is en_US.UTF-8 as seen in /etc/rc.conf. An example /etc/locale.gen:

en_US.UTF-8 UTF-8  
en_US ISO-8859-1

Add your / partition to /etc/fstab. Get your UUID from ls -l /dev/disk/by-uuid/. An example /etc/fstab:

# <file system>        <dir>         <type>    <options>          <dump> <pass>
devpts                 /dev/pts      devpts    defaults            0      0
shm                    /dev/shm      tmpfs     nodev,nosuid        0      0

UUID=185c4489-6eec-4b72-a479-c4cc207e7413 /	ext3	defaults,noatime 0 1

Remove the default kernel, as we're installing the Xen one.

# pacman -Rsdn kernel26

To build the Xen kernel, you'll need to install the make, gcc, and patch packages from the repositories. We'll also need xmlto and docbook-xsl as dependencies to the PKGBUILD.

# pacman -S make gcc patch xmlto docbook-xsl

Download and untar the latest tarball of the kernel26-xen package.

# wget
# tar -xf kernel26-xen.tar.gz
# cd kernel26-xen

You'll need to uncomment the following line from the PKGBUILD file.

#pkgname=('kernel26-xen' 'kernel26-xen-headers') # Build kernel with a different name

Build the package. This step will take a while, so grab some coffee and a scone.

# makepkg --asroot

If makepkg complains about extracting, then do it yourself for both, linux and patch archives and move them to src/. Then try makepkg again with no extract flag:

# makepkg --asroot -e

Install the packages you just built:

# pacman -U kernel26-xen-VERSION-x86_64.pkg.tar.gz
# pacman -U kernel26-xen-headers-VERSION-x86_64.pkg.tar.gz

Add the following xen modules to your initcpio by appending the following to MODULES in /etc/mkinitcpio.conf: "xen-blkfront xen-fbfront xenfs xen-netfront xen-kbdfront" and rebuild your initcpio:

 mkinitcpio -p kernel26-xen

Install grub

pacman -S grub

Edit boot/grub/menu.lst and fill it with the following:

timeout 5
default 0

# (0) Arch Linux
title  Arch Linux
root   (hd0,0)
kernel /boot/vmlinuz26-xen root=/dev/xvda1 ro console=hvc0
initrd /boot/kernel26-xen.img

Edit /etc/inittab and remove/comment these

# -8 options fixes umlauts problem on login
c1:2345:respawn:/sbin/agetty -8 38400 tty1 linux
c2:2345:respawn:/sbin/agetty -8 38400 tty2 linux
c3:2345:respawn:/sbin/agetty -8 38400 tty3 linux
c4:2345:respawn:/sbin/agetty -8 38400 tty4 linux
c5:2345:respawn:/sbin/agetty -8 38400 tty5 linux
c6:2345:respawn:/sbin/agetty -8 38400 tty6 linux

Uncomment this

# Hypervisor Virtual Console for Xen and KVM
# h0:2345:respawn:/sbin/agetty -8 38400 hvc0 linux

To avoid hwclock error messages, set HARDWARECLOCK="xen" in /etc/rc.conf (actually you can use any value here except "UTC" and "localtime")

Install SSH and configure it (

# pacman -S openssh

Reboot your VPS and you should be good to go!