Arch Linux ARM Operating System Installation¶
Prerequisites¶
Assumptions¶
- Have a compatible memory card that can be cleared of data
- Instructions done via the command line interface (CLI) (terminal/console)
- Steps prefixed with a "$" (dollar sign) represents the CLI prompt. The text after the "$" is to be entered at the CLI.
- Steps prefixed with a "#" (number sign) represents the CLI prompt with elevated user permissions (e.g. root). The text after the "#" is to be entered at the CLI.
Environment¶
- Using another working Linux/Unix system with cURL installed
- Installation is done for a Raspberry Pi device
Installation¶
- Using another Linux system, insert the SD Card.
- Ensure SD card is not mounted.
$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sde 8:64 0 14.9G 0 disk
- If a path is shown under "MOUNTPOINT" for the SD Card then unmount the each applicable partition.
# umount /dev/sdX
-
Partition SD card.
# fdisk /dev/sdX
-
Type "o".
This will clear out any partitions on the drive.
-
Type "p" to list partitions.
No partitions should be listed.
-
Type "n" for new partition.
- Type "p" for primary.
- Type "1" for the first partition on the drive.
- Press "ENTER" to accept the default first sector.
- Type "+200M" for the last sector.
- Type "t" to set first partition type.
- Type "c" to set partition type to W95 FAT32 (LBA).
- Type "n" for new partition.
- Type "p" for primary.
- Type "2" for the second partition on the drive.
- Press "ENTER" twice to accept the default first and last sector.
- Type "p" to verify partition setup.
Disk /dev/sde: 7.42 GiB, 7969177600 bytes, 15564800 sectors Disk model: USB SD Reader Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0x5881233b Device Boot Start End Sectors Size Id Type /dev/sde1 2048 411647 409600 200M c W95 FAT32 (LBA) /dev/sde2 411648 15564799 15153152 7.2G 83 Linux
- Type "w" to write the partition table and exit.
-
-
Format partitions.
# mkfs.fat -F32 /dev/sdX1 # mkfs.ext4 /dev/sdX2
- Change to home directory.
$ cd ~
- Create temporary directories.
$ mkdir boot root
- Mount partitions.
# mount /dev/sdX1 boot # mount /dev/sdX2 root
-
Download Arch Linux ARM.
Raspberry Pi 1 & 2
$ curl -JLO http://os.archlinuxarm.org/os/ArchLinuxARM-rpi-armv7-latest.tar.gz $ curl -JLO http://os.archlinuxarm.org/os/ArchLinuxARM-rpi-armv7-latest.tar.gz.md5
Raspberry Pi 3 & 4
$ curl -JLO http://os.archlinuxarm.org/os/ArchLinuxARM-rpi-aarch64-latest.tar.gz $ curl -JLO http://os.archlinuxarm.org/os/ArchLinuxARM-rpi-aarch64-latest.tar.gz.md5
-
Verify the download was successful.
Raspberry Pi 1 & 2
$ md5sum -c ArchLinuxARM-rpi-armv7-latest.tar.gz.md5 ArchLinuxARM-rpi-latest.tar.gz: OK
Raspberry Pi 3 & 4
$ md5sum -c ArchLinuxARM-rpi-aarch64-latest.tar.gz.md5 ArchLinuxARM-rpi-2-latest.tar.gz: OK
-
Extract downloaded archive to root of the SD Card.
Raspberru Pi 1 & 2
# bsdtar -xpf ArchLinuxARM-rpi-armv7-latest.tar.gz -C root # sync
Raspberry Pi 3 & 4
# bsdtar -xpf ArchLinuxARM-rpi-aarch64-latest.tar.gz -C root # sync
-x Extract to disk from archive. -p Perserve file permissions. -f Read the archive from the specified file.
Note
Depending on hardware used these commands can take sometime to complete (~10 minutes).
-
Move boot files from root partition to boot partition.
# mv root/boot/* boot/ # sync
Note
Depending on hardware used these commands can take sometime to complete.
-
Unmount SD card partitions.
# umount boot/ root/
- Remove temporary directories.
$ rmdir boot/ root/
- Insert the SD card into the Raspberry Pi.
- Connect cables to Raspberry Pi.
- Keyboard
- Video
- Ethernet
- Power supply
Post Installation¶
-
Login as the root user.
- Username: root
-
Password : root
Note
The default user account is alarm and password is alarm.
-
Initialize the pacman keyring and populate the Arch Linux ARM package signing keys.
$ pacman-key --init $ pacman-key --populate archlinuxarm
- Apply system updates and install the "sudo" package.
$ pacman -Syu sudo
- Setup sudo access.
- Set nano as the editor.
# export EDITOR=nano
- Create sudo group access rights.
# visudo -f /etc/sudoers.d/sudo
-f Specify an alternate sudoers file location.
%sudo ALL=(ALL) ALL
- Create the sudo group.
# groupadd -r sudo
-r Create a system group.
- Set nano as the editor.
-
Create user account and add to group.
# useradd -mG sudo,users <username>
Note
The sudo group is used for sudo command access (elevated privileges).
-
Set password for new user account.
# passwd <username>
- Logout.
$ exit
- Login with new user account.
- Lock passwords for default accounts.
# passwd -l root # passwd -l alarm
- Set Localization
- Uncomment desired locale(s).
# nano /etc/locale.gen
en_US.UTF-8
- Set locale variable.
# nano /etc/locale.conf
LANG=en_US.UTF-8
- Uncomment desired locale(s).
- Generate locale(s).
# locale-gen
- Set timezone.
# ln -sf /usr/share/zoneinfo/Region/City /etc/localtime
- Install NTP.
# pacman -Sy ntp
- Set time synchronization.
# timedatectl set-ntp true
- Start and enable NTP service.
# systemctl start ntpd.service # systemctl enable ntpd.service
- Set desired hostname.
# hostnamectl set-hostname <hostname-here>