Family Encyclopedia >> Electronics

How to Install Arch Linux on Raspberry Pi

The Raspberry Pi is a versatile credit card sized computer that can be used for a variety of electronics projects. The advantage of the Raspberry Pi is that you have the flexibility to install different operating systems and you are not limited to the Raspberry Pi operating system. This includes Arch Linux, which is revered for its simplicity. Fortunately, there is a version of Arch Linux designed to work with ARM processors. Let's see how to install Arch Linux on Raspberry Pi.

Conditions

Before you begin, you will need the following:

  • Raspberry Pie
  • Micro SD 8 GB (or more)
  • Arch Linux ARM (Scroll down to find Raspberry Pi image link.)
  • Stable internet connection
  • Computer system capable of reading the SD card. (We'll be using Linux for this tutorial.)

Prepare the SD card

First, you will need to make a list of storage devices connected to your machine in order to identify which one is your SD card. Do this with the following command:

sudo fdisk -l
How to Install Arch Linux on Raspberry Pi

You will need to erase all partitions that exist on the drive. To do this, type o and hit enter in your terminal.

How to Install Arch Linux on Raspberry Pi

Enter p in your terminal to check if there are any remaining partitions.

How to Install Arch Linux on Raspberry Pi

If there is no partition left, go ahead and create the boot partition by typing n , then p , followed by 1 in your terminal. p means primary and 1 represents the first partition of the drive. You will need to press the Enter button after this sequence to continue.

How to Install Arch Linux on Raspberry Pi How to Install Arch Linux on Raspberry Pi

When prompted on the last sector, type +100M and press Enter.

Enter t in command prompt followed by c to set the first partition as type “W95 FAT32 (LBA)”.

How to Install Arch Linux on Raspberry Pi

Type n , followed by p (for primary), then 2 in order to create the root partition.

How to Install Arch Linux on Raspberry Pi

Press Enter twice to accept the default settings for the first and last sectors.

How to Install Arch Linux on Raspberry Pi

Write the partition table and exit fdisk by entering w .

We need to mount FAT and ext4 filesystems. To list the partitions, type the following:

sudo fdisk -l

Your SD card will appear and you can see the partitions. In my case, the partitions are “/dev/sdb1” and “/dev/sdb2”.

How to Install Arch Linux on Raspberry Pi

Copy Arch Linux files to SD card

The boot and root partitions must be mounted next. Do this with the following series of commands. Remember to replace the partition names in these commands with your partition names.

sudo mkfs.vfat /dev/sdb1sudo mkdir bootsudo mount /dev/sdb1 bootsudo mkfs.ext4 /dev/sdb2sudo mkdir rootsudo mount /dev/sdb2 root
How to Install Arch Linux on Raspberry Pi

Now place the Arch Linux file you downloaded in your home folder and extract it to the root folder of your SD card with the following command:

sudo bsdtar -xpf ArchLinuxARM-rpi-2-latest.tar.gz -C rootsync

Boot files will need to be moved to your SD card boot partition with:

sudo mv root/boot/*boot

You can unmount both partitions with:

unmount boot root

Insert the SD card into your Raspberry Pi.

Initial configuration on Raspberry Pi

After inserting the SD card into your Raspberry Pi, launch it. You will need to connect to the Internet via an Ethernet cable or a Wi-Fi network. To connect via Wi-Fi, first log in with the default root account. The username for this account is “root” and the password is “root”. Now run the following command:

wifi-menu

A menu will load and you can select your Wi-Fi network and connect. Now finalize the installation process by initializing the pacman keyring and populating the Arch Linux ARM package signing keys with:

pacman-key --init
pacman-key --populate archlinuxarm

You can go ahead and update system packages with:

pacman-Syu

You need to change the default username. Do this with the following command:

usermod -l newusername oldusername

Also change the password with:

passwd newusername

You will be prompted to enter a new password and then confirm it. To change the name of the home folder to reflect the new username, run the following command:

usermod -d /home/newusername -m newusername

You also need to change the root account password. Do this with:

passwd

In order to give sudo privileges to your user account, you will need to run the following to install the sudo package:

pacman -S sudo

You will need to edit the configuration file for sudo. Do this with:

EDITOR=nano visudo

Add newusername ALL=(ALL) ALL below the line that reads root ALL=(ALL) ALL

Close and save the file, and you're ready to go.

Now that you've installed Arch Linux on the Raspberry Pi, you can do lots of things, including installing and playing Minecraft and turning it into a NAS or Plex server. The limit is your imagination.

ContentsRequirementsPrepare the SD cardCopy Arch Linux files to the SD cardInitial setup on Raspberry Pi