Arch Linux

From PrgmrWiki
Revision as of 15:29, 26 September 2009 by Dan (talk | contribs) ({{distros}})

Installing arch guide 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.

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.

/etc/fstab
/etc/network/interfaces (debian,dont use cent)
/etc/resolv.conf
Output of ifconfig for eth0.

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.

/sbin/mkfs.ext3 /dev/xvda*

Do this for each of your partitions.

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

mount /dev/xvda1 /mnt

Now to get pacman(package manager) going.

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.

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-20090616-1-x86_64.pkg.tar.gz


I recommend putting the config files for static pacman in a separate location I used /mnt/config.

mkdir /mnt/config
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

You will need to edit these files a bit, pacman.conf isn't even included so we will create that.

(Note. I don't use vi so i just copy and pasted these in, or remotely download them.)

vi /mnt/config/pacman.conf

pacman.conf (Just bare essentials right now, once pacman is installed it is well commented)

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

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*

vi /mnt/config/pacman.d/mirrorlist

Or paste in this

# United States
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

Okay we are getting close to installing the system.

Make the necessary directories for pacman.

mkdir -p /mnt/var/lib/pacman

Now we can install

Sync the repositories

Now I'm lazy and that is a rather long command.

alias pacman='
/mnt/usr/bin/pacman.static -r /mnt --config /mnt/config/pacman.conf'

If you do that you can just type pacman :).

/mnt/usr/bin/pacman.static -r /mnt --config /mnt/config/pacman.conf -Sy

Install the base.

/mnt/usr/bin/pacman.static -r /mnt --config /mnt/config/pacman.conf -Sf base base-devel

Once that is done we can chroot into the new install and finish up the basics.

mount -t proc none /mnt/proc
mount -o bind /dev /mnt/dev
mount -o bind /sys /mnt/sys
cat /etc/resolv.conf > /mnt/etc/resolv.conf
chroot /mnt
source /etc/profile.

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.

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.

nano /etc/locale.gen

Choose your locales (probably uncomment the two en_US. entries near the top)

Run locale-gen

locale-gen

Make sure there are no updates.

pacman -Suy

Now for the kernel. There are two options. 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.

Stock Kernel

AUR Package

Copy the link for the tarball.

wget tarball-link
tar -xvf kernel26-xen.tar.gz
cd kernel26-xen
makepkg --asroot

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.

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 -e

Make sure you can remotely log in after reboot.

pacman -S openssh
nano /etc/hosts.allow

# /etc/hosts.allow
#
	sshd:ALL
# End of file

Or for now comment out the paranoid entry in /etc/hosts.deny

# /etc/hosts.deny
#

#ALL: ALL: DENY

# End of file

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

PermitRootLogin yes

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.

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.

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

eth0="default"
gateway="default gw 192.168.0.1"
ROUTES=(!gateway) (Remove  the exclamation mark, that disables the gateway)

Startup daemons, simply add ssh to the startup.

DAEMONS=(syslog-ng network netfs crond sshd)

Edit fstab for proper file system, again this will depend on partition layout, but should be pretty straight forward. But for example

/dev/xvda1 / ext3 defaults 0 1

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

nano /boot/grub/menu.lst

Grub entry

# (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

Grub should be still installed into your root directory. So there should be no need to install

Set roots password

passwd

Hope all goes well and reboot.