Setup a multi-function home server on a Raspberry Pi 4.
I'll use the DietPi operating system, which is a minimal image designed to run on small single board computers like my RPi. It also uses dialog boxes, so I won't have to remember command line commands any more than I need to.
I also won't connect the RPi to any keyboard or monitor. But, I've installed a desktop environment just in case I do need it.
-
Add wifi network SSID and password to the
dietpi-wifi.txt
present in this repository. -
Edit the
dietpi.txt
file in this repository, fill in sensitive fields like passwords etc. -
Download latest image from DietPi.
-
Mount the
.img
file (on macos: double click the file). -
Replace existing
dietpi.txt
,dietpi-wifi.txt
files with the edited ones. -
Flash it to a USB drive using BalenaEtcher.
-
Plug the USB drive into the RPi 4 and power it on.
-
SSH into the RPi. Find the RPi's IP by logging into the router, or use
nmap
(instructions here).
# Hostname will work only if `avahi-daemon` was specified to be downloaded
# in `dietpi.txt` and DietPi's first boot setup is complete.
# Otherwise IP address of the RPi is needed.
ssh dietpi@<IP address / hostname.local from dietpi.txt>
- If DietPi's first boot setup is still running, a message will print on loop. Wait for it to finish.
# Follow the output of the first run setup
tail -n 10 -f /var/tmp/dietpi/logs/dietpi-firstrun-setup.log
# Check output of automation custom script run after install
cat /var/tmp/dietpi/logs/dietpi-automation_custom_script.log
- Reboot the RPi.
sudo shutdown -r now
- SSH into the RPi.
ssh dietpi@<HOSTNAME>.local
- Update everything.
sudo apt-get update
sudo apt-get upgrade
-
Organize the movies, shows, music on the drive for Plex. Follow this guide.
-
Plug the drive into the RPi.
-
Mount the drive using
dietpi-drive_manager
.
sudo dietpi-drive_manager
# Click through the menus to mount the drive in the default location
# /mnt/<UUID of drive>
- Verify new entry in
/etc/fstab
.
cat /etc/fstab
# A new entry should read near the end of the file:
# UUID=<UUID of drive> /mnt/<UUID of drive> <format> <options>
-
Plex is already installed if it was specified in
dietpi.txt
. Otherwise usedietpi-software
to install it. -
Open
http://<server hostname>.local:32400/web
from any device on the same network as the server. -
Follow through with the setup on-screen. Add libraries from directories in
/mnt/<UUID of drive>/
. -
Disable video stream transcoding in
Settings > Transcoder > Show Advanced > Disable video stream transcoding
. -
Enjoy!
-
Change default download directory of qBittorrent. In the WebUI
Settings > Downloads > Default Save Path
. Note: Ensure the specified directory doesn't exist already. Otherwise qBittorrent may have insufficient permissions to write to it. -
Change netdata configuration to allow remote connections.
sudo nano /etc/netdata/netdata.conf
# Comment out the line 'bind socket to IP = 127.0.0.1'
sudo systemctl restart netdata
- Change directory served by ProFTPD.
sudo nano /etc/proftpd/proftpd.conf
# Edit `DefaultRoot` option
sudo systemctl restart proftpd
- Run the dekstop (by default, the desktop environment is not run on startup).
startx
- How to install DietPi (https://dietpi.com/docs/install)
- DietPi software list (https://dietpi.com/docs/software)
- DietPi full software list with IDs (https://github.com/MichaIng/DietPi/wiki/DietPi-Software-list)