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 elinux.org. 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 sourceforge.net, 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 ibeblog.com or the official Raspbian how-to.
The device will lease an IP address from a DHCP (if available), SSH is present and running, and the default password for “
root” is “
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.
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:
oto clear all partitions off the card.
pto check no partitions left.
1(the first partition),
ENTER(confirm the first sector), then type
+100Mfor the last sector.
c(the first partition) to type W95 FAT32 (LBA).
2(the second partition), and
ENTERtwice (accept the first and last sector).
w(write and exit).
- Create and mount the FAT:
mount /dev/sdX1 boot
- Create and mount the ext4:
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.
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 “
Setup the correct timezone:
rm /etc/localtime ln -s /usr/share/zoneinfo/CONTINENT/CITY /etc/localtime
Update the system:
sudo and add the respective user:
useradd -m -G wheel -s /bin/bash NEWUSER
Setup password for the new user:
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
yaourt, as root:
pacman -S base-devel yajl
cd /tmp wget https://aur.archlinux.org/packages/pa/package-query/package-query.tar.gz tar xfz package-query.tar.gz cd package-query makepkg -si cd .. wget https://aur.archlinux.org/packages/ya/yaourt/yaourt.tar.gz 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 188.8.131.52nnameserver 184.108.40.206" > /etc/resolv.conf
To upgrade RPi’s firmware, do as root:
pacman -S git wget https://raw.githubusercontent.com/Hexxeh/rpi-update/master/rpi-update -O /usr/bin/rpi-update && chmod +x /usr/bin/rpi-update rpi-update reboot
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 elinux.org.