The installation of an Arch Linux VPS is started directly from the installation medium (an ISO file). Arch Linux is not delivered ready-to-use but gives you freedom on what is installed during the installation process. Before you begin the actual installation, we recommend reading through the FAQ of Arch Linux.
In this article, we will show you how to perform the manual installation of Arch Linux. We use LVM partitioning for the installation.
Step 1
When your VPS is delivered, you automatically enter the live version of Arch Linux, which is recognizable by:
root@archiso~#
By default, your keyboard is set to US international. Available layouts can be found with:
ls /usr/share/kbd/keymaps/**/*.map.gz
The language on which your keyboard is set can be adjusted with the loadkeys command, for example:
loadkeys de-latin1
Step 2
Your network connection is enabled, but the DHCP client is not yet available, so you do not get very far yet and, for example, you cannot ping yet. First enable dhcpcd with the command:
dhcpcd
Now test your connection using a ping command:
ping -c 4 google.com
Step 3
Check if your clock is set correctly with the command:
timedatectl
Is, for example, the local time an hour early? Then adjust your time zone (for example to Amsterdam):
timedatectl set-timezone "Europe/Amsterdam"
It is not advisable to adjust the Universal / RTC time, as this would lead to problems because of summertime for example.
Step 4
We recommend using LVM for partitioning your disk. Other options are beyond the scope of this manual.
Check your available disks using the command:
fdisk -l
You will most likely see two: /dev/vda and /dev/loop0. We use the primary disk, in this case /dev/vda (you recognize your primary disk by the size displayed immediately behind it).
In this manual, replace /dev/vda with the actual primary disk if it differs from this example.
Now you create the Linux LVM partition using your entire disk, by successively using the following commands (in brackets there's an explanation):
fdisk /dev/vda
n (new partition)
p (makes the new partition the primairy partition)
1 (the partition number)
<enter> (accepts the default settings)
accepts the default settings
Step 5
Then you create an LVM physical volume on the new partition and create a volume group for it:
pvcreate /dev/vda1
vgcreate vg1 /dev/vda1
Step 6
Now create the boot, root, swap, and home logical volumes. You are free to adjust the allocated space, but for boot, we recommend using 200M.
lvcreate -L 200M -n boot vg1
lvcreate -L 20G -n root vg1
lvcreate -L 4g -n swap vg1
lvcreate -l 100%FREE -n home vg1
Step 7
Then format the newly created logical volumes:
mkfs.ext4 /dev/vg1/boot
mkfs.ext4 /dev/vg1/root
Step 8
Finally, you mount your logical volumes:
mount /dev/vg1/root /mnt
mkdir /mnt/boot
mount /dev/vg1/boot /mnt/boot
mkdir /mnt/home
mount /dev/vg1/home /mnt/home
Step 9
The partitioning is now completed. The changes that you have made above must, however, end up in /etc/fstab, but before you can generate the fstab file you first need the base packages (which contain bash, openssl, grep, keyutils, systemd, etc.) ). You install it with the command:
pacstrap /mnt base
Step 10
Then generate the fstab file:
genfstab -U /mnt >> /mnt/etc/fstab
Check the contents of /mnt/etc/fstab just to be sure and correct them if there are errors:
nano /mnt/etc/fstab
Change the root directory for the current processes (and child processes):
arch-chroot /mnt /bin/bash
Step 12
Open/create the file /etc/locale.gen with vi or nano:
nano /etc/locale.gen
Look for the line #en_US.UTF-8 UTF-8 (or another layout if you want) and remove / uncomment the # so that the line looks like:
en_US.UTF-8 UTF-8
Save your changes and close the file (ctl + x> y> enter).
Step 13
Then generate the localization:
locale-gen
Step 14
Create the file /etc/locale.conf with vi or nano:
nano /etc/locale.conf
You now create the LANG variable in this file by adding the following code (replace en_US.UTF-8 with your chosen localization):
LANG=en_US.UTF-8
Save your changes and close the file (ctl + x> y> enter).
If you have set the keyboard layout, add the value KEYMAP=de-latin1 (replace de-latin1 with your chosen layout) in the file /etc/vconsole.conf
Step 15
Create the file /etc/hostname with vi or nano:
nano /etc/hostname
Add your hostname, for example with the syntax:
server.example.com
Save your changes and close the file (ctl + x> y> enter).
Step 16
Create the file /etc/hosts with vi or nano:
nano /etc/hosts
Add the following data, replacing server.example.com with your chosen hostname.
127.0.0.1 localhost
::1 localhost
127.0.1.1 server.example.com.localdomain server.example.com
Save your changes and close the file (ctl + x> y> enter).
Step 17
Then add an LVM2hook to initramfs. First, open the mkinitcpio.conf file:
nano /etc/mkinitcpio.conf
Adjust the line HOOKS= by placing lvm2 in front of filesystems. The result can then look like this:
HOOKS=(base udev autodetect modconf block lvm2 filesystems keyboard fsck)
Save your changes and close the file (ctl + x> y> enter). Next, install lvm2 and the base-devel packages in order to be able to use mkinitcpio to regenerate the initramfs image:
mkinitcpio -p linux
Step 18
We are almost there! Now adjust your root password:
passwd
Step 19
Finally, configure the bootloader. We use GRUB for this. First, you install GRUB:
pacman -S grub
Install the boot loader to the disk on which you installed Arch with the command below. In this manual, this is /dev/vda.
You will see many lines when using the two commands below, such as 'Failed to connect to lvmetad. Falling back to device scanning' and 'Device /dev/loop0 not initialized in udev database even after waiting 10000000 microseconds'. These notifications are the result of /run not being available in chroot (see step 11) and you can safely ignore them. The whole process will take quite a while (at least fifteen minutes per command is not unusual).
grub-install /dev/vda
Finally, you generate the configuration file (this also takes a while):
grub-mkconfig -o /boot/grub/grub.cfg
Step 20
Your installation is now complete! To exit the chroot environment, unmount your partitions and reboot as follows:
exit
umount -R /mnt
reboot
You can now immediately start with the further configuration of Arch Linux and installing any additional packages you'd like.
Should you have any questions left regarding this article, do not hesitate to contact our support department. You can reach them via the ‘Contact Us’ button at the bottom of this page.