This tutorial will show how to, step by step, setup Arch Linux Arm and configure Kodi on a Raspberry Pi 3 Model B. Your host computer must be running Linux for this tutorial.
- Raspberry Pi 3 Model B
- 5V 2.1A Micro-usb Power Supply
- Micro sdcard (I'd recommend at least 16GB)
- USB Keyboard (for initial setup)
- HDMI Cable
- TV or Monitor with HDMI input
- Computer running Linux (doesn't have to be Arch Linux)
Open up a terminal and run lsblk.
Insert your Micro sdcard into your computer.
Run lsblk once again. You should now see a new device (which is probably named mmcblk0). This is your sdcard.
Keep note of what your sdcard is called, as we will be using it throughout this tutorial. (I will refer to it as mmcblkY in commands as an example)
Run sudo -i to drop to a root shell.
Now run fdisk /dev/mmcblkY
You should now be brought to an fdisk prompt You will need to enter a series of commands from here.
Warning: If you mess up any part of this (e.g., hit the wrong button) then hit Ctrl-C to cancel (it will not write changes unless you hit w)
- Type
oto clear partitions - Optionally type
pto list partitons and make sure there aren't any left. - Type
nfor new partition, and typepfor primary, then1for first partiton. Hitenterto accept the default first sector and then type+100Mfor the last sector. - Type
tfor partition type, thencto set the first partition to FAT32. - Type
nfor new partition, then2for the second partition on your sdcard. Hitentertwice to accept the first and last sector. - Type
wto write all of your changes to your sdcard.
Now all your partitons are set up!
Runlsblk. You should see two seperate partitons, one called something likemmcblkYp1and one calledmmcblkYp2. These are your two partitons. The first will be FAT32 (for booting) and the second will be EXT4 (for the root filesystem).
Next, enter the following commands to create and mount the FAT32 filesystem (the first partition):
mkfs.vfat /dev/mmcblkYp1
mkdir boot
mount /dev/mmcblkYp1 boot
Then, enter the following commands to create and mount the EXT4 filesystem (the second partition):
mkfs.ext4 /dev/sdX2
mkdir root
mount /dev/sdX2 root
Now, we can download Arch Linux ARM filesystem and extract it to the root directory we made earlier:
curl -L -O http://os.archlinuxarm.org/os/ArchLinuxARM-rpi-2-latest.tar.gz
bsdtar -xpf ArchLinuxARM-rpi-2-latest.tar.gz -C root
Optionally, you could substitue ArchLinuxARM-rpi-2-latest.tar.gz for ArchLinuxARM-rpi-3-latest.tar.gz for an AArch64 Installation (which is more unstable, but faster). Both work on Raspberry Pi 3.
Now run sync to make sure everything is properly synced.
Now move the boot files from root/boot into the boot partition/directory.
mv root/boot/* boot
Now we can unmount the both of the partitions/directories:
umount boot root
Arch Linux is now installed on your sdcard.
Eject the sdcard from your computer and insert it into your Raspberry Pi.
Plug in the Pi with HDMI to your TV / monitor. Now plug in the Pi with your 5V 2.1A Micro-usb Power Supply. The Pi should start up on its own, and you should be brought to a terminal screen.
Go ahead and plug in a keyboard to your Pi and enter root for the username and root for the password.
The first thing you should do is change the root password. Enter passwd and type in a new password.
Now create a new user (replace exampleusername with whatever username you want.):
useradd -m -g users -G wheel,storage,power -s /bin/bash exampleusername
Now set a password for the newly created user with passwd exampleusername.
Now let's set up Wi-Fi.
Run wifi-menu to bring up a ncurses menu.
You can then select your Wi-Fi network and enter the password.
Now upgrade your system and install sudo:
sudo pacman -Syu sudo
Now type visudo and uncomment the wheel group.
Note: If you'd like to use another text editor, like nano to configure sudo, then run EDITOR=nano visudo.
Since your user is in the wheel group, it will have sudo priviledges.
Logout of root with exit and log back in with your newly created username and password.
Test out sudo with sudo pacman -Syu to make sure everything works properly.
Arch Linux is now configured with your own user with sudo.
Optionally, you can install and configure ssh with the following:
sudo pacman -Syu openssh
sudo systemctl enable sshd
Install kodi with
sudo pacman -Syu kodi-rbp
Kodi will now run, but we need to do a bit of configuration to make sure video works properly.
Edit the /boot/config.txt file on your Raspberry Pi and change the gpu_mem tag like so:
gpu_mem=256
This will give the Raspberry Pi's GPU more memory on boot. (Which is needed for HD streaming).
Run kodi from your terminal (or SSH).
If everything worked correctly, you should be able to stream videos. You can use the YouTube addon to test out if everything works. Then you can start adding your Movies or TV Shows to Kodi.
Another way of connecting is as so (I found that I couldn't use
pacmanunless I set the time and date):see more: Wpa_supplicant
It's also a good idea to get
ufwsince all ports are open by default:Some other useful tweaks:
Autostart_X_at_login
Automatic_login_to_virtual_console