Arch Linux and Docker logos

How to install Arch Linux for a home server

This is the second part of the self-hosting series. In the first part we covered what self-hosting is and what you need to start. Now the machine needs an operating system.

In this article, you will learn how to install Arch Linux on a home server, give it a static IP address and reach it over SSH from another computer.

TL;DR: Flash the ISO to a USB drive, run archinstall with Docker and OpenSSH as extra packages, set a static IP and check that you can log in over SSH.

Prepare the installation media

Skip to Boot the installer

Before touching the server, you need to flash the Arch ISO to a USB drive (2GB minimum).

Be careful: all data on the USB drive will be erased.

On Windows

Skip to On Linux

  1. Download the Arch Linux ISO from the official website.
  2. Download Rufus.
  3. Insert the USB drive.
  4. Open Rufus and select the Arch ISO.
  5. Click Start.
  6. When the “ISOHybrid image detected” prompt appears, select Write in DD Image mode.

Keep in mind: Rufus recommends ISO mode, but for Arch, DD mode is the standard to avoid boot failures.

On Linux

Skip to Boot the installer

  1. Download the Arch Linux ISO from the official website.
  2. Insert the USB drive.
  3. Find the device name:
lsblk -o NAME,SIZE,MODEL,MOUNTPOINTS

Look for the entry matching your drive’s size, for example sdb. We want the whole disk, not a partition on it.

  1. Unmount it, most desktops mount a USB drive automatically:
sudo umount /dev/sdb*
  1. Write the image:
sudo dd if=archlinux-x86_64.iso of=/dev/sdb bs=4M status=progress oflag=sync
  1. Wait for the command to return on its own. oflag=sync means the write is finished when the prompt comes back, so the drive is safe to pull.

Be careful: of= must be the whole disk (/dev/sdb), never a partition (/dev/sdb1), and dd does not ask for confirmation. Run lsblk once more and read the name back before you press enter, because a wrong value overwrites that disk instead.

You do not need to partition or format the drive first. The Arch ISO is a hybrid image, so dd writes a bootable layout straight to the raw device. That is the same thing DD mode does in Rufus.

Boot the installer

Skip to Run the guided installer

  1. Insert the USB drive into the server.
  2. Power on the server and enter the BIOS/UEFI settings.
  3. Select the USB drive as the boot device.
  4. Select Arch Linux install medium (x86_64, UEFI).
  5. Wait for the live environment. You will be greeted by the root@archiso prompt.

Connect to the network

Skip to Check the connection

If you use an Ethernet cable, you are already online and can skip this step. For Wi-Fi, use the iwctl utility:

iwctl
device list
station wlan0 scan
station wlan0 get-networks
station wlan0 connect <Your-SSID>
quit

device list shows the name of your wireless device, usually wlan0. <Your-SSID> is the name of your network.

Check the connection

Skip to Update the system clock

ping -c 3 google.com

You should see the following output:

64 bytes from XXX.XXX.XXX.XXX: icmp_seq=1 ttl=56 time=X ms
64 bytes from XXX.XXX.XXX.XXX: icmp_seq=2 ttl=56 time=X ms
64 bytes from XXX.XXX.XXX.XXX: icmp_seq=3 ttl=56 time=X ms

Three packets sent, three received and 0% packet loss means we are good to go.

Update the system clock

Skip to Run the guided installer

timedatectl set-ntp true

This enables the Network Time Protocol (NTP), which keeps the system clock synchronized with the internet.

To check if it worked:

timedatectl status

You should see the current date and NTP service: active.

Run the guided installer

Skip to Finish the setup inside chroot

There are two ways to install Arch:

  • Manual installation. Partitioning with gdisk, creating filesystems, mounting subvolumes and running pacstrap. It offers absolute control, but it is prone to human error.
  • Guided installation. Arch ships an official installer called archinstall. It automates the partitioning and the base configuration, and still allows a lot of customization.

We will use archinstall. It gives us a clean, reproducible foundation and gets us to the final configuration faster.

archinstall

Select as you like, but it’s preferable to use these answers. If a setting isn’t listed here, you can leave it at the default.

Setting Answer Is required to do same Comment
Archinstall language English Or your preferred language
Locales en_US.UTF-8
Mirrors: regions Closest region to you
Mirrors: optional repositories multilib 32-bit libraries, a “just in case” move for some Docker images
Disk configuration Best-effort default partition layout Pick the SSD if you have both an SSD and an HDD
Filesystem btrfs Default subvolume structure: Yes, then choose Use compression
Swap on zram Disabled
Bootloader grub ✔ The next part of the series edits its configuration
Kernels linux
Hostname personal-lab Up to you
Root password Your strong password ✔
User account Your user, with Superuser set to true ✔ This gives sudo permissions to the user
Profile Desktop with KDE Plasma and sddm I use it as a desktop from time to time. Otherwise choose Server
Graphics Intel (open-source) Choose based on your hardware
Bluetooth Up to you Select Yes if you want to use it
Audio pipewire
Network manager Use Network Manager (default backend) ✔ The static IP section below uses it
Additional packages See the table below ✔
Timezone Your timezone Or leave UTC
Automatic time sync (NTP) Yes

