Arch Linux is a very clean and lightweight Linux distribution. With the following steps you can install it on a SD-Card to run it on a Raspberry Pi:
- Get the device name (dev-path) of the SD-Card to run the operating system (see Get a list of partitions or List, partitioning and format drives)
$> sudo fdisk -l
You should see some partitions named /dev/mmcblk0pX. X is a Number. Then the device to format is mmcblk0.
- Format the SD-Card:
- Unmount all partitions currently mounted
$> sudo umount /dev/mmcblk0p1 $> sudo umount /dev/mmcblk0p2
- $> sudo fdisk /dev/mmcblk0 # run fdisk to create partitions
- That opens a commandline tool that accepts further commands to manage the device partitions.
Here is the command order, that creates two partitions on the device (boot- and root-partition) :- p -> shows all existing partitions
- o -> deletes all existing partition on the SD-Card (you can check it with p afterwards)
- n -> to create a new partition:
- p -> to create a primary partition
- 1 -> to set the partition number to 1
- press enter to confirm the default value for the first sector
- enter +100M for the second prompt. Its the last sector value. So the first partition will be 100M in size.
- set the type of the partition to W95 FAT32 (LBA) with t followed by c (To get a List of all supporter partition types you can use the l command.)
- n -> to create a second partition
- p -> to create a primary partition again
- 2 -> to set the partition number to 2
- two times enter to accept the default values for first and last sector -> the second partition will use all the remaining space on the drive.
- we don’t set a type -> so the default type is 83 (Linux)
- w -> will write the newly created partition information to the partition table of the device
- Unmount all partitions currently mounted
- Format partitions and mount them to local folders:
- change to media directory of your user:
$> cd /media/YOURUSERNAME
That isn’t really necessary but I prefer to have mounted folders all together there. (on Ubuntu)
- create mountpoints:
$> sudo mkdir root $> sudo mkdir boot
- format partitions:
$> sudo mkfs.vfat /dev/mmcblk0p1 # make partition 1 (boot) a FAT32 filesystem $> sudo mkfs.ext4 /dev/mmcblk0p2 # make partition 2 (root) a ext4 filesystem
- mount the partitions to previously created mountpoints
$> sudo mount /dev/mmcblk0p1 boot $> sudo mount /dev/mmcblk0p2 root
- change to media directory of your user:
- Download Arch Linux and extract contents for root and boot filesystems:
- switch to root account (IMPORTANT!!! sudo is not enough):
$> sudo su -
- Go to media mount folder again:
$> cd /media/YOURUSERNAME
- Download Arch Linux archive:
$> wget http://archlinuxarm.org/os/ArchLinuxARM-rpi-latest.tar.gz # Raspberry Pi v. 1 $> wget http://archlinuxarm.org/os/ArchLinuxARM-rpi-2-latest.tar.gz # Raspberry Pi v. 2
- Extract contents to root partition:
$> tar xvfz ArchLinuxARM-rpi-latest.tar.gz -C root
- Copy boot filesystem to boot partition:
$> mv root/boot/* boot
- switch to root account (IMPORTANT!!! sudo is not enough):
- Unmout partitions:
$> umount /dev/mmcblk0p1 $> umount /dev/mmcblk0p2
- Now you could remove the SD-Card and put it into your Raspberry Pi. That’s it! You’ll have a lot of fun with Arch! The default credentials are root for the user and root as password.