Installing Arch Linux on a ServerAstra cloud instance or dedicated server
This guide provides step-by-step instructions on how to install Arch Linux. This process is aimed at users with a basic understanding of Linux commands and network configurations.
Prerequisites
- Either a server or cloud instance with ServerAstra.
- Arch Linux ISO access
- Basic familiarity with Linux command line interface.
TIP: For BMC access please refer to Guide to Interpreting the YAML Configuration and Connecting to IPKVM and IPMI IPKVM guide
Step 1: Connecting the Arch Linux ISO
- Select the ISO for Arch Linux version either:
- from our repository and:
- attach it in the VPS configuration CDROM section
- attach it via provisioned BMC (IPMI, iDRAC, KVM over IP, etc)
- download from official Arch Linux website and:
- upload to our cloud panel (size must be less than 6GB) in the VPS configuration section with [+] button
- connect to BMC (IPMI, iDRAC, KVM over IP, etc) in the IPKVM console (either JAVA or HTML5 depending on server brand)
- from our repository and:
Step 2: Boot the Server
- Restart your server.
- Access your server’s boot menu and select the option to boot from the virtual CDROM containing the Arch ISO.
- If you are unable to boot to ISO seek help from our Support team to assist.
Step 3: Set Up the Internet Connection
- Ensure your server is connected to the internet. For Cloud Instance connections, Arch Linux should connect automatically via DHCP. If you need to configure it manually or set up a wireless connection, run the following commands in the root console of ISO booted Arch Linux:
ip link
Note the network interface name which is connected and up and running. Replace in the next command
%NETIF%
with that interface name and%IP%
and%GW
with designated IP address (including subnet) and gateway from YAML configuration sent to you by ServerAstra team upon deployment of dedicated serverip addr add %IP% dev %NETIF% ip route add default via %GW%
For example if your IP is 10.0.0.5/24, gateway is 10.0.0.1 and interface name is enp45s0 the resulting command will be:
ip addr add 10.0.0.5/24 dev enp45s0 ip route add default via 10.0.0.1
Step 4: Partition the Disk
-
Use the
lsblk
command to list all available disks and partitions. -
Partition the disk using
fdisk
(for MBR),cfdisk
,sfdisk
orparted
. For a simple setup, assuming disk name/dev/sda
:- A root partition (
/dev/sda1
) - Optionally, a swap partition (
/dev/sda2
)
Example using
fdisk
:fdisk /dev/sda > n # Create new partition > p # Primary partition > 1 # Partition number > # Default - start at beginning of disk > +20G # Partition size > n # Create another new partition > p # Primary partition > 2 # Partition number > # Default, starts immediately after preceding partition > +2G # Swap partition size > t # Change partition type > 2 # Select partition 2 > 82 # Linux swap / Solaris > w # Write changes and exit
- A root partition (
Step 5: Format the Partitions
mkfs.ext4 /dev/sda1 # Format the root partition
mkswap /dev/sda2 # Set up the swap partition
swapon /dev/sda2 # Enable the swap partition
Step 6: Mount the File System
mount /dev/sda1 /mnt
Step 7: Install Arch Linux
- Install the base system and essential packages:
pacstrap /mnt base linux linux-firmware nano openssh grub
- Generate an fstab file:
genfstab -U /mnt >> /mnt/etc/fstab
Step 8: Chroot into Your Installation
arch-chroot /mnt
Step 9: Configure the System
- Set the time zone:
ln -sf /usr/share/zoneinfo/Region/City /etc/localtime
hwclock --systohc
- Generate locales by uncommenting en_US.UTF-8 UTF-8 and other needed locales in /etc/locale.gen, then run:
locale-gen
- Create the locale.conf file, and set the LANG variable:
echo "LANG=en_US.UTF-8" > /etc/locale.conf
- Set the hostname:
echo "serverastra-customer" > /etc/hostname
- Setup networking, replace
%NETIF%
,%IP%
and%GW%
like mentioned in Step 3,%DNS%
is Nameserver from same YAML configuration:
systemctl enable systemd-networkd
cat << EOF > /etc/systemd/network/10-serverastra.network
[Match]
Name=%NETIF%
[Network]
Address=%IP%
Gateway=%GW%
DNS=%DNS%
EOF
Step 10: Install Bootloader
You can install a variety of bootloaders in Arch Linux. We will pick the most popular, GRUB. Installation:
pacman -S grub
grub-install --target=i386-pc /dev/sda
grub-mkconfig -o /boot/grub/grub.cfg
mkinitcpio -P
TIP: If you encounter pacman errors due to keys expiring - try repopulating keys and reinstalling keyring:
pacman-key --init pacman-key --populate pacman -Sy archlinux-keyring
Step 11: Set Root Password
passwd
Step 12: Reboot
- Exit from chroot:
exit
- Unmount all partitions:
umount -R /mnt
- Reboot the server:
reboot
Now, your server should boot into Arch Linux. Customize your setup by installing additional packages and configuring services as needed.