Additional packages

Skip to Install

The server needs openssh, docker and docker-compose. The others are optional.

Package Purpose
openssh SSH server for remote access
docker Container engine for the self-hosted services
docker-compose Tool for defining and running multi-container applications
git Version control
neovim Text editor for system configuration. nano works too if you prefer
btop Resource monitor for CPU, memory and network usage
ufw Uncomplicated Firewall
bash-completion Tab completion for the command line

Install

Skip to Finish the setup inside chroot

Select Install and wait. After a successful installation, you will see three options:

  1. Exit archinstall
  2. Reboot system
  3. chroot into installation for post-installation configurations

Select the third one, so we can enable the core services before the first boot.

Finish the setup inside chroot

Skip to First boot

First, enable the core services. This makes the server reachable and ready to work the moment you turn it on:

systemctl enable NetworkManager
systemctl enable sshd
systemctl enable docker

Then add your user to the docker group, so you can run Docker commands without sudo every time:

usermod -aG docker <username>

If you forgot the username, run ls /home.

Check the network interfaces:

ip link

You should see at least one interface marked UP. An interface marked DOWN is either not connected or not enabled.

Now it’s time to exit and reboot:

exit
reboot

Remove the USB drive when the machine restarts.

First boot

Skip to Set a static IP address

After the reboot, log in and open a terminal. On KDE it is called Konsole and the shortcut is Ctrl + Alt + T. Check that the network manager is running:

systemctl status NetworkManager

You should see active (running) in the output.

If you use Wi-Fi, connect to your network. With Ethernet you can skip this:

nmcli device wifi connect <SSID>

Now find the IP address the router gave you:

ip addr show

Look for the interface marked UP, the address is next to inet. In my case it was 192.168.1.6.

But there is a small issue. The router assigned this address dynamically via DHCP. If the router reboots or the lease expires, it might give that address to your phone and hand the server a new one. A server should always be found at the same address, so let’s fix that.

Set a static IP address

Skip to Check the services

First we need the connection name:

nmcli connection show

In the output table, look at the NAME column:

  • With Ethernet, it is usually Wired connection 1.
  • With Wi-Fi, it is the name of your network.

Pick an address outside the range your router hands out. I will use 192.168.1.22 as an example, and 192.168.1.1 is the router:

sudo nmcli con mod "<CONNECTION_NAME>" ipv4.addresses 192.168.1.22/24
sudo nmcli con mod "<CONNECTION_NAME>" ipv4.gateway 192.168.1.1
sudo nmcli con mod "<CONNECTION_NAME>" ipv4.dns "1.1.1.1,8.8.8.8"
sudo nmcli con mod "<CONNECTION_NAME>" ipv4.method manual

Then apply it:

sudo nmcli con up "<CONNECTION_NAME>"

Be careful: reserve this address in your router settings too. Otherwise the router can still give it to another device and you get an IP conflict.

Check the services

Skip to Connect over SSH

The goal is to run this server headless, so SSH and Docker have to start on every boot without us. We enabled them inside chroot, now let’s make sure it worked:

systemctl is-enabled sshd
systemctl is-enabled docker
systemctl is-enabled NetworkManager

You should see enabled three times. If one of them says disabled, enable and start it:

sudo systemctl enable --now <service_name>

Connect over SSH

Skip to Summary

Now let’s check that we can reach the server from another computer on the same network:

ssh <username>@192.168.1.22

Since it’s the first time you connect, you will see a message like this:

The authenticity of host '192.168.1.22' can't be established.
ED25519 key fingerprint is SHA256:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.
Are you sure you want to continue connecting (yes/no/[fingerprint])?

Type yes and press Enter, then enter your password. After a successful login, you will see the prompt [<username>@<hostname> ~]$. You are connected.

Summary

In this guide, we covered how to turn a bare-metal machine into a working Arch Linux server. We have:

  • Installed a clean system on Btrfs with archinstall.
  • Given the server a static IP address, so it is always found in the same place.
  • Enabled SSH for headless management and Docker for the services.

The server is now ready for headless operation. You can disconnect the monitor and the keyboard, all future management happens over SSH. In the next part we will make sure it stays up 24/7. For reference, you can check my project here.

Have fun!