Skip to content

Instantly share code, notes, and snippets.

@7Ds7
Forked from Couto/raspberrypi_archlinux.md
Last active October 10, 2015 19:27
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 7Ds7/3739325 to your computer and use it in GitHub Desktop.
Save 7Ds7/3739325 to your computer and use it in GitHub Desktop.
Raspberry Pi with ArchLinux

ArchLinux on a Raspberry Pi

Connect the SD card to your computer and open the terminal.

  • Find the disk id
df -h
  • Unmount the disk
sudo diskutil unmount /dev/disk2s2
  • Replace /dev/disk2s2/ with /dev/rdisk2 (it might not be disk2s2, verify first!)
sudo dd bs=1m if=~/Downloads/archlinuxarm-13-06-2012\ 2/archlinuxarm-13-06-2012.img of=/dev/rdisk2

Arch Linux with 3 partitions

SSH into your raspberry pi and run

fdisk /dev/mmcblk0
  • Delete the second partition
Press:
d [Enter]
2 [Enter]
  • Create a new partition and use the default sizes prompted
n [Enter]
p [Enter]
2 [Enter]
[Enter]
[Enter]
  • Save & Exit
w [Enter]
shutdown -r now
  • After reboot
resize2fs /dev/mmcblk0p2
  • (Optional) Create swap file
#fallocate -l 128M /swapfile
#chmod 600 /swapfile
#mkswap /swapfile
#swapon /swapfile

Edit /etc/fstab and add the following:

/swapfile none swap defaults 0 0
pacman -Syu
pacman -Sy base-devel
pacman -Sy core/dnsutils
pacman -Sy extra/python2
pacman -Sy extra/python2-pip
pacman -Sy extra/python2-lxml
pacman -Sy sudo vim zsh

sudo pip2 install mitmproxy
touch /etc/hostname && echo "new-hostname" > /etc/hostname
nano /etc/hosts
127.0.0.1      new-hostname.domain.org   localhost.localdomain      localhost    new-hostname
::1            new-hostname.domain.org   localhost.localdomain      localhost    new-hostname
  • Assuming the username is couto and it has sudo privileges wheel and uses the /bin/zsh shell instead of /bin/bash
useradd -m -g users -G wheel -s /bin/zsh couto
chfn couto
passwd couto
  • to allow the wheel group to have sudo privileges:
visudo
## Uncomment to allow members of group wheel to execute any command
%wheel ALL=(ALL) ALL
ln -s /usr/bin/python2 /usr/bin/python
git clone git://github.com/joyent/node.git && cd node && git checkout v0.8.8
./configure --shared-openssl --without-snapshot
make
sudo make install

Security

pacman -Syu iptables fail2ban

Depending on the use you might want to consider some advice

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment