Linux: Raspberry Pi

I’ve got a Raspberry Pi B+ (RPi) lately, let’s have a look at it…

There are many ways how to install an operating system and many operating systems to choose based on the needs of the RPi’s administrator and/or user.


Raspbian is a free operating system based on Debian optimized for the Raspberry Pi hardware. Some useful installation hints can be found on I didn’t want to go the “X” way (graphical), so I went further.


Minibian is a minimal Raspbian-based Linux image for Raspberry Pi.


Download the latest image from, unpack the image (tar -xfz IMAGENAME.tar.gz) and copy the unpacked image onto the SD card (dd bs=4M if=~/IMAGENAME.img of=/dev/sdX, where X is the identifier of the connected SD card). Synchronize disks (sync), unplug the card, and let’s rock 🙂

For further reference, see or the official Raspbian how-to.

First Steps

The device will lease an IP address from a DHCP (if available), SSH is present and running, and the default password for “root” is “raspberry“.

The first steps can be summarized and expressed pretty straightforwardly, i.e.: “EXPAND YOUR SYSTEM PARTITION!” by running raspi-config, selecting the first option and restarting the system. After that, the “classical” apt-get update && apt-get upgrade seems meaningful in order to update and upgrade the system and prevent the obvious “not enough free disk space” message.

For further reference, see or


Another choice can be the Arch Linux ARM distribution, which presupposes people to have some familiarity with the linux system and comfort working from the command line.


Preparation of the SD card (creating one vfat and one ext4 partition) can be done by running fdisk /dev/sdX and by following:

  • Type o to clear all partitions off the card.
  • Type p to check no partitions left.
  • Type n, then p (primary), 1 (the first partition), ENTER (confirm the first sector), then type +100M for the last sector.
  • Type t, then c (the first partition) to type W95 FAT32 (LBA).
  • Type n, then p (primary), 2 (the second partition), and ENTER twice (accept the first and last sector).
  • Type w (write and exit).
  • Create and mount the FAT:
    mkfs.vfat /dev/sdX1
    mkdir boot
    mount /dev/sdX1 boot
  • Create and mount the ext4:
    mkfs.ext4 /dev/sdX2
    mkdir root
    mount /dev/sdX2 root
  • Download and extract the root filesystem (as root, not via sudo):
    bsdtar -xpf ArchLinuxARM-rpi-latest.tar.gz -C root
  • Move boot files to the first partition:
    mv root/boot/* boot
  • Unmount the two partitions:
    umount boot root
  • Unplug the card, and let’s rock 🙂

The complete information can be found in the official source.

First Steps

The device will lease an IP address from a DHCP (if available), SSH (or a serial line) is present and running, and the default password for “root” is “root“.

Setup the correct timezone:

rm /etc/localtime
ln -s /usr/share/zoneinfo/CONTINENT/CITY /etc/localtime

Update the system:

pacman -Syu

Install sudo and add the respective user:

useradd -m -G wheel -s /bin/bash NEWUSER

Setup password for the new user:

passwd NEWUSER

Install useful software:

pacman -S mc nano wget links elinks htop unzip unrar dnsutils whois nmap tcpdump

Install server software:

pacman -S apache mariadb php php-apache php-gd php-mcrypt php-geoip

Installing yaourt, as root:

pacman -S base-devel yajl

as user:

cd /tmp
tar xfz package-query.tar.gz
cd package-query
makepkg -si
cd ..
tar xfz yaourt.tar.gz
cd yaourt
makepkg -si


In order to remove the dhcp service and related stuff, use:

systemctl disable dhcpcd.service
systemctl disable systemd-networkd.service
systemctl disable systemd-resolved

To manually manage DNS translation:

rm -f /etc/resolv.conf
echo "nameserver" > /etc/resolv.conf

To upgrade RPi’s firmware, do as root:

pacman -S git
wget -O /usr/bin/rpi-update && chmod +x /usr/bin/rpi-update

For more info, how to setup static IP addresses, see Linux: VLAN Interface Setup Using Systemd.


Since this device is designed to save as much energy as possible (and it does), it has terrible performance for Apache/PHP/MySQL-based applications (and not only for them). The NGINX web server or other DB servers do not help at all (maybe a little), but to load a page (e.g. a wordpress page) takes several seconds (even more than 10 seconds) every time a page is requested. It is caused mostly by the SD card (no matter its speed). SSDs can be connected using USB/SATA adaptor which communicates via the same system bus though. Hence it does not improve the performance at all. But this relatively cheap device can be surely used for other applications…

Some useful hints can be found on

This entry was posted in Linux, Server and tagged , , , , , , , , . Bookmark the permalink.