# Getting Started

Quick and easy(tm)

# Preparations

<p class="callout info"><strong>INFO:</strong> This is a shortened version of the <a href="https://wiki.archlinux.org/index.php/Installation_guide">Arch Wiki installation guide</a>.</p>

Download an ISO from the [Arch Linux download](https://archlinux.org/download/) page, either via Torrent or HTTP from a [mirror nearest](https://archlinux.org/download/#download-mirrors) to you.

## Preparing install media

After you downloaded the image you need to flash it to physical media to boot your machine from it, i.e. a USB flash drive.

<p class="callout danger"><strong>WARNING:</strong> All data on the USB flash drive will be lost!</p>

### Windows

On Windows you can use Balena etcher to flash ISOs to USB. Connect your USB to your computer, load the ISO you just downloaded in etcher, select the USB as target and start the flashing process. A pop-up might appear asking you to confirm to overwrite the USB flash drive.

### macOS

Connect your USB flash drive to your Mac. Launch `Terminal.app` and determine the path of the USB flash drive:

~~~bash
diskutil list
~~~

This will list all drives connected to your Mac:

~~~
/dev/disk0 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *1.0 TB     disk0
   1:                        EFI EFI                     314.6 MB   disk0s1
   2:                 Apple_APFS Container disk1         1.0 TB     disk0s2

/dev/disk1 (synthesized):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      APFS Container Scheme -                      +1.0 TB     disk1
                                 Physical Store disk0s2
   1:                APFS Volume Macintosh HD - Daten    697.5 GB   disk1s1
   2:                APFS Volume Preboot                 1.8 GB     disk1s2
   3:                APFS Volume Recovery                1.1 GB     disk1s3
   4:                APFS Volume VM                      5.4 GB     disk1s4
   5:                APFS Volume Macintosh HD            8.8 GB     disk1s5
   6:              APFS Snapshot com.apple.os.update-... 8.8 GB     disk1s5s1

/dev/disk2 (external, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     FDisk_partition_scheme                        *15.4 GB    disk2
   1:                       0xEF                         10.4 MB    disk2s2
~~~

Look for the device with the line `external`. In this example it's `/dev/disk2 (external, physical)` with a capacity of ~16 GB.

macOS might auto-mount the drive when you connect it. Make sure to unmount it before flashing:

~~~bash
diskutil unmountDisk /dev/disk2
~~~

Use `dd` to flash the ISO image directly to your USB flash drive (adjust according to the output of `diskutil list`):

<p class="callout info"><strong>HINT:</strong> Note the 'r' before 'disk', which uses the raw device, which makes the transfer much faster.</p>

<p class="callout warning"><strong>ATTENTION:</strong> This command will run silently.</p>

<p class="callout danger"><strong>WARNING:</strong> This will delete all data on the device. Make sure to supply the correct target or severe data loss may occur!</p>

~~~bash
sudo dd if=path/to/archlinux.iso of=/dev/rdisk2 bs=1m 
~~~

After flashing is done, macOS might complain it can't read the drive. This is expected, the drive will still be bootable.

### Linux

Connect your USB flash drive to your computer.

#### GNOME Disk Utility

If you're on GNOME you can open the ISO image by right-clicking it and opening it with GNOME Disk Utility. Then select the inserted USB flash drive as target and click *Restore.*

#### Command line

Determine your USB flash drive's device path with `lsblk`:

~~~
NAME   FSTYPE   LABEL       UUID                                 MOUNTPOINT
sda
├─sda1 vfat                 C4DA-2C4D                            /boot
├─sda2 swap                 5b1564b2-2e2c-452c-bcfa-d1f572ae99f2 [SWAP]
└─sda3 ext4                 56adc99b-a61e-46af-aab7-a6d07e504652 /
sdb
└─sdb1 vfat     USB         2C4D-C4DA                            /run/user/1000/usb
~~~

Flash the ISO image to the USB flash drive with `dd`:

~~~bash
sudo dd if=path/to/archlinux.iso of=/dev/sdb bs=4M conv=fsync oflag=direct status=progress
~~~

# Booting the installation medium

<p class="callout warning"><strong>ATTENTION:</strong> The Arch Linux installation medium does <strong>not</strong> support Secure Boot. You will have to disable it to start the installation.</p>

Point your system's current boot device to the USB flash drive plugged into one of the USB ports on your computer. This usually involves pressing a key during POST; F8, F12, TAB, etc. Refer to on screen instructions after turning on your computer or its manual for the exact key to press.

Once the GRUB boot manager comes up select the Arch installer medium option to be presented with the installation environment. You'll be logged in as `root` at a Zsh prompt.

## Setting the correct keyboard layout

The default keyboard layout is US. To list all available keyboard layouts:

<p class="callout info"><strong>NOTE:</strong> You can filter the output by "piping" it to <code>grep</code>, i.e. <code>localectl list-keymaps | grep <em>your search string</em></code>.</p>

~~~bash
localectl list-keymaps
~~~

To change the keyboard layout pass its name to `loadkeys`. For example to set a German keyboard layout:

~~~bash
loadkeys de-latin1
~~~

## Verify boot mode

To verify the current boot mode, check the bitness of the UEFI in sysfs:

~~~bash
cat /sys/firmware/efi/fw_platform_size
~~~

Ideally, this should return `64`, indicating UEFI 64-bit mode. If it returns `32` the system was booted in UEFI 32-bit mode; while this shouldn't be an issue, it limits the choice of compatible boot loaders later on. However, if the file does not exist, this indicates the system was **not** booted in UEFI mode, but in BIOS or CSM mode (**C**ompatibility **S**upport **M**odule, UEFI emulating an old BIOS).

The preferred mode of operation is 64-bit UEFI. Consult your PC's or mainboard's manual on how to disable CSM if BIOS compatibility is not a requirement.

<p class="callout info"> <strong>NOTE:</strong> UEFI has seen mainstream adoption since the introduction of Windows 8 in 2012 and is a base requirement for certification from Microsoft, so PCs sold after that date are sure to support 64-bit UEFI.</p>

## Establish a network connection

To verify network devices are actually available list them with `ip`:

~~~bash
ip link
~~~

It should produce a list of network interfaces with IDs like `enp39s0`, `eth0`, `wlan0`, etc.

### Ethernet

To connect to a network simply connect the LAN cable for a wired network connection.

### Wi-Fi

<p class="callout info"><strong>NOTE:</strong> <code>wlan0</code> is used as the example device in this section. If your device is named differently, adjust accordingly.</p>

For Wi-Fi connections use `iwctl`.
| Command                                           | Description                                                          |
|---------------------------------------------------|----------------------------------------------------------------------|
| `iwctl device list`                               | List available Wi-Fi devices                                         |
| `iwctl station wlan0 scan`                        | Use device `wlan0` to scan for nearby Wi-Fi networks                 |
| `iwctl station wlan0 get-networks`                | Use device `wlan0` to list available Wi-Fi networks                  |
| `iwctl station wlan0 connect HomeWiFiNetworkName` | Use device `wlan0` to connect to Wi-Fi network `HomeWiFiNetworkName` |

### Mobile broadband

See [Arch Wiki](https://wiki.archlinux.org/title/Mobile_broadband_modem#ModemManager) for how to set up `ModemManager`.

## Testing connection

To verify you're online `ping` a server on the internet of your choice, e.g.:

~~~bash
ping archlinux.org
~~~

## Update the system clock

On current Arch ISO live environments, time synchronization with NTP and the system clock should already be enabled. To verify this is the case, call `timedatectl` without any paramenters. 

~~~
               Local time: Sun 2025-01-19 15:51:04 UTC
           Universal time: Sun 2025-01-19 15:51:04 UTC
                 RTC time: Sun 2025-01-19 15:51:04
                Time zone: UTC (UTC, +0000)
System clock synchronized: yes
              NTP service: active
          RTC in local TZ: no
~~~

If it says `NTP service: active`, you're good. Otherwise, enable the NTP service with:

~~~bash
timedatectl set-ntp true
~~~

By default, the time zone is set to UTC. You should change that to the region you reside in for correct timestamps. Set the appropriate time zone (autocomplete with `Tab` key), e.g. for Germany:

~~~bash
timedatectl set-timezone Europe/Berlin
~~~

Your system's local time offset should now be set. Check again with `timedatectl`:

~~~
               Local time: Sun 2025-01-19 16:54:57 CET
           Universal time: Sun 2025-01-19 15:54:57 UTC
                 RTC time: Sun 2025-01-19 15:54:56
                Time zone: Europe/Berlin (CET, +0100)
System clock synchronized: yes
              NTP service: active
          RTC in local TZ: no
~~~

# Extra: Installing via SSH

<p class="callout danger"><strong>WARNING:</strong> Only do this in a trustworthy network environment, e.g. at home, to prevent the possibility of tampering from outside sources! The system will not notify you if someone else logs into the installation environment alongside yourself!</p>

If you want to install Arch Linux via SSH set a password for the `root` user of the installation environment with `passwd`. This doesn't have to be a sophisticated password, as it will only be valid for the runtime of the installation environment and won't carry over to the installed system.

Installing via SSH will allow you to use your already installed system's terminal to copy-paste commands quickly.

<p class="callout info"><strong>NOTE:</strong> Native OpenSSH clients are available on Linux, macOS and Windows (starting with Windows 10 1809).</p>

After you've set a password connect to the installation environment:

~~~bash
ssh -o PreferredAuthentications=password root@archiso
~~~