Installing Arch Linux on the Raspberry Pi

Choosing the image

There are many use cases for the Pi and therefore you will find a lot of images, that will try to match your needs. Since I just want to run some server applications on the Pi, that need no GUI at all, I will go for the Arch Linux image. There are surely enough other images that will fit the needs as well or even better, feel free to try them out, the installation steps should be the same.
You can find the Arch and many other images on the download site at raspberrypi.org

Download the image and prepare the SD card

Depending on your operating system, there are different ways to set up the SD card, so it will boot your Linux distribution of choice.
I will try to cover both Linux and OSX by sticking to the command line, since they have many commands in common.(differences will be marked)

First download and extract the image:

1
2
3
4
5
curl -o arch_arm.img.zip -L http://downloads.raspberrypi.org/arch_latest
# if your system is missing curl, install it via your systems package manager
# some examples
# on ubuntu: apt-get install curl
# on mac with brew: brew install curl

After downloading is finished, check the integrity of the image. This can save you a lot of pain!
A corrupted download will make you to have to repeat the whole setup again.
Generate the checksum of your download and compare it to the checksum on the downloads page.

1
2
3
# generating the checksum of the downloaded file
shasum arch_arm.img.zip
# the command could be named sha1sum for some folks

If the checksums are matching, lets extract the zip file.

1
unzip arch_arm.img.zip

Note that the extracted file will be named something like ArchLinuxArm-some-release-date-rpi.img.

Put in the SD card format it with your tool of choice to FAT32 and remove it.

Then do

1
df -h

Now insert the SD card.
Again run

1
df -h


The additional device listed is your SD card.
In my case it’s /dev/disk2, this will differ from machine to machine. So if I use /dev/disk2 in some following commmands just see it as a placeholder for your device name.

The next step will differ a little whether you are using an OSX or a Linux OS.
The SD card needs to be unmounted now.

1
2
# only for mac users
sudo diskutil unmountDisk /dev/disk2

On Linux it should look something like this:

1
2
# only do this when you are on a linux machine
umount /dev/disk2

Flashing the image

Alright, now it’s time to flash the image to the disk.
This step will again slightly differ from OSX to Linux.

1
2
3
# on a mac machine the m for bs=1m is written in lower case.
# using rdisk2 over disk2 will give you a nice speed boost in many cases but it's mac only
sudo dd bs=1m if=ArchLinuxARM-2014.01-rpi.img of=/dev/rdisk2
1
2
# on linux machines the M is written in upper case an the bs is set to 4
dd bs=4M if=/path/to/your/image.img of=/dev/disk2

Ok, since the image is not that big, flashing will be quite fast.
As the final step eject the SD card.

1
2
# mac
sudo diskutil eject /dev/rdisk2

On Linux, clear the write cache, to safely remove the card.

1
2
# linux
sudo sync

Now the moment of truth has come. Pull your SD card out of your computer an put it in your Pi!
Notice: put the SD card in before plugging in the power supply.

Login will be root, root. Change this immediately:

1
2
# after logging in to the Pi run
passwd

Now the Pi should be up and running, awesome!

Keep your data at home

While services like Dropbox or Box.com are great for collaborative work and stuff, I always feel kind of afraid putting more personal data in there.
But I want to satisfy my desire to keep important files and media with me, while keeping them in sync with my devices.
I want to have my own dropbox, serving my files from home.

So I started with buying a Raspberry Pi(Model B) and throwing Owncloud on it.
While installation and setup worked quite fluently, the performance was a desaster. A simple request to the webinterface of Owncloud on my Pi took about 20 seconds, which brings me to the conclusion, that Owncloud will be no fit for the Pi and it’s capabilities.

Fortunately there is a alternative to Owncloud which looks promising plus it’s open source and free for personal use.
It has a free app for Android as well, therefore I will give it a shot.

My next blog posts will be about setting up useful server applications on the Pi such as

  • Seafile - private Owncloud-like file sync
  • Mumble - encrypted, low-latency voice chat
  • maybe Jabber - XMPP

I will also cover and start with:

Disclaimer: I have no clue if the PI can handle the stuff I am going to install =)

Installing OpenWrt on WD MyNet N600

In order to access the PI from outside my local network I need to keep track of my home’s IP address. Since I have no static IP at home I’ll have to deal with DDNS.

I researched some dynamic DNS providers and was surprised to find, that only a few free solutions were left.
In the past I was very happy with dnydns.org, but they stopped their free plans.
Fortunately there is no-ip.org, which is keeping up with free plans for single users.

Sadly, the stock firmware which ships with my N600 only supports tzo and dyndns.org as providers for dynDNS which are not quite the same company I guess.
So no satisfying solution here.
Which forces me install some cool stuff on my router: OpenWrt

According to their website, installation should be straight forward:

1
2
3
4
5
6
7
1) Download the file openwrt-ar71xx-generic-mynet-n600-squashfs-sysupgrade.bin
2) Configure your computers IP address to 192.168.1.10 and connect to a LAN port in the router.
3) Turn the router off.
4) Using a paperclip, press and hold the reset button on the bottom of the router and turn it on. Hold the reset button for at least 15 seconds.
5) On your computer, visit http://192.168.1.1 NOTE: You will not be able to ping this address.
6) Upload the file openwrt-ar71xx-generic-mynet-n600-squashfs-sysupgrade.bin as downloaded earlier.
7) The router will now flash OpenWRT. This will take a couple of minutes to achieve. You can ping 192.168.1.1 and watch for ping replies to see when your router has rebooted into OpenWRT

Alright step 1 is easy. Step 2 can be tricky if you are using some linux-ish OS.
I did it on Mint with editing /etc/network/interfaces and adding following lines:

1
2
3
4
5
# /etc/network/interfaces
iface eth0 inet static
address 192.168.1.10
netmask 255.255.255.0
gateway 192.168.1.1

Did a

1
sudo /etc/init.d/networking restart

after saving the file.

This enables me to connect my machine and the router directly via LAN.
Step 3 to 7 worked flawlessly.
After flashing OpenWrt ist done, you can telnet on the router.

1
telnet 192.168.1.1

Not lets install a web interface called LuCI.
Fortunately there are great step-by-step instructions already there!

1
2
3
4
5
6
7
opkg update
opkg install luci
opkg install luci-ssl
# Start the web server (uHTTPd)
/etc/init.d/uhttpd start
# Enable the web server (uHTTPd)
/etc/init.d/uhttpd enable

It just works, great.

Now we need DDNS support, since it is not avaiable out-of-the-box by luci.

1
2
opkg install luci-app-ddns
opkg install ddns-scripts

The DDNS service was disabled by default, so I turned it on via System -> Startup

Now after refreshing the page there should be a new tab called “Services” at the web interface’s navigation.
You can choose a ton of providers here. As mentioned, I will go ahead with no-ip.org.

After setting up the PI we will need these prerequisites to use our applications from outside our local network, e.g. with the smartphone.

But this should be it for now.

Please do not forget to set up a root password and all the other stuff like ssh and the wifi(if needed).