A really opionionated guide how to setup a RPi with Arch Linux including WiringPi, ntp, wi-fi, ssh, ruby, zsh etc.
Take a look into the wiki for more interesing stuff like finding out your Raspberry Pi version.
I recommend you to get a speed class 10 SD Card with more then 4 GB capacity for optimal performance.
Additionally you should buy a small heatsink. Something like that.
There are 2 distributions of raspberry pi now. You may find the downloads on www.archlinuxarm.org for the latest version of archlinux on raspberry pi.
# For Raspberry Pi 2
wget http://archlinuxarm.org/os/ArchLinuxARM-rpi-2-latest.tar.gz
bsdtar -xpf ArchLinuxARM-rpi-2-latest.tar.gz -C root
sync
# For Raspberry Pi 1
wget http://archlinuxarm.org/os/ArchLinuxARM-rpi-latest.tar.gz
bsdtar -xpf ArchLinuxARM-rpi-latest.tar.gz -C root
sync
sudo dd bs=1M if=ArchLinuxARM-2014.01-rpi.img of=/dev/sdb
If your SD card is larger than 2 GB, you will want to resize the partitions to make use of your entire card.
The image creates two partitions, which will be available as /dev/mmcblk0p1 and /dev/mmcblk0p2 when you boot up your Raspberry Pi. The first partition (100 MB) is mounted to /boot, and the second (1.7 GB by default) is mounted to the root directory /. Leave the first partition as is, and expand the second to as large as you desire within the space available on your card.
I recommend using gparted.
You should have connected a keyboard via usb and some kind of screen via hdmi.
Of course just if you want to have a german keyboard layout. You may skip this step or use another layout.
loadkeys de
echo LANG=de_DE.UTF-8 > /etc/locale.conf
echo KEYMAP=de-latin1-nodeadkeys > /etc/vconsole.conf
rm /etc/localtime
ln -s /usr/share/zoneinfo/Europe/Berlin /etc/localtime
sed -i "s/en_US.UTF-8/#en_US.UTF-8/" /etc/locale.conf
export LANGUAGE=en_US.UTF-8
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
locale-gen en_US.UTF-8
fallocate -l 1024M /swapfile
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile
echo 'vm.swappiness=1' > /etc/sysctl.d/99-sysctl.conf
- Then add the following line to
/etc/fstab
:
/swapfile none swap defaults 0 0
timedatectl set-local-rtc 0
nano /etc/timezone
- Set to "Europe/Berlin"
sed -i 's/#Color/Color/' /etc/pacman # Add color to pacman
pacman -Sy pacman
pacman-key --init
pacman -S archlinux-keyring
pacman-key --populate archlinux
pacman -Syu --ignore filesystem
pacman -S filesystem --force
reboot
pacman -S ntp
systemctl enable ntpd.service
systemctl start ntpd.service
passwd
hostnamectl set-hostname your-hostname
pacman -S sudo vim
visudo
- Search for following line and uncomment it:
%wheel ALL=(ALL) ALL
- Then install adduser
pacman -S adduser
- Add a new user. The additional groups are
rvm
andwheel
adduser
- Log out and log in with our newly created user
sudo pacman -S --needed nfs-utils htop openssh autofs alsa-utils alsa-firmware alsa-lib alsa-plugins git zsh zsh-grml-config base-devel diffutils libnewt
- Install yaourt:
wget https://aur.archlinux.org/packages/pa/package-query/package-query.tar.gz
tar -xvzf package-query.tar.gz
cd package-query
makepkg -si
cd ..
wget https://aur.archlinux.org/packages/ya/yaourt/yaourt.tar.gz
tar -xvzf yaourt.tar.gz
cd yaourt
makepkg -si
vim /etc/profile
Change the line saying PATH=
:
# Set our default path
PATH="/usr/local/sbin:/usr/local/bin:/usr/bin:/opt/vc/sbin:/opt/vc/bin"
export PATH
sudo git clone git://git.drogon.net/wiringPi /opt/wiringpi
cd /opt/wiringpi
sudo ./build
gpio -v
gpio readall
- The last both command should give an
ok
or something similar. If not, something may be broken.
systemctl enable sshd
systemctl start sshd
- Try to connect from another machine, if it works, you can disconnect the screen and keyboard and work via ssh
Set the output device
amixer cset numid=3 1
You may want to overclock the Pi. And you won't even lose the guarantee for your pi, if you use the "offical" overclocking presets. The simplest way to overclock the pi is rasp-config
tool which ships with the offical allowed overclocking presets.
wget https://raw2.github.com/chattama/raspi-config-archlinux/archlinux/raspi-config
Get to the overclocking menu and choose the overclocking preset you want. I recommend the "high" preset. After changing the overclocking preset, reboot your raspberry pi.
wifi-menu -o
netctl start yourWlanSSID
netctl enable yourWlanSSID
\curl -sSL https://get.rvm.io | bash -s stable
useradd -G rvm benny
yaourt -S ruby
rvm reload
rvm install ruby
rvm list
rvm alias create default ruby-2.1.0 # Or something else depending on what rvm list says
gem install bundler
If you want to use ZSH
sudo usermod -s /usr/bin/zsh
Additionally you may want to clone and setup your personal dotfiles.
- Logout and login back again or just reboot the pi
Change in your fstab:
/dev/root / ext4 noatime,discard 0 0
Since our RAM is limited.
sudo systemctl stop tmp.mount
sudo systemctl disable tmp.mount