Difference between revisions of "Install from existing Linux"

From ArchWiki
Jump to: navigation, search
(Additional libraries)
(Articles should not give credits (the link has been moved to see also): https://wiki.archlinux.org/index.php/Help:Style#Non-pertinent_content)
(43 intermediate revisions by 14 users not shown)
Line 1: Line 1:
 
[[Category:Getting and installing Arch]]
 
[[Category:Getting and installing Arch]]
 +
[[de:Schnellinstallation von einem bestehenden Linuxsystem]]
 
[[es:Install from Existing Linux]]
 
[[es:Install from Existing Linux]]
 +
[[fr:Install chroot]]
 
[[it:Install from Existing Linux]]
 
[[it:Install from Existing Linux]]
 
[[ru:Install from Existing Linux]]
 
[[ru:Install from Existing Linux]]
Line 6: Line 8:
 
[[zh-CN:Install from Existing Linux]]
 
[[zh-CN:Install from Existing Linux]]
 
[[zh-TW:Install from Existing Linux]]
 
[[zh-TW:Install from Existing Linux]]
{{Out of date|Needs to be updated for pacman 4}}
+
This guide is intended for anybody who wants to install Arch Linux from any other running Linux -- be it off a LiveCD or a pre-existing install of a different distro.
This guide is intended to combine and update the three previously existing and highly similar alternative install guides on this wiki.    This guide is intended for anybody who wants to install Arch Linux from any other running Linux -- be it off a LiveCD or a pre-existing install of a different distro.
+
 
+
This is useful for:
==Overview==
+
* remotely installing Archlinux (e.g. a (virtual) root server)
Arch Linux's [[pacman]] can be configured (-r) to perform operations in any directory you like, using that as the context of "root" while running.
+
* creating a new linux distribution or LiveCD based on Archlinux
+
* creating an Archlinux chroot environments
This is useful for building up new Arch Linux systems from scratch from another distro's LiveCD or existing installation. It is also useful for creating new chroot environments on a "host" system, maintaining a "golden-master" for development & distribution, or other fun topics like [[Diskless_network_boot_NFS_root|rootfs-over-NFS for diskless machines]].
+
* [[Diskless_network_boot_NFS_root|rootfs-over-NFS for diskless machines]]
  
 
This guide requires that the existing host system be able to execute the new target Arch Linux architecture programs.  In the case of an x86_64 host, it is possible to use i686-pacman to build a 32-bit chroot environment.  See [[Arch64 Install bundled 32bit system]].  However it is not so easy to build a 64-bit environment when the host only supports running 32-bit programs.
 
This guide requires that the existing host system be able to execute the new target Arch Linux architecture programs.  In the case of an x86_64 host, it is possible to use i686-pacman to build a 32-bit chroot environment.  See [[Arch64 Install bundled 32bit system]].  However it is not so easy to build a 64-bit environment when the host only supports running 32-bit programs.
  
Throughout this guide, we will refer to partitions as /dev/sdxx.  This refers to whatever dev entry you have on your system for the partition in question.  The convention is:
+
{{Note|If you are already using Arch, instead of following this guide, just install {{Pkg|arch-install-scripts}} from the [[Official Repositories|official repositories]] and follow the [[Installation Guide]]}}
Drive 1, Partition 1:  /dev/sda1
+
Drive 1, Partition 2:  /dev/sda2
+
Drive 2, Partition 1:  /dev/sdb1
+
etc...
+
  
We will refer to it as /dev/sdxx whenever possible.
+
'''This guide provides additional steps to the [[Installation Guide]]. The steps of that guide must still be followed as needed.'''
  
In this article,
+
==Prepare the system==
;host: refers to the computer which is used to perform the installation.
+
  
;target: refers to the computer where you want to install Arch.  
+
Follow the [[Installation Guide]] steps, until you have your partitions, keyboard and internet connection ready.
  
These may be one and the same computer. The host does not need to be an Arch system -- it can be a Debian or Redhat system, for example. The section entitled "Setup the host system" explains how to install pacman on the host. The following section "Setup the target system" explains how to use pacman from the host system to install Arch on the target system. Therefore if the host system is already running Arch, you can skip to "Setup the target system".
+
==Setup the environment for pacman==
  
Alternatively, if you have an Arch Linux Live CD, you can directly mount and use the root image in the Live CD as the host system with pacman and required libraries already installed. See section [[#Use Arch Linux Live CD Root Image as Host System]]
+
You need to create an environment where ''pacman'' and the ''arch install scripts'' can run on your current linux distro. (If you choose the Method 2, only pacman is necessary)
 +
{{Note|Choose one of this methods to create an environment able to execute the arch install scripts. That environment is '''not''' your final installation. You still need to do the rest of steps}}
  
==Setup the host system==
+
There are in principle two different methods to prepare that environment: either by '''installing pacman natively (Method 4 below)''' on your linux distro or by setting up a '''chroot environment'''.
 +
The latter way will generally be easier and is discussed next:
  
You need to install the Arch Linux package manager, pacman, on your host Linux environment. In addition you will need a list of pacman mirror sites which is used to download data on available packages as well as the packages themselves. If you are already using Arch, skip this step and go to [[Install from Existing Linux#Setup the target system]].
+
There are two possible ways of using the ''chroot'' method:
 +
* '''Using chroot as an installation environment''': The prepared Archlinux chroot environment will be used temporarily to set up the actual Archlinux installation using the ''arch-install-scripts''. This is a bit more work and takes longer but once you set up the installation system you can quickly install several Archlinux systems. '''However''', if you want to set up only a single Archlinux this might be overkill. You are actually setting up the system twice, have a lot more network traffic and especially need a lot more RAM and disk space, mostly due to the quite big iso image.
  
===Get the required packages===
+
* '''Installing Archlinux directly/Direct Bootstrapping''': Thanks to tokland's ''arch-bootstrap'' script this method is effectively a one-liner and very fast. After that one line of code your Archlinux base system is installed to disk. '''However''', if setting up multiple copies of Archlinux, this method requires the re-downloading of the base packages every time, so is slower.
  
====Introduction====
+
The best advice is probably to use '''Direct bootstrapping''' to set up only a small number of systems. If you set up many Archlinux systems the '''chroot install environment''' or even the '''native pacman''' installation might suit you better.
  
You need to get the required packages for your host Linux environment. The examples given here assume you are using an i686 environment. '''If you are running on a 64-bit Linux instead you should replace each occurrence of "i686" with "x86_64".'''
+
===Method 1: Chroot into LiveCD-image===
  
All version numbers given here may change. Please check the version numbers the packages are at first and note them down. The version numbers can be found at:
+
It is possible to mount the root image of the latest Archlinux installation media and then chroot into it. This method has the advantage of providing you with a working Arch Linux installation right within your host system without the need to prepare it by installing specific packages.
* {{pkg|pacman}}
+
* {{pkg|pacman-mirrorlist}}
+
  
Once you are sure of the version numbers, download the required packages (change the value of ARCH to either x86_64 or i686, see above):
+
{{Note|Before proceeding, make sure the latest version of {{Pkg|squashfs-tools}} is installed on the host system. Otherwise you will get errors like: {{ic|FATAL ERROR aborting: uncompress_inode_table: failed to read block}}.}}
  
ARCH=i686
+
* Download the lastest installation CD image from https://www.archlinux.org/download/
base_chroot=/tmp
+
mkdir ${base_chroot}/archlinux
+
cd ${base_chroot}/archlinux
+
  
====Download pacman's binaries and shared libraries====
+
* Mount the Live CD image:
 +
{{bc|# mount -o loop archlinux-{date}-dual.iso /mnt}}
  
You want to install pacman in order to be able to install software in your new base directory. We first download the binaries for [[pacman]], the Arch package manager.
+
* The root image exists in [[Wikipedia:Squashfs|squashfs format]] on the Live CD. The squashfs format is not editable as such. Hence, we unsquash the root image and then mount it.
* pacman: https://www.archlinux.org/packages/core/$ARCH/pacman/download/ . Change $ARCH according to your system.
+
* pacman-mirrorlist: https://www.archlinux.org/packages/core/any/pacman-mirrorlist/download/
+
  
==== Using wget to download ====
+
To unsquash the x86_64 (or i686 respectively) root image, run
wget  https://www.archlinux.org/packages/core/$ARCH/pacman/download/ --no-check-certificate --trust-server-names
+
{{bc|# unsquashfs -d /squashfs-root /mnt/arch/x86_64/root-image.fs.sfs}}
wget https://www.archlinux.org/packages/core/any/pacman-mirrorlist/download/ --no-check-certificate --trust-server-names
+
  
or this direct way (give attention to the date string in the file name, as it may need changing) :
+
* Now you can unmount and remove the iso image
{{bc|wget http://mirrors.kernel.org/archlinux/core/os/i686/pacman-mirrorlist-20120626-1-any.pkg.tar.xz}}
+
{{bc|
 +
# umount /mnt
 +
# rm archlinux-{date}-dual.iso
 +
}}
  
See [http://pwet.fr/man/linux/commandes/wget the man page] and the [http://www.gnu.org/software/wget/manual/wget.html official manual] of wget for further details.
+
* Now you can loop mount the root image
 +
{{bc|
 +
# mkdir /arch
 +
# mount -o loop /squashfs-root/root-image.fs /arch
 +
}}
  
==== Using lftp to download ====
+
* Before [[Change Root|chrooting]] to it, we need to set up some mount points.
If you have issues with downloading '''pacman-mirrorlist''' use this direct way with lftp :
+
{{bc|
{{bc|1=link_name=http://mirrors.kernel.org/archlinux/core/os/i686/
+
# mount -t proc none /arch/proc
lftp -e "mget pacman-mirrorlist-*.tar.xz" "${link_name}"}}
+
# mount -t sysfs none /arch/sys
 +
# mount -o bind /dev /arch/dev
 +
# mount -o bind /dev/pts /arch/dev/pts # important for pacman (for signature check)
 +
}}
  
==== Additional libraries====
+
* Now everything is prepared to chroot into your newly installed Arch environment
You may need additional libraries to make pacman work, for newer distributions:
+
{{bc|# chroot /arch bash}}
  
for software_name in libarchive openssl xz expat ; do wget https://www.archlinux.org/packages/core/$ARCH/${software_name}/download/ --no-check-certificate --trust-server-names ; done
+
This chroot is able to execute the arch install scripts. The destination partitions should be mounted under the {{ic|/mnt}} directory from this chroot.
  
When using an older distribution to bootstrap, a few more libraries may be needed for it to work, for example :
+
===Method 2: Direct bootstrapping Archlinux===
{{bc|for software_name in glibc gcc-libs binutils libssh2 curl gcc libarchive openssl xz expat ; do wget https://www.archlinux.org/packages/core/$ARCH/${software_name}/download/ --no-check-certificate --trust-server-names ; done}}
+
Also note that below when you set LD_LIBRARY_PATH you have to add /lib and /lib64:
+
{{bc|1=export LD_LIBRARY_PATH=${base_chroot}/archlinux/usr/lib:${base_chroot}/archlinux/lib:${base_chroot}/archlinux/usr/lib64:$LD_LIBRARY_PATH}}
+
  
Unpack all needed packages:
+
This method will install a basic Archlinux system directly onto your previously prepared root file system mounted as {{ic|/mnt}}. This is known as [http://en.wikipedia.org/wiki/Bootstrapping#Computing bootstrapping] and is definitely the '''quickest way''' to install a single Archlinux system from a foreign distribution. Moreover, it is less disk consuming as method 1 as it does not require to download the whole Archlinux installation image. Therefore bootstrapping is the method of choice for installing Archlinux on a '''remote host''', such as a virtual root server using some arbitrary GNU/Linux-based rescue environment.
for f in *.pkg.tar*; do tar xvf $f; done
+
  
To prepare for using pacman, do not forget to edit {{Ic|/tmp/archlinux/etc/pacman.conf}} to point to {{Ic|/tmp/archlinux/etc/pacman.d/mirrorlist}} and select your favorite mirror. For easier use (assuming you are using {{Ic|bash}} or {{Ic|zsh}}), you may set up an environment:
+
As described in the [[Installation Guide]] we assume your disk which should become your root device is mountet at {{ic|/mnt}}. At first grab ''tokland's'' ''arch-bootstrap'' script, c.f. [[Archbootstrap]],
export PATH=${base_chroot}/archlinux/usr/bin:$PATH
+
export LD_LIBRARY_PATH=${base_chroot}/archlinux/usr/lib:$LD_LIBRARY_PATH
+
alias pacman="pacman --config ${base_chroot}/archlinux/etc/pacman.conf"
+
  
====Install pacman on the host system====
+
# cd /tmp
{{Note|('''Issues while running pacman on 64-bit host''') If while running pacman you end up with {{ic|/tmp/archlinux/usr/bin/pacman: No such file or directory}} please symlink ld-linux-x86-64.so.2: {{ic|ln -s /lib64/ld-linux-x86-64.so.2 /lib/}}}}
+
# wget http://tokland.googlecode.com/svn/trunk/archlinux/arch-bootstrap.sh
 +
# chmod +x arch-bootstrap.sh
  
 +
This script will bootstrap a basic archlinux system, i.e., it will download the linux kernel, pacman basic tools like bash and all needed dependencies and unpack them to the given directory, in this case {{ic|/mnt}}.
  
If you do not mind littering your install host, you can extract all the downloaded tar balls into your root directory by running as root:
+
If you are wanting to install a 32-bit system:
{{Note|However, keep in mind that this operation could erase some of your files, and break your system.}}
+
  # ./arch-bootstrap.sh -a i686 -r "ftp://ftp.hosteurope.de/mirror/ftp.archlinux.org" /mnt/
  cd /
+
Or a 64-bit system:
for f in /tmp/archlinux/pacman-*pkg.tar.gz ; do
+
  # ./arch-bootstrap.sh -a x86_64 -r "ftp://ftp.hosteurope.de/mirror/ftp.archlinux.org" /mnt/
  tar xzf $f
+
  done
+
  
<ol>
+
The bootstrapping will take 2-5 minutes depending on the speed of your system.
<li><div>If installing from Ubuntu 9.10's LiveCD (perhaps other versions), you will need more than just the pacman files (shared libs) to use pacman at all.  Use Lucky's script described in [[https://bbs.archlinux.org/viewtopic.php?pid=759166 this thread]] to get/install them for you!
+
  
</div></li>
+
If the architecture of the foreign distribution is not the same as the one of the newly bootstrapped system you might have to change the architecture in {{ic|/etc/pacman.conf}}.
<li><div>Alternatively, you can instead turn these tarballs into packages for your distribution with the [http://kitenet.net/~joey/code/alien/ alien] tool. See the man page of the tool for instructions. The packages created that way may be installed into your host distribution using the usual package management tools available there. This approach offers the best integration into the host Linux environment. For a Debian package based system this is done with the following commands:
+
cd /tmp/archlinux
+
alien -d pacman-*-i686.pkg.tar.xz
+
alien -d pacman-mirrorlist-20120626-1-any.pkg.tar.xz
+
  
RPM based systems will need to replace the parameter "-d" with "-r".
+
If your bootstrapped system is 32-bit system:
 +
Architecture = i686
 +
Or for a 64-bit system:
 +
Architecture = x86_64
  
These distribution packages can then get installed using the normal package management tools of the host Linux environment.
+
Before chrooting into the newly created system we need to set up some mount points.
</div></li>
+
This is essential for the installation of a bootloader later on, c.f. [[Change Root]].
<li><div>
+
# mount -t proc none /mnt/proc
Under Fedora 12, I was not able to install pacman with any of the other methods, but with the nice script at https://bbs.archlinux.org/viewtopic.php?pid=734336#p734336 it will download and install it for you. Worked wonderfully for me.
+
# mount -t sysfs none /mnt/sys
</div></li>
+
# mount -o bind /dev /mnt/dev
<li><div>On [http://gentoo.org/ Gentoo]: Just unmask pacman by adding {{Ic|sys-apps/pacman}} to {{Ic|/etc/portage/package.keywords}}. Now just run {{Ic|emerge -av pacman}}.
+
# mount -o bind /dev/pts /mnt/dev/pts # important for pacman (for signature check)
There is also a [http://ohnopub.net/~ohnobinki/gentoo/arch/ more detailed tutorial].
+
</div></li>
+
</ol>
+
  
===Use Arch Linux Live CD Root Image as Host System===
+
Now everything is prepared to chroot into your newly installed Arch environment
 +
# chroot /mnt bash
  
Alternatively, instead of installing pacman on your host system, you can mount the root image of an Arch Linux Live CD and then chroot into it. This method has the advantage of providing you with a working Arch Linux installation right within your host system without the need to prepare it by installing specific packages.
+
Before you can use ''pacman'' you have to initialize its keyring as explained below, in [[#Fix the Pacman Signature Keyring]].
  
====Unsquash the root image====
+
From here on proceed with [[Installation Guide#Install the base system]], '''but''' remember, you are already working in your final system, thus no need for {{ic|pacstrap}}, simply use {{ic|pacman}}. So the next command you are most likely to execute will be
  
The root image exists in squashfs format on the Live CD. The squashfs format is not editable as such. Hence, we unsquash the root image and then mount it.
+
  # pacman -S base # and evtl. also base-devel
  
To unsquash the root image, run
+
===Method 3: Bootstrapping the arch installation scripts===
unsquashfs -d /squashfs-root root-image.sqfs
+
  
====Mount root file system====
+
Contrary to the other methods, '''this method is one-step only'''; you only have to execute the script below and thats it.
  
Then, mount the unsquashed root file system to a suitable mount point. We shall mount it to /arch. You can mount it wherever you want.
+
This method can be considered an hybrid between Method 1 and Method 2. It provides a chroot enviroment from where to execute the arch install scripts (similar to Method 1), by using a bootstrapping script (similar to Method 2).
livecd_arch=/arch
+
mount -B /squashfs-root ${livecd_arch}
+
  
====Chroot into the Live CD root file system====
+
The script below is going to create a directory called {{ic|archinstall-pkg}} and download the required packages there. Then, is going to extract them into the {{ic|archinstall-chroot}} directory. Finally, is going to prepare mount points, configure pacman and enter into a chroot.
 +
{{Note|This is '''only''' an enviroment to execute the arch install scripts: '''this is not your final installation'''. }}
  
Mount various file systems into the Live CD root file system:
+
This chroot is able to execute the arch install scripts. '''The destination partitions should be mounted under the {{ic|/mnt}} directory from this chroot'''. After that, continue with the next step, which is [[#Fix the Pacman Signature Keyring]].
mount -t proc /proc ${livecd_arch}/proc
+
mount -t sysfs /sys ${livecd_arch}/sys
+
mount -B /dev ${livecd_arch}/dev
+
mount -t devpts /dev/pts ${livecd_arch}/dev/pts
+
  
Then, chroot into the Live CD root file system:
+
'''CHROOT_DIR=archinstall-chroot Must Change First, or you might ruin your /etc/'''
chroot ${livecd_arch} /bin/bash
+
  
===Configure the host system===
+
{{hc|archinstall-bootstrap.sh|<nowiki>
 +
#!/bin/bash
 +
# This script is inspired on the archbootstrap script.
  
The main goal of this operation is to make a proper configuration to pacman.
+
PACKAGES=(acl attr bzip2 curl expat glibc gpgme libarchive libassuan libgpg-error libssh2 openssl pacman xz zlib pacman-mirrorlist coreutils bash grep gawk file tar ncurses readline libcap util-linux pcre arch-install-scripts)
 +
# Change the mirror as necessary
 +
MIRROR='http://mirrors.kernel.org/archlinux'
 +
# You can set the ARCH variable to i686 or x86_64
 +
ARCH=`uname -m`
 +
LIST=`mktemp`
 +
CHROOT_DIR=archinstall-chroot
 +
DIR=archinstall-pkg
 +
mkdir -p "$DIR"
 +
mkdir -p "$CHROOT_DIR"
 +
# Create a list with urls for the arch packages
 +
for REPO in core community extra; do 
 +
        wget -q -O- "$MIRROR/$REPO/os/$ARCH/" |sed  -n "s|.*href=\"\\([^\"]*\\).*|$MIRROR\\/$REPO\\/os\\/$ARCH\\/\\1|p"|grep -v 'sig$'|uniq >> $LIST 
 +
done
 +
# Download and extract each package.
 +
for PACKAGE in ${PACKAGES[*]}; do
 +
        URL=`grep "$PACKAGE-[0-9]" $LIST|head -n1`
 +
        FILE=`echo $URL|sed 's/.*\/\([^\/][^\/]*\)$/\1/'`
 +
        wget "$URL" -c -O "$DIR/$FILE"
 +
        xz -dc "$DIR/$FILE" | tar x -k -C "$CHROOT_DIR"
 +
done
 +
# Create mount points
 +
mkdir -p "$CHROOT_DIR/dev" "$CHROOT_DIR/proc" "$CHROOT_DIR/sys" "$CHROOT_DIR/mnt"
 +
mount -t proc proc "$CHROOT_DIR/proc/"
 +
mount -t sysfs sys "$CHROOT_DIR/sys/"
 +
mount -o bind /dev "$CHROOT_DIR/dev/"
 +
mkdir -p "$CHROOT_DIR/dev/pts"
 +
mount -t devpts pts "$CHROOT_DIR/dev/pts/"
  
Configure your /etc/pacman.conf to your liking, and remove unnecessary mirrors from /etc/pacman.d/mirrorlist. Also, enabling at least a few mirrors might become necessary, as you may experience errors during syncing if you have no mirror set. You may want to manually resolve DNS in the /etc/pacman.d/mirrorlist, because pacman for i686 may not be able to get address information on x86_64 systems.
+
# Hash for empty password  Created by doing: openssl passwd -1 -salt ihlrowCo and entering an empty password (just press enter)
+
echo 'root:$1$ihlrowCo$sF0HjA9E8up9DYs258uDQ0:10063:0:99999:7:::' > "$CHROOT_DIR/etc/shadow"
If you are installing from a LiveCD, and you have a system with a low amount of combined RAM and swap (< 1 GB), be sure to set the cachedir in /etc/pacman.conf to be in the new Arch partition (e.g. {{ic|/newarch/var/cache/pacman/pkg}}).  Otherwise you could exhaust memory between the overhead of the existing distro and downloading necessary packages to install.
+
echo "root:x:0:0:root:/root:/bin/bash" > "$CHROOT_DIR/etc/passwd"
 +
touch "$CHROOT_DIR/etc/group"
 +
echo "myhost" > "$CHROOT_DIR/etc/hostname"
 +
test -e "$CHROOT_DIR/etc/mtab" || echo "rootfs / rootfs rw 0 0" > "$CHROOT_DIR/etc/mtab"
 +
[ -f "/etc/resolv.conf" ] && cp "/etc/resolv.conf" "$CHROOT_DIR/etc/"
 +
sed -ni '/^[ \t]*CheckSpace/ !p' "$CHROOT_DIR/etc/pacman.conf"
 +
sed -i "s/^[ \t]*SigLevel[ \t].*/SigLevel = Never/" "$CHROOT_DIR/etc/pacman.conf"
 +
echo "Server = $MIRROR/\$repo/os/$ARCH" >> "$CHROOT_DIR/etc/pacman.d/mirrorlist"
  
==Setup the target system==
+
chroot $CHROOT_DIR /usr/bin/pacman -Sy
 +
chroot $CHROOT_DIR /bin/bash
 +
</nowiki>}}
  
===Prepare a partition for Arch===
+
===Method 4: Install pacman natively on non-arch distro (advanced)===
 +
{{Warning|This method is potentially difficult, your mileage may vary from distro to distro. If you just want to do an arch installation from another distro and you are not interested in have pacman as a regular program under such distro, is better to use a different method.}}
  
You do not ''have to'' install Arch on a separate partition. You could instead build up a root filesystem in a normal directory, and then create a master tarball from it, or transfer it across the network.
+
This method is about installing pacman and the arch install scripts directly under another distro, so they become regular programs on that distro.
  
However, most users will want to be installing Arch onto its own partition.
+
This is really useful if you are planning to use another distro regularly to install arch linux, or do fancy things like updating packages of an arch installation using another distro. This is the only method that not imply creating a chroot to be able to execute pacman and the arch install scripts. (but since part of the installation includes entering inside a chroot, you'll end using a chroot anyway)
  
Prepare any partitions and filesystems you need for your installation. If your host system has any GUI tools for this, such as gparted, cfdisk, or Mandrake's diskdrake, feel free to use them.
+
==== Download pacman source code and pacman packages ====
+
Visit the pacman homepage: https://www.archlinux.org/pacman/#_releases and download the latest release.
To format a partition as ext4, you run (where /dev/sdxx is the partition you want to setup):  
+
mkfs.ext4 /dev/sdxx
+
To format it as ext3 with journaling and dir_index:
+
mkfs.ext4 -j -O dir_index /dev/sdxx
+
To format it as reiserfs:
+
mkreiserfs /dev/sdxx
+
To format a partition as swap, and to start using it:
+
mkswap /dev/sdxx
+
swapon /dev/sdxx
+
  
Most other filesystems can be setup with their own mkfs variant, take a look using tab completion. Available filesystems depend entirely on your host system.
+
Now, download the following packages:
+
Once you have your filesystems setup, mount them. Throughout this guide, we will refer to the new Arch root directory as /newarch, however you can put it wherever you like.
+
new_arch=/newarch
+
mkdir ${new_arch}
+
mount /dev/sdxx ${new_arch}
+
  
===Install the core===
+
* pacman-mirrorlist: https://www.archlinux.org/packages/core/any/pacman-mirrorlist/download/
 +
* arch-install-scripts: https://www.archlinux.org/packages/extra/any/arch-install-scripts/download/
 +
* pacman (necessary for the config files): https://www.archlinux.org/packages/core/x86_64/pacman/download/ (change x86_64 as necessary)
  
Update pacman. You may have to create the {{ic|/newarch/var/lib/pacman}} folder for it to work (see "Setup the host system" above):
+
==== Install dependencies ====
mkdir -p ${new_arch}/var/lib/pacman
+
Using your distribution mechanisms, install the required packages for pacman and the arch install scripts. libcurl, libarchive, fakeroot, xz, asciidoc, wget, and sed are among them. Of course, gcc, make and maybe some other "devel" packages are necessary too.
pacman -Sy -r ${new_arch}
+
  
Install the 'base' group of packages and the Archlinux keyring:
+
==== Compile pacman ====
mkdir -p ${new_arch}/var/cache/pacman/pkg
+
pacman  -S base archlinux-keyring --cachedir ${new_arch}/var/cache/pacman/pkg -r ${new_arch}
+
  
===Prepare /dev nodes===
+
* Decompress the pacman source code and cd inside.
 +
* Execute configure, adapting the paths as necessary: {{bc|<nowiki> ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --enable-doc</nowiki>}}
 +
If you get errors here, chances are you are missing dependencies, or your current libcurl, libarchive or others, are too old. Install the dependencies missing using your distro options, or if they are too old, compile them from source.
 +
* Compile {{bc|make}}
 +
* If there were no errors, install the files {{bc|make install}}
 +
* You may need to manually call {{ic|ldconfig}} to make your distro detect libalpm.
 +
==== Prepare configuration files ====
 +
Now is time to extract the configuration files. Change the x86_64 as necessary.
 +
* Extract the pacman.conf and makepkg.conf files from the pacman package, and disable signature checking: {{bc|<nowiki>tar xJvf pacman-*-x86_64.pkg.tar.xz etc -C / ; sed -i 's/SigLevel.*/SigLevel = Never/g' /etc/pacman.conf</nowiki>}}
 +
* Extract the mirror list: {{bc|tar xJvf pacman-mirrorlist-*-any.pkg.tar.xz -C /}}
 +
* Enable some mirrors on {{ic|/etc/pacman.d/mirrorlist}}
 +
* Extract the arch-install-scripts {{bc|tar xJvf arch-install-scripts-*-any.pkg.tar.xz -C /}}
  
First, ensure the correct {{ic|/dev}} nodes have been made for [[udev]]:
+
Another option is using the {{ic|alien}} tool to convert the {{ic|pacman-mirrorlist}} and {{ic|arch-install-scripts}} (but no {{ic|pacman}}) to native packages of your distro.
ls -alF ${new_arch}/dev
+
  
This result in a list containing lines similar to the following (the dates will differ for you):
+
==Fix the Pacman Signature Keyring==
crw-------  1 root root 5, 1 2008-12-27 21:40 console
+
crw-rw-rw-  1 root root 1, 3 2008-12-27 21:42 null
+
crw-rw-rw-  1 root root 1, 5 2008-12-27 21:40 zero
+
  
Delete and recreate any device which has a different set of permissions (the crw-... stuff plus the two root entries) and major/minor numbers (the two before the date).
+
It is necessary to initialize ''pacman's'' keyring for signature checking.
  
cd ${new_arch}/dev
+
This is done using
  rm -f console ; mknod -m 600 console c 5 1
+
  # pacman-key --init # read the note below!
  rm -f null ; mknod -m 666 null c 1 3
+
  # pacman-key --populate archlinux
rm -f zero ; mknod -m 666 zero c 1 5
+
  
All device nodes should have been created for you already with the right permissions and you should not need to recreate any of them.
+
'''However''', when connected via SSH you might run out of [http://en.wikipedia.org/wiki/Entropy_(computing) entropy]. In this case you can try something like
  
===Chroot===
+
# cat /usr/bin/* > /dev/null &
Now we will [[Change Root|chroot into the new Arch system]].
+
# find / > /dev/null &
  
In order for DNS to work properly you need to edit {{ic|${new_arch}/etc/resolv.conf}} or replace it with the resolv.conf from your running distribution
+
before executing {{ic|pacman-key --init}}.
cp /etc/resolv.conf ${new_arch}/etc/
+
  
Also, you need to copy a correctly setup mirrorlist into the new system:
+
It might take some time. If nevertheless all this does help install {{Pkg|haveged}} and run prior to {{ic|pacman-key --init}}
  cp /etc/pacman.d/mirrorlist ${new_arch}/etc/pacman.d
+
  # /usr/sbin/haveged -w 1024 -v 1
  
Finally edit the pacman configuration file {{ic|${new_arch}/etc/pacman.conf}} setting "Architecture" so that it matches the one of the target system.
 
The default of "auto" might fail if it is different from the host system.
 
  
Architecture = i686 or x86_64
+
==Setup the target system==
  
Mount various filesystems into the new Arch system:
+
At this point, follow the normal steps of [[Installation Guide]]. Remember to mount the destination partition under the {{ic|/mnt}} of the chroot.
mount -t proc proc ${new_arch}/proc
+
mount -t sysfs sys ${new_arch}/sys
+
mount -o bind /dev ${new_arch}/dev
+
mount -t devpts pts ${new_arch}/dev/pts
+
 
+
If you have a separate {{ic|/boot}} partition, you will probably need to mount that too. See [[Change Root]] for more details.
+
 
+
{{Warning|If you have a separate {{ic|/boot}} partition and plan on using grub2, make sure to mount {{ic|/boot}} after chrooting. If you mount the {{ic|/boot}} partition before the chroot, grub2 will assume that {{ic|/boot}} and root are on the same partition and will not update correctly. }}
+
 
+
When everything is prepared, chroot into the new filesystem:
+
 
+
chroot ${new_arch} /bin/bash
+
 
+
Then setup [[pacman-key]] and verify the Master keys:
+
pacman-key --init ; pacman-key --populate archlinux
+
 
+
===Install the rest===
+
Install your preferred kernel, and any other packages you may wish to install.
+
For the default kernel (which is already installed!):
+
pacman -S --needed linux
+
 
+
If you wish to install extra packages now, you may do so with:
+
pacman -S packagename
+
 
+
===Configure the target system===
+
Edit your {{ic|/etc/fstab}}, remembering to add /, swap and any other partitions you may wish to use.
+
+
Edit your {{ic|/etc/rc.conf}}, {{ic|/etc/hosts}} and {{ic|/etc/mkinitcpio.conf}} to your needs. If you are installing Arch Linux to a USB flash drive, don't forget to add the {{ic|usb}} hook to {{ic|/etc/mkinitcpio.conf}}. Then, rebuild the initcpio image:
+
mkinitcpio -p linux
+
 
+
Edit {{ic|/etc/locale.gen}}, uncommenting any locales you wish to have available, and build the locales:
+
locale-gen
+
 
+
===Setup Grub===
+
To use [[GRUB]] when chrooted, you need to ensure that {{ic|/etc/mtab}} is up-to-date:
+
diff /etc/mtab /proc/mounts
+
If you get any output from the previous command, run:
+
grep -v rootfs /proc/mounts > /etc/mtab 
+
 
+
You can now run:
+
grub-install /dev/sdx
+
 
+
If grub-install fails, you can manually install:
+
grub
+
grub> find /boot/grub/stage1    (You should see some results here if you have done everything right so far.  If not, back up and retrace your steps.)
+
grub> root (hd0,X)    (Note that Grub 1 and Grub 2 differ in how they each handle partition numbering. See the GRUB articles for info.)
+
grub> setup (hd0)
+
grub> quit
+
 
+
Double-check your {{ic|/boot/grub/menu.lst}}. Depending on the host, it could need correcting from hda to sda, and a prefix of /boot as well in the paths.
+
 
+
====Manual recovery of GRUB libs ====
+
 
+
The {{ic|*stage*}} files are expected to be in {{ic|/boot/grub}}, which may not be the case if the bootloader was not installed during system installation or if the partition/filesystem was damaged, accidentally deleted, etc. 
+
 
+
Manually copy the grub libs like so:
+
# cp -a /usr/lib/grub/i386-pc/* /boot/grub
+
 
+
{{Note|Do not forget to mount the system's boot partition if your setup uses a separate one!  The above assumes that either the boot partition resides on the root filesystem or is mounted to /boot on the root file system!}}
+
 
+
Detailed instructions for [[GRUB]], [[GRUB2]], [[LILO]], [[Burg]] and [[Syslinux]] are available; see also [[:Category:Boot loaders]].
+
 
+
===Finishing touches===
+
See [[Beginners_Guide#Configure_the_system|Beginners Guide:Configure the system]]. You can ignore 2.11, but the rest of that guide should be of use to you in post-installation configuration of your system.
+
+
[[Change_Root#Cleaning_up|Exit your chroot]]:
+
exit
+
umount ${new_arch}/boot  # if you mounted this or any other separate partitions
+
umount ${new_arch}/{proc,sys,dev}
+
umount ${new_arch}
+
 
+
Reboot to your new Arch system!
+
 
+
== An alternate, simpler installation method ==
+
 
+
This method is verified to be working as of 1-4-12.
+
This works best if you are in a LiveCD environment (or, in the case of servers, a GNU/Linux-based rescue environment). Firstly, you need to mount the disk you want to use for the Archlinux installation at /mnt. In this example, /dev/sda1 is used.
+
mnt /dev/sda1 /mnt
+
cd ~
+
wget http://tokland.googlecode.com/svn/trunk/archlinux/arch-bootstrap.sh && chmod +x arch-bootstrap.sh
+
 
+
If you are wanting to install a 32-bit system:
+
./arch-bootstrap.sh -a i686 -r "ftp://ftp.hosteurope.de/mirror/ftp.archlinux.org" /mnt/
+
Or a 64-bit system:
+
./arch-bootstrap.sh -a x86_64 -r "ftp://ftp.hosteurope.de/mirror/ftp.archlinux.org" /mnt/
+
 
+
The bootstrapping will take 2-5 minutes depending on the speed of your system.
+
 
+
mount -t proc none /mnt/proc
+
mount -t sysfs none /mnt/sys
+
mount -o bind /dev /mnt/dev
+
 
+
Mounting these is essential for the installation of a bootloader later on.
+
 
+
If you have switched between architectures, ''pacman'' auto-detection might not work, in this case you need to edit /etc/pacman.conf to:
+
 
+
From 64-bit to a 32-bit system:
+
Architecture = i686
+
Or from 32-bit to a 64-bit system:
+
Architecture = x86_64
+
  
Now for the fun part, chroot into your newly installed Arch installation:
+
  # pacstrap /mnt base base-devel
  chroot /mnt bash
+
  # # ...
pacman -Sy base
+
  mkinitcpio -p linux
+
  
Choose a bootloader. You can find the installation instructions on their own dedicated pages. ([[Syslinux]], [[Grub]], [[Grub2]], etc.).
+
===Edit the fstab file===
  
'''Remember:''' You will still need to do any final configuration touches as you would in a normal Arch install.
+
Probably the {{ic|genfstab}} script won't work. In that case, you'll need to edit the {{ic|/mnt/etc/fstab}} file by hand.
 +
You can use the content of {{ic|/etc/mtab}} as reference.
  
''Credits to the Turkish site [http://raptiye.org/blog/2011/3/27/hetznerde-arch-linux-kurulumu/ Raptiye] for the original guide.''
+
===Finish the Installation===
 +
Now just do the rest of the steps normally.
  
==Troubleshooting==
+
==Tips and tricks==
 +
* In case you want to replace an existing system, but can for some reason not use a LiveCD, since, e.g., you have no physical access to the computer, the following tip might help: If you manage to get ~500MB of free space somewhere on the disk (e.g. by partitioning a swap partition) you can install the new Archlinux system there, reboot into the newly created system and [[Full_System_Backup_with_rsync#With_a_single_command|rsync the entire system]] to the primary partition. Finally don't forget to fix the bootloader configuration before rebooting.
 +
== See also ==
 +
* [https://github.com/tokland Archbootstrap homepage]

Revision as of 17:28, 26 February 2013

This guide is intended for anybody who wants to install Arch Linux from any other running Linux -- be it off a LiveCD or a pre-existing install of a different distro.

This is useful for:

  • remotely installing Archlinux (e.g. a (virtual) root server)
  • creating a new linux distribution or LiveCD based on Archlinux
  • creating an Archlinux chroot environments
  • rootfs-over-NFS for diskless machines

This guide requires that the existing host system be able to execute the new target Arch Linux architecture programs. In the case of an x86_64 host, it is possible to use i686-pacman to build a 32-bit chroot environment. See Arch64 Install bundled 32bit system. However it is not so easy to build a 64-bit environment when the host only supports running 32-bit programs.

Note: If you are already using Arch, instead of following this guide, just install arch-install-scripts from the official repositories and follow the Installation Guide

This guide provides additional steps to the Installation Guide. The steps of that guide must still be followed as needed.

Prepare the system

Follow the Installation Guide steps, until you have your partitions, keyboard and internet connection ready.

Setup the environment for pacman

You need to create an environment where pacman and the arch install scripts can run on your current linux distro. (If you choose the Method 2, only pacman is necessary)

Note: Choose one of this methods to create an environment able to execute the arch install scripts. That environment is not your final installation. You still need to do the rest of steps

There are in principle two different methods to prepare that environment: either by installing pacman natively (Method 4 below) on your linux distro or by setting up a chroot environment. The latter way will generally be easier and is discussed next:

There are two possible ways of using the chroot method:

  • Using chroot as an installation environment: The prepared Archlinux chroot environment will be used temporarily to set up the actual Archlinux installation using the arch-install-scripts. This is a bit more work and takes longer but once you set up the installation system you can quickly install several Archlinux systems. However, if you want to set up only a single Archlinux this might be overkill. You are actually setting up the system twice, have a lot more network traffic and especially need a lot more RAM and disk space, mostly due to the quite big iso image.
  • Installing Archlinux directly/Direct Bootstrapping: Thanks to tokland's arch-bootstrap script this method is effectively a one-liner and very fast. After that one line of code your Archlinux base system is installed to disk. However, if setting up multiple copies of Archlinux, this method requires the re-downloading of the base packages every time, so is slower.

The best advice is probably to use Direct bootstrapping to set up only a small number of systems. If you set up many Archlinux systems the chroot install environment or even the native pacman installation might suit you better.

Method 1: Chroot into LiveCD-image

It is possible to mount the root image of the latest Archlinux installation media and then chroot into it. This method has the advantage of providing you with a working Arch Linux installation right within your host system without the need to prepare it by installing specific packages.

Note: Before proceeding, make sure the latest version of squashfs-tools is installed on the host system. Otherwise you will get errors like: FATAL ERROR aborting: uncompress_inode_table: failed to read block.
  • Mount the Live CD image:
# mount -o loop archlinux-{date}-dual.iso /mnt
  • The root image exists in squashfs format on the Live CD. The squashfs format is not editable as such. Hence, we unsquash the root image and then mount it.

To unsquash the x86_64 (or i686 respectively) root image, run

# unsquashfs -d /squashfs-root /mnt/arch/x86_64/root-image.fs.sfs
  • Now you can unmount and remove the iso image
# umount /mnt
# rm archlinux-{date}-dual.iso
  • Now you can loop mount the root image
# mkdir /arch
# mount -o loop /squashfs-root/root-image.fs /arch
  • Before chrooting to it, we need to set up some mount points.
# mount -t proc none /arch/proc
# mount -t sysfs none /arch/sys
# mount -o bind /dev /arch/dev
# mount -o bind /dev/pts /arch/dev/pts # important for pacman (for signature check)
  • Now everything is prepared to chroot into your newly installed Arch environment
# chroot /arch bash

This chroot is able to execute the arch install scripts. The destination partitions should be mounted under the /mnt directory from this chroot.

Method 2: Direct bootstrapping Archlinux

This method will install a basic Archlinux system directly onto your previously prepared root file system mounted as /mnt. This is known as bootstrapping and is definitely the quickest way to install a single Archlinux system from a foreign distribution. Moreover, it is less disk consuming as method 1 as it does not require to download the whole Archlinux installation image. Therefore bootstrapping is the method of choice for installing Archlinux on a remote host, such as a virtual root server using some arbitrary GNU/Linux-based rescue environment.

As described in the Installation Guide we assume your disk which should become your root device is mountet at /mnt. At first grab tokland's arch-bootstrap script, c.f. Archbootstrap,

# cd /tmp
# wget http://tokland.googlecode.com/svn/trunk/archlinux/arch-bootstrap.sh
# chmod +x arch-bootstrap.sh

This script will bootstrap a basic archlinux system, i.e., it will download the linux kernel, pacman basic tools like bash and all needed dependencies and unpack them to the given directory, in this case /mnt.

If you are wanting to install a 32-bit system:

# ./arch-bootstrap.sh -a i686 -r "ftp://ftp.hosteurope.de/mirror/ftp.archlinux.org" /mnt/

Or a 64-bit system:

# ./arch-bootstrap.sh -a x86_64 -r "ftp://ftp.hosteurope.de/mirror/ftp.archlinux.org" /mnt/

The bootstrapping will take 2-5 minutes depending on the speed of your system.

If the architecture of the foreign distribution is not the same as the one of the newly bootstrapped system you might have to change the architecture in /etc/pacman.conf.

If your bootstrapped system is 32-bit system:

Architecture = i686

Or for a 64-bit system:

Architecture = x86_64

Before chrooting into the newly created system we need to set up some mount points. This is essential for the installation of a bootloader later on, c.f. Change Root.

# mount -t proc none /mnt/proc
# mount -t sysfs none /mnt/sys
# mount -o bind /dev /mnt/dev
# mount -o bind /dev/pts /mnt/dev/pts # important for pacman (for signature check)

Now everything is prepared to chroot into your newly installed Arch environment

# chroot /mnt bash

Before you can use pacman you have to initialize its keyring as explained below, in #Fix the Pacman Signature Keyring.

From here on proceed with Installation Guide#Install the base system, but remember, you are already working in your final system, thus no need for pacstrap, simply use pacman. So the next command you are most likely to execute will be

 # pacman -S base # and evtl. also base-devel

Method 3: Bootstrapping the arch installation scripts

Contrary to the other methods, this method is one-step only; you only have to execute the script below and thats it.

This method can be considered an hybrid between Method 1 and Method 2. It provides a chroot enviroment from where to execute the arch install scripts (similar to Method 1), by using a bootstrapping script (similar to Method 2).

The script below is going to create a directory called archinstall-pkg and download the required packages there. Then, is going to extract them into the archinstall-chroot directory. Finally, is going to prepare mount points, configure pacman and enter into a chroot.

Note: This is only an enviroment to execute the arch install scripts: this is not your final installation.

This chroot is able to execute the arch install scripts. The destination partitions should be mounted under the /mnt directory from this chroot. After that, continue with the next step, which is #Fix the Pacman Signature Keyring.

CHROOT_DIR=archinstall-chroot Must Change First, or you might ruin your /etc/

archinstall-bootstrap.sh
#!/bin/bash
# This script is inspired on the archbootstrap script.

PACKAGES=(acl attr bzip2 curl expat glibc gpgme libarchive libassuan libgpg-error libssh2 openssl pacman xz zlib pacman-mirrorlist coreutils bash grep gawk file tar ncurses readline libcap util-linux pcre arch-install-scripts)
# Change the mirror as necessary
MIRROR='http://mirrors.kernel.org/archlinux' 
# You can set the ARCH variable to i686 or x86_64
ARCH=`uname -m`
LIST=`mktemp`
CHROOT_DIR=archinstall-chroot
DIR=archinstall-pkg
mkdir -p "$DIR"
mkdir -p "$CHROOT_DIR"
# Create a list with urls for the arch packages
for REPO in core community extra; do  
        wget -q -O- "$MIRROR/$REPO/os/$ARCH/" |sed  -n "s|.*href=\"\\([^\"]*\\).*|$MIRROR\\/$REPO\\/os\\/$ARCH\\/\\1|p"|grep -v 'sig$'|uniq >> $LIST  
done
# Download and extract each package.
for PACKAGE in ${PACKAGES[*]}; do
        URL=`grep "$PACKAGE-[0-9]" $LIST|head -n1`
        FILE=`echo $URL|sed 's/.*\/\([^\/][^\/]*\)$/\1/'`
        wget "$URL" -c -O "$DIR/$FILE" 
        xz -dc "$DIR/$FILE" | tar x -k -C "$CHROOT_DIR"
done
# Create mount points
mkdir -p "$CHROOT_DIR/dev" "$CHROOT_DIR/proc" "$CHROOT_DIR/sys" "$CHROOT_DIR/mnt"
mount -t proc proc "$CHROOT_DIR/proc/"
mount -t sysfs sys "$CHROOT_DIR/sys/"
mount -o bind /dev "$CHROOT_DIR/dev/"
mkdir -p "$CHROOT_DIR/dev/pts"
mount -t devpts pts "$CHROOT_DIR/dev/pts/"

# Hash for empty password  Created by doing: openssl passwd -1 -salt ihlrowCo and entering an empty password (just press enter)
echo 'root:$1$ihlrowCo$sF0HjA9E8up9DYs258uDQ0:10063:0:99999:7:::' > "$CHROOT_DIR/etc/shadow"
echo "root:x:0:0:root:/root:/bin/bash" > "$CHROOT_DIR/etc/passwd" 
touch "$CHROOT_DIR/etc/group"
echo "myhost" > "$CHROOT_DIR/etc/hostname"
test -e "$CHROOT_DIR/etc/mtab" || echo "rootfs / rootfs rw 0 0" > "$CHROOT_DIR/etc/mtab"
[ -f "/etc/resolv.conf" ] && cp "/etc/resolv.conf" "$CHROOT_DIR/etc/"
sed -ni '/^[ \t]*CheckSpace/ !p' "$CHROOT_DIR/etc/pacman.conf"
sed -i "s/^[ \t]*SigLevel[ \t].*/SigLevel = Never/" "$CHROOT_DIR/etc/pacman.conf"
echo "Server = $MIRROR/\$repo/os/$ARCH" >> "$CHROOT_DIR/etc/pacman.d/mirrorlist"

chroot $CHROOT_DIR /usr/bin/pacman -Sy 
chroot $CHROOT_DIR /bin/bash

Method 4: Install pacman natively on non-arch distro (advanced)

Warning: This method is potentially difficult, your mileage may vary from distro to distro. If you just want to do an arch installation from another distro and you are not interested in have pacman as a regular program under such distro, is better to use a different method.

This method is about installing pacman and the arch install scripts directly under another distro, so they become regular programs on that distro.

This is really useful if you are planning to use another distro regularly to install arch linux, or do fancy things like updating packages of an arch installation using another distro. This is the only method that not imply creating a chroot to be able to execute pacman and the arch install scripts. (but since part of the installation includes entering inside a chroot, you'll end using a chroot anyway)

Download pacman source code and pacman packages

Visit the pacman homepage: https://www.archlinux.org/pacman/#_releases and download the latest release.

Now, download the following packages:

Install dependencies

Using your distribution mechanisms, install the required packages for pacman and the arch install scripts. libcurl, libarchive, fakeroot, xz, asciidoc, wget, and sed are among them. Of course, gcc, make and maybe some other "devel" packages are necessary too.

Compile pacman

  • Decompress the pacman source code and cd inside.
  • Execute configure, adapting the paths as necessary:
     ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --enable-doc

If you get errors here, chances are you are missing dependencies, or your current libcurl, libarchive or others, are too old. Install the dependencies missing using your distro options, or if they are too old, compile them from source.

  • Compile
    make
  • If there were no errors, install the files
    make install
  • You may need to manually call ldconfig to make your distro detect libalpm.

Prepare configuration files

Now is time to extract the configuration files. Change the x86_64 as necessary.

  • Extract the pacman.conf and makepkg.conf files from the pacman package, and disable signature checking:
    tar xJvf pacman-*-x86_64.pkg.tar.xz etc -C / ; sed -i 's/SigLevel.*/SigLevel = Never/g' /etc/pacman.conf
  • Extract the mirror list:
    tar xJvf pacman-mirrorlist-*-any.pkg.tar.xz -C /
  • Enable some mirrors on /etc/pacman.d/mirrorlist
  • Extract the arch-install-scripts
    tar xJvf arch-install-scripts-*-any.pkg.tar.xz -C /

Another option is using the alien tool to convert the pacman-mirrorlist and arch-install-scripts (but no pacman) to native packages of your distro.

Fix the Pacman Signature Keyring

It is necessary to initialize pacman's keyring for signature checking.

This is done using

# pacman-key --init # read the note below!
# pacman-key --populate archlinux

However, when connected via SSH you might run out of entropy. In this case you can try something like

# cat /usr/bin/* > /dev/null &
# find / > /dev/null &

before executing pacman-key --init.

It might take some time. If nevertheless all this does help install haveged and run prior to pacman-key --init

# /usr/sbin/haveged -w 1024 -v 1


Setup the target system

At this point, follow the normal steps of Installation Guide. Remember to mount the destination partition under the /mnt of the chroot.

# pacstrap /mnt base base-devel
# # ...

Edit the fstab file

Probably the genfstab script won't work. In that case, you'll need to edit the /mnt/etc/fstab file by hand. You can use the content of /etc/mtab as reference.

Finish the Installation

Now just do the rest of the steps normally.

Tips and tricks

  • In case you want to replace an existing system, but can for some reason not use a LiveCD, since, e.g., you have no physical access to the computer, the following tip might help: If you manage to get ~500MB of free space somewhere on the disk (e.g. by partitioning a swap partition) you can install the new Archlinux system there, reboot into the newly created system and rsync the entire system to the primary partition. Finally don't forget to fix the bootloader configuration before rebooting.

See also