randys.org

Wasting your precious bandwidth since 1999

How-To: Install Archlinux on Slicehost

I recently acquired a 256 Slice from Slicehost. While their distribution selection is good, I was hoping for something, well, different. My old VPS is rocking Ubuntu (quite well) but I just want something else. Slicehost’s other distributions weren’t going to cut it.

  1. Ubuntu Dapper - Already running that.. that’s how I got here.
  2. CentOS 4.3 - Um, no. Never liked RedHat. Hate RPMs. Package management is a nightmare.
  3. Gentoo 2006.1 - I’ve used Gentoo in the past (a lot) and enjoyed it. I even tried it on my old VPS. I just don’t have the patience to wait for shit to compile.
  4. Debian Etch - Debian is a true soldier. Secure and stable. However, not up-to-date enough for my tastes (that’s why I went with Ubuntu).
  5. Fedora 6 - See #2.

Enter Archlinux.

This little how-to was taken from various places on the net, but the bulk of it is from Anders’ Blargh post and a couple of comments in a previous post of mine. So, let’s dive in.

Back It Up!

If you have any valuable information on your slice, now would be the time to make a backup of the important stuff you want to keep.

Bootstrapping

First thing you want to do is bootstrap Arch64 to directory on your current distribution. If you happen to have a 64bit version running at home, you could do this locally and it should still work (in theory).

# export PACMAN_VERSION=3.0.5-2
# export XEN_MODULES_VERSION=2.6.16.29
# wget http://www.randys.org/assets/2007/8/17/archbootstrap-packages-20070817
# wget ftp://ftp.archlinux.org/current/os/x86_64/pacman-${PACMAN_VERSION}.pkg.tar.gz
# tar zxvf pacman-${PACMAN_VERSION}.pkg.tar.gz -C /
# mkdir /arch

At this point, you might want to edit /etc/pacman.conf and /etc/pacman.d/current to your liking. Picking a close/fast mirror will help speed things along.

# pacman.static -Sy `cat archbootstrap-packages-20070817` -r /arch

Now you need to bind /dev, /sys and /proc to the bootstrap directory so you can chroot in.

# for s in dev sys proc; do mount /$s /arch/$s --bind; done

Copy some important files for the chroot.

# cp /etc/mtab /arch/etc/
# cp /etc/fstab /arch/etc/
# cp /etc/resolv.conf /arch/etc/

We also need to copy the all important xen kernel modules from the existing slice into our Arch64 bootstrap directory.

# cp -r /lib/modules/${XEN_MODULES_VERSION}-xen /arch/lib/modules/

Now we’re ready to chroot into your new Arch64 directory.

# chroot /arch /bin/bash

One of gotchas I had was when I went to SSH into my newly booted Arch64 Slice. It would connect and I could enter my password, but it would hang and never drop me to a command line prompt. Did a little searching and found that it was all because /dev/pts was not being mounted at boot time. Easy fix.

#[] echo "none  /dev/pts    devpts  gid=5,mode=620  0 0" >> /etc/fstab

Edit /etc/locale.gen and enable any locales you require. en_US.UTF-8 UTF-8 and en_US ISO-8859-1 are popular choices. Now generate the locales.

#[] locale-gen

Edit /etc/pacman.conf and /etc/pacman.d/(current|extra|community) in your chroot to your liking. If you don’t do it here, you can always do it when you get it running. But we’re about to install openssh, so now is as good a time as any.

#[] pacman -Sy openssh

Now you nee to add sshd to our DAEMONS array in /etc/rc.conf file

#[] vim /etc/rc.conf
    ...
    DAEMONS=(syslog-ng network netfs crond sshd)
    ...

While you’re in /ect/rc.conf, go ahead and setup your network interfaces and gateway. You can get the current information from your running Slice (for Ubuntu cat /etc/network/interfaces)

    ...
    eth0="eth0 XXX.XXX.XXX.XXX netmask 255.255.255.0 broadcast XXX.XXX.XXX.XXX"
    INTERFACES=(lo eth0)
    gateway="default gw XXX.XXX.XXX.XXX"
    ROUTES=(gateway)
    ...

Next, you’ll need to modfy /etc/hosts.allow so you can actually connect to our new Arch64 VPS via ssh.

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

If there’s any other tweaks you want to make, make them now. Otherwise, exit the chroot.

One thing I did before exiting the chroot to cut down on the bootstrap size is to clear pacman’s cache directory. It should probably save you 100MB+ and there’s no need to keep them at this point.

#[] pacman -Scc
#[] exit

Unmount the dev, sys and proc filesystems you mounted earlier.

# umount /arch/dev
# umount /arch/sys
# umount /arch/proc

Now we’ll archive the files.

# cd /arch && tar cjvf /archbootstrap-$(date +%Y%m%d).tar.bz2 *

That’s it. You’re all set. If you want to keep a copy of this so you don’t have to do all this again, do it now.

# scp /archbootstrap-$(date +%Y%m%d).tar.bz2 <username>@<hostname>:<path>

Dealing with Slicehost

At this point you should have a working Arch64 install ready to be installed. Now you need to login to the Slicehost manager and put your slice into Rescue Mode. Login to your slice via SSH. Once logged in you’ll need to mount your slice’s partition and copy the archive to the rescue disk.

#[r] mkdir /mnt/oldslice
#[r] mount /dev/sda1 /mnt/oldslice
#[r] cp /mnt/oldslice/archbootstrap-* /root
#[r] umount /mnt/oldslice

Next, format your old slice partition and re-mount it so you can install Arch64.

#[r] mke2fs -j /dev/sda1
#[r] mount /dev/sda1 /mnt/oldslice
#[r] tar xjvfp /root/archbootstrap-*.tar.bz2 -C /mnt/oldslice/

And that’s about it. You should now have a working Arch64 installation on your new Slice! Probably a good idea to double check all your settings before rebooting your slice, but, then you do have access to the rescue console.

Enjoy! And thanks to Anders for pointing me in the right direction.


If you find any errors or have any additions, please let me know and I’ll update this post.

Tags: , ,

4 Responses to “How-To: Install Archlinux on Slicehost”

  1. Moot point on package management with RedHat based distros. Yum is as good as Debian/Bloatbuntu’s apt.

  2. I think one important thing that I missed in my howto is the ‘p’ option to tar: preserve permissions.

    Things seem to be ok on my slice, but who knows… perhaps you’ll run into problems… I’ll have to fix my howto. Just thought about that issue :\

  3. Thankyou for this!

    I have been wanting to try Arch Linux at Slicehost and found this on google.

    Do you think it matters that /dev/.static/dev is not mounted or found? When i do a ‘df -h’ for example it say no such file or directory.

    It is present in all the other distros on Slicehost - do they do something else to make this work?

    Just a little worried.

  4. Great post! My Arch64 slice seems solid so far (only a few days in). You saved me a good deal of time since the bulk of my Linux experience has been with Arch.

Leave a Reply

All content Copyright © Randy Sesser | Hosted by WebFaction
Entries (RSS) | Comments (RSS)