Format your sdcard to FAT on system's disk utils before start to remove every old linux systems.
Prepare sdcard (on linux)
- Get your disk with
lsblk
- Umount all partitions
sudo umount /dev/sdX?
yes, with?
at end, just replace theX
with your disk, should be likesudo umount /dev/sda?
- Open fdisk
sudo fdisk /dev/sdX
- Clean the partitions
o
- Create first partition
n, p, enter, enter, +100M, t, c
- Create second partition
n, p, enter, enter, enter
- Write and exit
w
- Format the partitions you have created
sudo mkfs.vfat /dev/sdX1 sudo mkfs.ext4 /dev/sdX2
- Mount the partitions
sudo mkdir -p /mnt/{boot,root} sudo mount /dev/sdx1 /mnt/boot/ sudo mount /dev/sdx2 /mnt/root/
Install Arch
- Get image and extract
wget http://archlinuxarm.org/os/ArchLinuxARM-rpi-4-latest.tar.gz sudo tar zxvf ArchLinuxARM-rpi-4-latest.tar.gz -C /mnt/root
- Copy boot files
sudo mv /mnt/root/boot/* /mnt/boot
- Sync and umount
sync && sudo umount /mnt/boot /mnt/root
Put the card into raspberry pi you should have Arch working.
You're ready to connect throught ssh, the default user should be alarm
and pass alarm
(always check the officinal documentation).
- Enter to root
su
(we dont havesudo
yet) default passwourd should beroot
- To change the
alarm
passwordpasswd alarm
- To change the
root
passwordpasswd root
- Enter to root
su
- Run the commands
pacman-key --init pacman-key --populate archlinuxarm pacman -S archlinuxarm-keyring pacman -Syu
- Install sudo
pacman -S sudo
- Create group rule
echo "%sudo ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/sudogroup
- Create the
sudo
groupgroupadd sudo
- Add user
alarm
to the groupgpasswd -a alarm sudo
- Reboot
- Install some packages
sudo pacman -S --needed base-devel git wget
- Clone repo
git clone https://aur.archlinux.org/yay.git
- Go to directory and install
cd yay && makepkg -si
- Enable on next boot
sudo sh -c "echo exfat >> /etc/modules-load.d/raspberrypi.conf"
- Reboot
I can't disable SSH password because I need to enter the password in kodi SFTP plugin.
The commands bellow are outside the raspberry pi. Should be run in your Linux/Mac terminal
- Go to ssh directory
cd ~/.ssh/
- (optional) Generate a new private/pub key
ssh-keygen -C "alarm@alarmpi" -a 100 -t ed25519 -o -f alarmpi
- (optional) Sometimes you need to fix the permissions
sudo chmod 600 alarmpi*
- (optional) Add the to keychain
ssh-add alarmpi
- Add the key to authorized_keys
ssh-copy-id -i alarmpi.pub alarm@yourip
- Create the directory
mkdir -p /media
- Get the partition UUID from
lsblk -f
- Edit the fstab
sudo nano /etc/fstab
UUID=5F3C-2D27 /media exfat defaults,uid=1000,gid=1000,umask=002 0 2
5F3C-2D27
is the partition's UUID you got from previous command
- Install
yay -S docker
- Enable the service
sudo systemctl enable docker
- Start the service
sudo systemctl start docker
It is recommended to dont add user to docker
group because the --privileged
will grants root.
Since we will use Portainer, we might dont need it.
- Run
sudo docker run --restart always -d -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce:linux-arm
- Access
http://your-raspberry-ip:9000
, chooseDocker
and finish the setup - Create the qBittorrent stack
version: "2" services: qbittorrent: image: linuxserver/qbittorrent container_name: qbittorrent environment: - PUID=1000 - PGID=1000 - UMASK_SET=002 - TZ=Europe/London - WEBUI_PORT=8080 volumes: - /media/Downloads:/downloads - /media/Config/qBittorrent:/config ports: - 6881:6881 - 6881:6881/udp - 8080:8080 restart: unless-stopped
- Access
http://your-raspberry-ip:8080
login withadmin
andadminadmin
, go to settings and change it
- Set the hostname
sudo hostnamectl set-hostname raspberrypi
- Install
yay -S samba
- Add your user to samba
sudo smbpasswd -a alarm
type the password - Create the file
sudo nano /etc/samba/smb.conf
[global] fruit:model = RackMac log file = /var/log/samba/%m.log workgroup = WORKGROUP server role = standalone server hosts allow = 192.168.1. map to guest = Bad User [media] path = /media guest ok = yes writable = yes
- Enable the service
sudo systemctl enable smb nmb
- Enable the service
sudo systemctl enable smb nmb
Lets use systemd for it source https://ostechnix.com/configure-static-dynamic-ip-address-arch-linux/
- Create or edit the profile:
sudo nano /etc/systemd/network/eth0.network
- Add your network settings:
[Match]
Name=eth0
[Network]
DHCP=no
Address=192.168.1.11/24
Gateway=192.168.1.1
DNS=8.8.8.8
DNS=8.8.4.4
- Remove
netctl
just in casesudo pacman -Rns netctl
- Stop dhcp
sudo systemctl stop dhcpcd
- Disable dhcp
sudo systemctl disable dhcpcd
- Enable systemd-network
sudo systemctl enable systemd-networkd
- Start systemd-network
sudo systemctl start systemd-networkd