Skip to content

Instantly share code, notes, and snippets.

@simonhaenisch
Last active February 16, 2021 13:35
Show Gist options
  • Save simonhaenisch/d086156a5828c0037acd46b48279388f to your computer and use it in GitHub Desktop.
Save simonhaenisch/d086156a5828c0037acd46b48279388f to your computer and use it in GitHub Desktop.
Arch Linux with Shairport-Sync (Edimax Wifi, USB audio card) #raspberrypi
# boot arch linux (e. g. from usb drive)
# have a wired internet connection before boot or use wifi-menu to connect to your wifi
# https://wiki.archlinux.org/index.php/USB_flash_installation_media#In_macOS
# change keyboard layout
loadkeys de-latin1
# install arch linux ARM for RPi 1/2/3 (download to SD card, if USB stick is too small)
# https://archlinuxarm.org/platforms/armv6/raspberry-pi
# https://archlinuxarm.org/platforms/armv7/broadcom/raspberry-pi-2
# https://archlinuxarm.org/platforms/armv8/broadcom/raspberry-pi-3
# find alarmpi's ip in local network
nmap -sn 192.168.178.0/24 # adjust IP range to local network (on Mac: alt-click wifi menu bar icon to see IP)
# connect (password 'alarm')
ssh alarm@192.168.178.21
# change password (if necessary)
passwd
# switch to root (password 'root')
su
# change password (if necessary)
passwd
# change host name
echo my-rpi > /etc/hostname
# set time zone
rm /etc/localtime
ln -s /usr/share/zoneinfo/Europe/Berlin /etc/localtime
# upgrade system & packages
pacman -Syu
# install some services (network time protocol, avahi and nss-mdns for local hostname resolving)
pacman -S ntp avahi nss-mdns
# configure nss-mdns (https://wiki.archlinux.org/index.php/avahi#Hostname_resolution)
nano /etc/nsswitch.conf
# change the line "hosts: files dns myhostname" to
# hosts: files mdns_minimal [NOTFOUND=return] dns myhostname
# or try mdns4_minimal if hostname resolving is very slow
# enable installed services
systemctl enable dhcpcd
systemctl enable ntpd
systemctl enable avahi-daemon
# update current time
ntpd -gq
# shutdown, connect edimax wifi stick and usb audio card, power on
# now you should be able to connect via .local address
ssh alarm@my-rpi.local
# su, then install alsa utils
pacman -S alsa-utils
# unmute sound (by selecting channel and pressing 'm': make MM -> OO)
alsamixer
# install shairport-sync
pacman -S shairport-sync
# enable shairport-sync service
systemctl enable shairport-sync
# configure shairport-sync
nano /etc/shairport-sync.conf
# name = "Raspberry Airplay" or whatever
# mixer_control_name = "Speaker" (name of the channnel in alsamixer)
reboot # airplay should now be working
# setup wifi (o -> obscured: don't store password as plain text)
wifi-menu -o
# select wifi, enter name and key
# auto-connect to that wifi on boot
ls /etc/netctl/ # list available wifi profiles
netctl enable wlan0-WifiName
# permanently disable wifi power save
# https://wiki.archlinux.org/index.php/Power_management#Network_interfaces
nano /etc/udev/rules.d/70-wifi-powersave.rules
# add line:
# ACTION=="add", SUBSYSTEM=="net", KERNEL=="wlan*", RUN+="/usr/bin/iw dev %k set power_save on"
# clean-up package cache
pacman -Sc
# if using USB sound card, fix USB speed
# https://github.com/mikebrady/shairport-sync/issues/158
nano /boot/cmdline.txt
# add dwc_otg.speed=1 to the line
reboot # to check if wifi connects automatically
# hdmi setup:
# * https://www.elektronik-kompendium.de/sites/raspberry-pi/2101201.htm
# * http://elinux.org/RPiconfig#Video_mode_options
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment