Try   HackMD

Arch Linux ARMv7 on Raspberry Pi 3 Installation Guide

Ref: Arch Linux ARM, theramiyer

Make Bootable SD card

Connect your SD card into your computer.

You have to login as root to do the following step, not via sudo.

sudo su

Partition

Start cfdisk to partition the SD card.

cfdisk /dev/sdX

We suggest the following size for each partition.

Mount point Partition Partition type Suggested size
/boot /dev/efi_system_partition EFI system partition 200MiB
/root /dev/root_partition Linux ARM root (/) Remainder of the device

Format

Create and mount the EFI/FAT filesystem.

mkfs.vfat /dev/sdX1 mkdir boot mount /dev/sdX1 boot

Create and mount the ext4 filesystem.

mkfs.ext4 /dev/sdX2 mkdir root mount /dev/sdX2 root

Download Linux Kernel

Download and extract the root filesystem (Again, as root, not via sudo)

wget http://os.archlinuxarm.org/os/ArchLinuxARM-rpi-armv7-latest.tar.gz bsdtar -xpf ArchLinuxARM-rpi-armv7-latest.tar.gz -C root sync

The sync writes any data buffered in memory out to disk. This can include (but is not limited to) modified superblocks, modified inodes, and delayed reads and writes.

Boot sector

Move boot files to the first partition.

mv root/boot/* boot

Unmount the two partitions.

umount boot root

Boot from Raspberry Pi 3

Insert the SD card into the Raspberry Pi, connect ethernet if your Raspberry has RJ45, and apply 5V power.

Login as the Default User

Default user:
username: alarm
password: alarm

Default root password: root

Notice that we haven't complete the installation yet, you can NOT login as root directly right now.

The user alarm has root privilege.

Now we don't have sudo yet. Type su to use root.

Connect to WiFi (if you don't have Ethernet)

  1. Navigate to /etc/wpa_supplicant.
  2. Create a new file called anything of your choice.
nano home-network
  1. Enter the following in the file:
network={ ssid="YOURSSID" psk="YOURWIFIPASSWORD" }
  1. Now, run the following command to connect to your WiFi.
wpa_supplicant -i wlan0 /etc/wpa_supplicant/home-network &
  1. Your device should now connect to the Wifi. The next step is to get a DHCP address.
dhcpcd wlan0

Once the command completes, you should get your prompt back. Ping any domain on the web to see if you're connected.

Connect via SSH (Optional)

Arch Linux allows SSH by default. If you would like to connect to the Pi using SSH from your personal computer instead of attaching a keyboard and a mouse and HDMI and everything, by all means, please do.

Setup swap (Optional)

  1. Setup the swapfile.
fallocate -l 1024M /swapfile chmod 600 /swapfile mkswap /swapfile swapon /swapfile echo 'vm.swappiness=1' > /etc/sysctl.d/99-sysctl.conf
  1. Configure fstab with the swap entry.
/swapfile none swap defaults 0 0

Setup Pacman

Color and Parallel Download (Optional)

Uncomment the following command to activate it.

# /etc/pacman.conf
------------------------------------
Color
ParallelDownloads = 5
# /etc/makepkg.conf
------------------------------------
MAKEFLAGS="-j4"

Install Keyring

pacman-key --init pacman-key --populate archlinuxarm pacman -Sy pacman pacman -S archlinux-keyring

Install Essential Package

pacman -S base base-devel linux linux-headers linux-firmware vim git networkmanager wget ncdu htop p7zip zip unzip bat wget go ntp python-pip zsh tig openssh tmux terminus-font

Sudoer

Type visudo, uncomment %wheel ALL=(ALL) ALL.

Add user to group wheel.

usermod -a -G wheel alarm

Localization

Uncommit en_US.UTF-8 UTF-8 and others language you need in /etc/locale.gen. Generate the locales by executing:

locale-gen

Create the locale.conf file, and set the LANG variable accordingly:

vim /etc/locale.conf LANG=en_US.UTF-8

Note that tmux needs en_US.UTF-8 locale.

Network Configuration

Create the hostname file:

vim /etc/hostname <myhostname>

Add matching entries to hosts:

vim /etc/hosts 127.0.0.1 localhost ::1 localhost 127.0.1.1 myhostname.localdomain myhostname

If the system has a permanent IP address, it should be used instead of 127.0.1.1.

Let Your Raspberry Pi be Better to Use

Enable NetworkManager

The default app in Raspberry Pi is wpa_supplicant. We strongly suggest you to use NetworkManager.

systemctl enable --now NetworkManager.service

Then, just type

nmtui

to configure network.

Install yay

Yet Another Yogurt - An AUR Helper Written in Go

sudo pacman -S base-devel cd /opt sudo git clone https://aur.archlinux.org/yay.git sudo chown -R pablinux:users ./yay cd yay makepkg -si

Connect to FRP server

FRP is a fast reverse proxy that allows you to expose a local server located behind a NAT or firewall to the Internet. It currently supports TCP and UDP, as well as HTTP and HTTPS protocols, enabling requests to be forwarded to internal services via domain name.

yay -S frpc

Modify /etc/frp/frpc.ini on Raspberry Pi and set the server_addr field to the public IP address of your frps server. We assume that your FRP server uses fp-multiuser plugin.

[common]
server_addr = x.x.x.x
server_port = 7000
user = YOUR_USER_NAME
meta_token = YOUR_TOKEN

[ssh]
type = tcp
local_ip = 127.0.0.1
local_port = 22
remote_port = YOUR_REMOTE_PORT

Enable the service

systemctl enable --now frpc.service

Now, you can type the following command to connect to Raspberry Pi via SSH.

ssh alarm@x.x.x.x -p YOUR_REMOTE_PORT

Wake On Lan

You can use Raspberry Pi to do WOL.

wol --verbose --port=9 xx:xx:xx:xx:xx:xx

To check the target machine receives the package correctly, type the following command:

sudo tcpdump -i INTERFACE '(udp and port 9) or (udp and port 7)' -vv -X

You can set to execute WOL while logging. If you are using zsh, the logging script should be written in ~/.zprofile.

Console Font

Reference: GitHub

CPU Stress Test

Install the following program

pacman -S s-tui stress

and use s-tui to stress the CPU.