Monday, 24 February 2014

Setup Arch Linux on Raspberry Pi

After you finished the setup of Arch on your SD card, you can start configuring this Linux Distro to your needs. Here’s my config…
Note: In case you need to resize your root partition it’s best to do it before you do anything else, this way you avoid the risk to loose any data. You can find a tutorial to this here.

Configure Arch

Change Root Password
Update all packages
pacman -Syu 
Install some extra handy packages. These are all optional except for the sudo package. I use vim as my default editor, change it to nano if that’s your editor of choice.
pacman -S sudo screen vim git htop tmux

Setting up correct time

Install Network Time Protocol
pacman -S ntp 
Install the NTP service
systemctl enable ntpd.service 
Enable NTP
timedatectl set-ntp 1 
Check your time settings
timedatectl status
Check your time zone. If it is not correct, call the list of available time zones (<space> for next page, <b> for previous page, <q> to quit):
timedatectl list-timezones
Set your time zone
timedatectl set-timezone Europe/Brussels

Add a new user

It’s a best practice to create a new user instead of doing everything under root.
  • Add a new user (ex. pi)
    useradd -m -g users -s /bin/bash pi
  • Set the password for the new user
    passwd pi
  • Allow your new user to use sudo
    EDITOR=vim visudo
  • Search for root ALL=(ALL) ALL and add the following line just below:
    pi   ALL=(ALL) ALL

Configure your environment

Add Color to your Bash Prompt

  • Go to and copy the text located under /etc/bash.bashrc somewhere in the middle of the page. Then open your .bashrc in your editor:
    sudo vim ~/.bashrc
  • Paste the copied text in this file. At the bottom of the file add the following line to set your default editor:
    export EDITOR=vim
  • Save and quit.
  • Go back to your browser ( and copy the text under /etc/DIR_COLORS and create a new file:
    sudo vim /etc/DIR_COLORS
  • Paste the copied text in this file, save and quit.
  • Open /etc/pacman.conf
    sudo vim /etc/pacman.conf
  • Uncomment the #Color line.
  • Save and quit.

Change your hostname

sudo vim /etc/hostname
change alarmpi to [your_new_hostname]

Get yourself a nice Welcome Screen

  • Install Archey
    sudo pacman -S yaourt
    yaourt archey
  • Choose option 1
  • Launch Archey on startup
    sudo vim .bash_profile
  • Add 'command archey3' at the beginning of the file.
  • Save and quit.

Take a backup

On linux you can use something like this:
  • Locate your SD card:
    sudo fdisk -l
  • Backup the card:
    sudo dd bs=4M if=/dev/sdf | gzip > /home/macuser/image-arch-`date +%d%m%y`.gz
  • (Restore:)
    sudo gzip -dc /home/macuser/image.gz | sudo dd bs=4M of=/dev/sdf
In my next post I will cover the network config on Arch.