Skip to content

A really opionionated guide how to setup a RPi with Arch Linux including WiringPi, ntp, wi-fi, ssh, ruby, zsh etc.

Notifications You must be signed in to change notification settings

mezklador/Raspberry-Pi-Setup-Guide

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 

Repository files navigation

Raspberry Pi Setup Guide

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.

Some words regarding the hardware

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.

1. Setup the SD card

1.1. Download the image from the website

1.2. Write the image via dd on the SDCard

sudo dd bs=1M if=ArchLinuxARM-2014.01-rpi.img of=/dev/sdb

1.3. Resize of the Partition via gparted

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.

1.4. Put the SD Card into your pi, power it on and login with root/root

You should have connected a keyboard via usb and some kind of screen via hdmi.

2. Basic system setup

2.1. German keyboard layout and timezone

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

2.2. Setup swapfile

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

2.3. Set hardware clock to utc and set timezone

timedatectl set-local-rtc 0

nano /etc/timezone
  • Set to "Europe/Berlin"

3. Update system and enable NTP

3.1. Tweak pacman

vim /etc/pacman.conf
  • Uncomment the line "Color"

3.2. System update

pacman -Sy pacman
pacman-key --init
pacman -S archlinux-keyring
pacman-key --populate archlinux
pacman -Syu --ignore filesystem
pacman -S filesystem --force
reboot

3.3. NTP

pacman -S ntp
systemctl enable ntpd.service
systemctl start ntpd.service

4. Advanced setup

4.1. Set a secure root passwd

passwd

4.2. Set hostname

nano /etc/hostname

4.3. sudo & user

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 and wheel
adduser

4.4. Additional software

  • 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

4.5 vcgencmd and other vc tools

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

4.6 WiringPi

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.

5. Setup SSH server

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

6. Sound

Set the output device

amixer cset numid=3 1

7. Raspberry pi overclocking

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.

8. WLAN

wifi-menu -o
netctl start yourWlanSSID
netctl enable yourWlanSSID

9. Ruby

\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

10. ZSH and dotfiles

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

11. Tweaks

11.1 TRIM and noatime

Change in your fstab:

/dev/root  /  ext4  noatime,discard  0  0

11.2 Disable tmpfs for /tmp

Since our RAM is limited.

sudo systemctl stop tmp.mount
sudo systemctl disable tmp.mount

Sources

About

A really opionionated guide how to setup a RPi with Arch Linux including WiringPi, ntp, wi-fi, ssh, ruby, zsh etc.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published