Difference between revisions of "Arch Linux"

From PrgmrWiki
(Updated the URL for the pacman-mirrorlist package and added [options] to the top of /etc/rc.conf)
(Redid the whole page following the steps I took to get it working.)
Line 1: Line 1:
Installing arch guide
+
Reboot your VPS and select the CentOS rescue image.
I'm going to assume some familiarity and being comfortable in linux.
 
  
Thanks to the netbsd guide, for the inital help. The first couple steps will be repeat from that guide.
+
If you don't want to set up partitions (I didn't), just go ahead and make it ext3.
 
 
Boot up your current install, and copy some information from it. I tossed it all into a text document for easy reference.
 
 
 
Files i copied.
 
  
 
<pre>
 
<pre>
/etc/fstab
+
# mkfs.ext3 /dev/xvda1
/etc/network/interfaces (debian,dont use cent)
 
/etc/resolv.conf
 
Output of ifconfig for eth0.
 
 
</pre>
 
</pre>
Those should be the core items. Reboot your vps, and select the CentOS rescue image.
 
 
If you don't change the partition skip to the mkfs part.
 
 
Repartition the hard drive if you want. I left it as is, but do as you please. (note I'm assuming you know fdisk)
 
  
Once your partitioning is done and written. Format the drives, CentOS only comes with ext2/3 so that will be the file system.
+
Mount the drive into /mnt
  
 
<pre>
 
<pre>
/sbin/mkfs.ext3 /dev/xvda*
+
# mount /dex/xvda1 /mnt
 +
# cd /mnt
 
</pre>
 
</pre>
  
Do this for each of your partitions.
+
Download the install script and run it!
 
 
Mount the selected drives, this will vary based on your partition scheme.
 
 
 
Note /mnt is the new root system, so when i refer to root directory it will be /mnt
 
  
 
<pre>
 
<pre>
mount /dev/xvda1 /mnt
+
# wget http://calimeroteknik.free.fr/arch-guide/install-chroot.sh
 +
# chmod +x install-chroot.sh
 +
# ./install-chroot.sh
 
</pre>
 
</pre>
  
Now to get pacman(package manager) going.
+
(The install script chroots for you, when you're finished just type exit)
 
 
You will need two files, download these and extract them to the root directory. Or you can create a static directory in the root folder (/mnt/static), I will just go with downloading and extracting to /mnt.
 
  
<pre>
 
cd /mnt
 
wget http://repo.archlinux.fr/x86_64/pacman-static-3.2.2-1.pkg.tar.gz
 
wget ftp://ftp.archlinux.org/core/os/x86_64/pacman-mirrorlist-20091206-1-x86_64.pkg.tar.gz
 
</pre>
 
  
 +
Remove the default kernel, as we're installing the Xen one.
  
I recommend putting the config files for static pacman in a separate location I used /mnt/config.
 
 
<pre>
 
<pre>
mkdir /mnt/config
+
# pacman -Rsdn kernel26
tar -xvf pacman-static-3.2.2-1.pkg.tar.gz -C /mnt/config
 
tar -xvf pacman-mirrorlist-20090616-1-x86_64.pkg.tar.gz -C /mnt/config
 
 
 
If you just do tar without -C.
 
mv -fv /etc/pacman* /mnt/config
 
 
</pre>
 
</pre>
  
You will need to edit these files a bit, pacman.conf isn't even included so we will create that.
+
Wget the xen kernel binaries.
 
 
(Note. I don't use vi so i just copy and pasted these in, or remotely download them.)
 
  
 
<pre>
 
<pre>
vi /mnt/config/pacman.conf
+
# wget http://95.130.15.18/xen/kernel26-xen-2.6.32.9-1-x86_64.pkg.tar.gz
 +
# wget http://95.130.15.18/xen/kernel26-xen-headers-2.6.32.9-1-x86_64.pkg.tar.gz
 
</pre>
 
</pre>
  
pacman.conf  (Just bare essentials right now, once pacman is installed it is well commented)
+
Replace /etc/mkinitcpio.conf with http://pastie.org/894541
<pre>
 
[options]
 
RootDir    = /mnt
 
DBPath      = /mnt/var/lib/pacman/
 
CacheDir    = /mnt/var/cache/pacman/pkg/
 
LogFile    = /mnt/var/log/pacman.log
 
 
 
[core]
 
Include = /mnt/config/pacman.d/mirrorlist
 
 
 
[extra]
 
Include = /mnt/config/pacman.d/mirrorlist
 
 
 
[community]
 
Include = /mnt/config/pacman.d/mirrorlist
 
</pre>
 
  
Next is the mirror list, i haven't scanned which is the fastest so I left in all US mirrors. You can either edit it with vi and uncomment all mirrors in the united states list, or remove it and paste in the list below. '''*NOTE you need to change the i686 at the end to x86_64*'''
+
Install the xen kernel and headers via pacman -U
  
 
<pre>
 
<pre>
vi /mnt/config/pacman.d/mirrorlist
+
# pacman -U kernel26-xen-2.6.32.9-1-x86_64.pkg.tar.gz
 +
# pacman -U kernel26-xen-headers-2.6.32.9-1-x86_64.pkg.tar.gz
 
</pre>
 
</pre>
  
Or paste in this
+
Install grub
  
 
<pre>
 
<pre>
# United States
+
pacman -S grub
Server = http://mirror.archlinux.com.ve/$repo/os/
 
Server = http://archlinux.unixheads.org/$repo/os/x86_64
 
Server = ftp://mirror.cs.vt.edu/pub/ArchLinux/$repo/os/x86_64
 
Server = http://mirror.cs.vt.edu/pub/ArchLinux/$repo/os/x86_64
 
Server = ftp://mirrors.easynews.com/linux/archlinux/$repo/os/x86_64
 
Server = http://mirrors.easynews.com/linux/archlinux/$repo/os/x86_64
 
Server = ftp://ftp.archlinux.org/$repo/os/x86_64
 
Server = http://mirrors.gigenet.com/archlinux/$repo/os/x86_64
 
Server = ftp://ftp.gtlib.gatech.edu/pub/linux/distributions/archlinux/$repo/os/x86_64
 
Server = http://www.gtlib.gatech.edu/pub/linux/distributions/archlinux/$repo/os/x86_64
 
Server = ftp://mirrors.hosef.org/archlinux/$repo/os/x86_64
 
Server = http://mirrors.hosef.org/archlinux/$repo/os/x86_64
 
Server = ftp://ibiblio.org/pub/linux/distributions/archlinux/$repo/os/x86_64
 
Server = http://distro.ibiblio.org/pub/linux/distributions/archlinux/$repo/os/x86_64
 
Server = ftp://locke.suu.edu/linux/dist/archlinux/$repo/os/x86_64
 
Server = ftp://mirror.rit.edu/archlinux/$repo/os/x86_64
 
Server = http://mirror.rit.edu/archlinux/$repo/os/x86_64
 
Server = http://schlunix.org/archlinux/$repo/os/x86_64
 
Server = http://mirror.sourceshare.org/archlinux/$repo/os/x86_64
 
Server = http://archlinux.umflint.edu/$repo/os/x86_64
 
Server = http://mirror.umoss.org/archlinux/$repo/os/x86_64
 
 
</pre>
 
</pre>
  
Okay we are getting close to installing the system.
+
Edit boot/grub/menu.lst and fill it with the following:
 
+
 
Make the necessary directories for pacman.
 
 
 
 
<pre>
 
<pre>
mkdir -p /mnt/var/lib/pacman
+
timeout 5
</pre>
+
default 0
  
Now we can install
+
# (0) Arch Linux
 
+
title  Arch Linux
Sync the repositories
+
root  (hd0,0)
 
+
kernel /boot/vmlinuz26-xen root=/dev/xvda1 ro console=/dev/xvc0
Now I'm lazy and that is a rather long command.
+
initrd /boot/kernel26-xen.img
<pre>
 
alias pacman='
 
/mnt/usr/bin/pacman.static -r /mnt --config /mnt/config/pacman.conf'
 
 
</pre>
 
</pre>
If you do that you can just type pacman :).
 
  
<pre>
+
Edit /etc/inittab and remove/comment these
/mnt/usr/bin/pacman.static -r /mnt --config /mnt/config/pacman.conf -Sy
 
</pre>
 
Install the base.
 
 
 
<pre>
 
/mnt/usr/bin/pacman.static -r /mnt --config /mnt/config/pacman.conf -Sf base base-devel
 
</pre>
 
 
 
Once that is done we can chroot into the new install and finish up the basics.
 
  
 
<pre>
 
<pre>
mount -t proc none /mnt/proc
+
# -8 options fixes umlauts problem on login
mount -o bind /dev /mnt/dev
+
c1:2345:respawn:/sbin/agetty -8 38400 tty1 linux
mount -o bind /sys /mnt/sys
+
c2:2345:respawn:/sbin/agetty -8 38400 tty2 linux
cat /etc/resolv.conf > /mnt/etc/resolv.conf
+
c3:2345:respawn:/sbin/agetty -8 38400 tty3 linux
chroot /mnt
+
c4:2345:respawn:/sbin/agetty -8 38400 tty4 linux
source /etc/profile.
+
c5:2345:respawn:/sbin/agetty -8 38400 tty5 linux
 +
c6:2345:respawn:/sbin/agetty -8 38400 tty6 linux
 
</pre>
 
</pre>
  
Note i was having an issue with, makepkg tar complaining about a time issue. I just exited and chrooted back in and it worked. This may not work. You can extract ahead of time, and pass the -e option to makepkg see below.
+
Uncomment this
 
 
Okay into the new system use, your editor of choice, i will be using nano (so replace nano with your editor).
 
 
 
First thing is setting the locales.
 
  
 
<pre>
 
<pre>
nano /etc/locale.gen
+
# Hypervisor Virtual Console for Xen and KVM
 +
# h0:2345:respawn:/sbin/agetty -8 38400 hvc0 linux
 
</pre>
 
</pre>
  
Choose your locales (probably uncomment the two en_US. entries near the top)
+
Edit etc/locale.gen to suit your needs, then run locale-gen
 
 
Run locale-gen
 
<pre>locale-gen</pre>
 
  
Make sure there are no updates.
+
This should fix everything complaining about time issues, though I have no idea if its the *best* way of doing it:
  
 
<pre>
 
<pre>
pacman -Suy
+
# echo xen > /sys/devices/system/clocksource/clocksource0/current_clocksource
 
</pre>
 
</pre>
  
Now for the kernel. There are two options.
+
Install SSH and configure it (http://wiki.archlinux.org/index.php/SSH)
Follow the guide here for building a stock kernel or use A package from aur. I had plenty of issues with the kernel so I went ahead with one from AUR.
 
 
[http://book.xen.prgmr.com/mediawiki/index.php/Using_a_kernel.org_kernel_under_xen Stock Kernel]
 
 
 
[http://aur.archlinux.org/packages.php?ID=16087 AUR Package]
 
 
 
Copy the link for the tarball.
 
  
 
<pre>
 
<pre>
wget tarball-link
+
# pacman -S openssh
tar -xvf kernel26-xen.tar.gz
 
cd kernel26-xen
 
makepkg -s --asroot
 
 
</pre>
 
</pre>
  
Now as stated you may run into some issues between tar and time. You can untar the sources by hand, and then tell makepkg to skip extraction. This can still be a pain.
+
Reboot your VPS and you should be good to go!
 
 
<pre>
 
cd package-dir(if your not in it)
 
tar -xvf  linux-2.6.29.tar.bz2 -C src
 
cp -auxfv patch-2.6.29.4-1-ARCH.bz2 src
 
cd src
 
bzip2 -d -k patch-2.6.29.4-1-ARCH.bz2
 
makepkg --asroot
 
</pre>
 
 
 
Note: Remember to install the package with pacman -U.
 
 
 
Make sure you can remotely log in after reboot.
 
 
 
<pre>
 
pacman -S openssh
 
nano /etc/hosts.allow
 
</pre>
 
 
 
<pre>
 
 
 
# /etc/hosts.allow
 
#
 
sshd:ALL
 
# End of file
 
</pre>
 
 
 
Or for now comment out the paranoid entry in /etc/hosts.deny
 
 
 
<pre>
 
# /etc/hosts.deny
 
#
 
 
 
#ALL: ALL: DENY
 
 
 
# End of file
 
</pre>
 
 
 
Edit ssh config for root login, or add a user to forgo root login. Of course now is a good time to secure up ssh.
 
nano /etc/ssh/sshd_config
 
 
 
Uncomment
 
<pre>
 
PermitRootLogin yes
 
</pre>
 
 
 
and if it's set to no change it to yes.
 
 
 
Edit rc.conf, I'm not going to go into rc.conf completely, just enough to get you started. Look through arch's wiki for more info.
 
 
 
Configure eth0.
 
 
 
<pre>
 
eth0="eth0 192.168.0.2 netmask 255.255.255.0 broadcast 192.168.0.255"
 
gateway="default gw 192.168.0.1"
 
ROUTES=(gateway) (Remove  the exclamation mark, that disables the gateway.
 
</pre>
 
 
 
Obviously replace the ip, broadcast, netmask and gateway with your info. If you came from debian and copied down /etc/network/interfaces, that will have all the info. But will be just as easy to get from the ifconfig output. If you want to just use dhcp.
 
 
 
DHCP eth0
 
<pre>
 
eth0="default"
 
gateway="default gw 192.168.0.1"
 
ROUTES=(!gateway) (Remove  the exclamation mark, that disables the gateway)
 
</pre>
 
 
 
Startup daemons, simply add ssh to the startup.
 
 
 
<pre>
 
DAEMONS=(syslog-ng network netfs crond sshd)
 
</pre>
 
 
 
Edit fstab for proper file system, again this will depend on partition layout, but should be pretty straight forward.  But for example
 
 
 
<pre>
 
/dev/xvda1 / ext3 defaults 0 1
 
</pre>
 
 
 
Repeat for your partitions.
 
 
 
Edit grub my grub entry looks like this. There is an issue with the console for xen. I'm not familiar enough with xen. The issue is that it shows, the init level however, you cant get a root login console. Hence why setting up ssh is so important
 
 
 
<pre>
 
nano /boot/grub/menu.lst
 
</pre>
 
 
 
Grub entry
 
 
 
<pre>
 
# (0) Arch Linux
 
title  Arch Linux  [/boot/vmlinuz26]
 
root  (hd0,0)
 
kernel /boot/vmlinuz26-xen-dom0 root=/dev/xvda1 ro console=/dev/xvc0
 
initrd /boot/kernel26-xen-dom0.img
 
</pre>
 
 
 
Note (Scyllinice): The VPS froze at "EXT3-fs: mounted filesystem with writeback data mode" with these grub settings. I removed the console bit and it booted with no freeze.
 
 
 
Grub should be still installed into your root directory. So there should be no need to install
 
 
Set roots password
 
 
 
<pre>
 
passwd
 
</pre>
 
 
 
Hope all goes well and reboot.
 
 
 
  
 
{{u}} {{distros}}
 
{{u}} {{distros}}

Revision as of 01:26, 30 March 2010

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 /dex/xvda1 /mnt
# cd /mnt

Download the install script and run it!

# wget http://calimeroteknik.free.fr/arch-guide/install-chroot.sh
# chmod +x install-chroot.sh
# ./install-chroot.sh

(The install script chroots for you, when you're finished just type exit)


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

# pacman -Rsdn kernel26

Wget the xen kernel binaries.

# wget http://95.130.15.18/xen/kernel26-xen-2.6.32.9-1-x86_64.pkg.tar.gz
# wget http://95.130.15.18/xen/kernel26-xen-headers-2.6.32.9-1-x86_64.pkg.tar.gz

Replace /etc/mkinitcpio.conf with http://pastie.org/894541

Install the xen kernel and headers via pacman -U

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

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=/dev/xvc0
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

Edit etc/locale.gen to suit your needs, then run locale-gen

This should fix everything complaining about time issues, though I have no idea if its the *best* way of doing it:

# echo xen > /sys/devices/system/clocksource/clocksource0/current_clocksource

Install SSH and configure it (http://wiki.archlinux.org/index.php/SSH)

# pacman -S openssh

Reboot your VPS and you should be good to go!