Install Arch Linux via SSH
This article is intended to show users how to install Arch remotely via an SSH connection. Consider this approach when the host is located remotely or you wish to use the copy/paste ability of an SSH client to do the Arch install.
On the remote (target) machine
Boot the target machine into a live Arch environment via the Live CD/USB image: this will log the user in as root.
At this point, setup the network on the target machine as for example suggested in Installation guide#Connect to the internet.
Secondly, setup a root password which is needed for an SSH connection, since the default Arch password for root is empty:
Now check that
PermitRootLogin yes is present (and uncommented) in
/etc/ssh/sshd_config. This setting allows root login with password authentication on the SSH server.
Finally, start the openssh daemon with
sshd.service, which is included by default on the live CD.
On the local machine
On the local machine, connect to the target machine via SSH with the following command:
$ ssh firstname.lastname@example.org
From here one is presented with the live environment's welcome message and is able to administer the target machine as if sitting at the physical keyboard. At this point, if the intent is to simply install Arch from the live media, follow the guide at Installation guide. If the intent is to edit an existing Linux install that got broken, follow the Install from existing Linux wiki article.
Installation on a headless server
This section describes installation of Arch Linux on a headless server without a keyboard, mouse or display. It involves three steps:
Create a modified Arch Linux live image using Archiso. The modification is designed to do two (or optionally three) things:
- Run the SSH daemon at boot time.
- Create an
/root/.ssh/authorized_keysfile for root containing your public key.
- If a Wi-FI connection is required, automatically connect to it at boot time using iwd.
To create a custom installation ISO, setup Archiso and follow the instructions in Archiso#Prepare an ISO for an installation via SSH. If the headless machine requires a Wi-Fi connection, additionally configure iwd as described in Archiso#Automatically connect to a Wi-Fi network using iwd. When all customization is done, build the ISO.
Deploy the ISO to the headless machine using a USB flash installation medium, optical disc, PXE or any other available means. Power up the headless machine and boot into a live Arch environment from the installation medium.
Wait for a minute or so to allow the headless machine time to boot up and connect to the network. From your existing machine (with keyboard and display) SSH into the live Arch environment on the headless server and complete the installation as described in the Installation guide.
- It is recommended to use a terminal multiplexer in the live environment, so that if you are disconnected you can reattach to your session. The live environment should have GNU Screen already installed.
- To belabor the obvious, all the Wi-Fi and SSH configuration that was carried out in the boot image needs to be done again in the actual Arch Linux installation to allow WiFi SSH access to the headless machine after installation.