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 by a small heatsink. Something like that.
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 it is, and expand the second to as large as you desire within the space available on your card.
I recommend to use gparted.
You should have connected a keyboard via usb and some kind of screen via hdmi.
Of course just if you want to have german keyboard layout. You may skip that 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
nano /etc/locale.conf
- Uncomment
en_US.UTF-8
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
- 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"
vim /etc/pacman.conf
- Uncomment the line "Color"
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
nano /etc/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 new created user
sudo pacman -S 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. 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 loose 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 and my dotfiles ...
sudo usermod -s /usr/bin/zsh
cd ~
git clone https://github.com/phortx/dotfiles.git .dotfiles
cd .dotfiles
rake install
- Relog
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