A complete Guide that it just as simple and easy to setup and maintain your own, fully flexible, simple selfhosted homserver as more limited, power-hungry but ready-to-go solutions such as Synology, Xpenelogy, Unraid, TrueNAS.
Tip: a wider desktop view of this page.
Why A Selfhosted Homeserver? | Intro to microservices | Hardware Recommendations | How To Get Started?
Note: I had zero experience when I started and learned everything by googling, spending time on fora, reddit and in documentations and by hours and days of trial&error. I made lots of mistakes. Now, in case of disaster I will use the scripts in this repository myself to get up and running again. I am documenting this because I haven't found a single source online that provides all necessary information to get up and running. Also, lot's of things have been carefully chosen after testing alternatives. You can save lots of time with this guide! :) basic Linux commands.
- A file cloud using: FileRun - Access and share your files from everywhere, sync your devices and enjoy your photo albums from any device, anywhere in the world. Fast and secure!
- A fantastic password manager: VaultWarden - a.k.a Bitwarden, the best password manager available.
- Your own Office Online/Google Docs: OnlyOffice - integrates nicely with FileRun.
- Your own browser sync: Firefox Sync Server - your history, passwords, form fill info etc no longer shared with 3rd parties and easy to sync from laptop to phone.
- A highly secured reverse web proxy to be able to use all these features via your own domain like https://my.domain.cloud.
- Your own ad-filtering or parental filtering dns server: AdGuard Home - no more ads on any device within your network and even on your phone when you leave the house.
- Your own very fast VPN: Wireguard - Your own VPN server and easy management of clients. To access services you do not want to expose publicly online.
- Your own paper scanning and organizing system Paperless-ng - helps you to automatically archive your household administration and access documents easily.
- Your own media center server JellyFin - Watch your series and movies on any smart TV or device. Also when you leave the home via VPN.
- Automatically follow and retrieve your favourite tv shows and movies Sonarr Radarr Bazarr QBittorrent Because nobody can pay for every streaming service just to watch the few shows or movies they like.
- Pretty dashboards to monitor your server Grafana, Prometheus - Not necessary, but handy and with notifications.
- Your own homepage to quickly access each service in a single webpage Organzir See preview here.
For more details per service, see here.
Regardless of your hardware (x86-64 or ARM, see Hardware Recommendations, for the scripts in this guide to work, the following is required, otherwise you may need to change the install commands, build software, figure out how to configure email notifications etc:
- Arch based OS
- AUR (Arch User Repository)
- Pamac to be able to install AUR packages
- Pacman to be able to install packages
- BTRFS filesystem - with or without swapfile (no swap partition)
Manjaro on x86-64 (Intel/AMD) is the recommended OS of choice and used for this guide. It does not matter which desktop flavor you choose. I use Gnome but power users might want to consider KDE instead.
This guide used to be Ubuntu-based. All my laptops/PCs and my parents systems ran Ubuntu Budgie. After 2 years I switched to Manjaro (Gnome edition) and it is a delight! A much better out-of-the-box experience, more user-friendly (also for setting up a server! This is reflected in my scripts, they are a lot smaller) lightweight, small footprint, much better and up to date single source of high quality documentation (Arch Wiki) and MUCH easier to install applications + keep up to date than any Ubuntu system. Also, better out-of-the-box BTRFS support. For small, flexible homeservers and personal laptops I strongly believe BTRFS is the best filesystem. If you have more needs, look at XFS/ZFS. This guide will use BTRFS.
Step 0: get the right hardware, most motherboards and CPUs are not designed for 24/7365 continuous running, instead, they are designed for performance.
How to prep a USB stick: see Manjaro First Steps > Using a Live System. Further Instructions here.
Note
- Requirement: select BTRFS during setup with no swap, this allows you to later enable swapfile with hibernate support or zRAM.
- Requirement: Do not select "automatically login..", if you do, you will be faced with key-ring issues when using docker. Solveable but not covered by this guide.
- Consider using my Manjaro Gnome Post-Install script. It is meant for both clients of your servers (laptops, PCs for you or your family) but also gives you a little headstart in this guide. You can always easily remove applications you do not need later, as the "App Store" of Manjaro is one of the best and fastest available in Linux world.
Turn your system into a modern server with 1 click with prep_server.sh to automatically or manually install essential tools, apply basic configuration + required stuff for optional docker services.
Read through the prep_server.sh and see what it does (everything has comments).
The PREP_DOCKER.SH script is carefully created to install the tools required to run all aspects of your server (from docker to mainentance tasks).
Official documentation is used to install tools correctly and all tools will be installed using the offical Manjaro package manager, a single package manager that keeps applications, OS and drivers up to date.
Download and install it via:
cd Downloads && wget https://raw.githubusercontent.com/zilexa/Homeserver/master/prep-server.sh
bash prep-server.sh
Note
- A subvolume for Docker will be created --> allows extremely easy daily or hourly backups and recovery.
- Installs Docker and follows official best practices to manage docker as non-root user (not rootless).
- Allows OS support to send emails (with minimal set of tools and configuration), several Docker containers and your maintenance tasks will need this.
- Installs several other essential tools, essential for example for data migration, backups, maintenance.
- Optional config files for a few services (will ask y/n before downloading).For example if you are going to use torrents, consider using the QBittorrent config file. The Organizr config might be nice and will save you lots of time building your own "Start" page.
This is the most time-consuming and complex part of creating your homeserver as there are many choices to be made, not just for your filesystem but also folderstructure.
- Learn about the easiest filesystem options for a homeserver then:
- Step 2a. Create Filesystems. Understand your goal, make sane choices.
- Learn about Linux system folderstructure, standard subvolumes and tips for your folderstructure then:
- Step 2b. Create Datapool(s)
Data Migration - Move files to your server data pool.
Before you can access your services outside of your home, prepare your network and get your own domain.
Docker Compose Guide There are a lot of guides and docker-compose.yml files. Most of them are not complete or do not adhere to Docker best practices. A lot of hours have been spent on the yml file in this repository to ensure it follows best practices, does not contain unneccessary complexities and is as generic as possible, so that it can be published without security concerns. The .env file allows you to personalize your compose file through variables.
Note:
- The carefully written docker-compose.yml file is the unique part of this guide!. It can be tailored to your needs with Minimal Effort.
- You cannot finalise your docker-compose without having a single path to your data and your media, covered in step 2.
- The services you want to access via your own domain won't work until you have completed step 3.
The Docker guide (step 3) explains how to access your services. Configuring & using your services is not covered by this guide. The overview of Docker applications below will contain some foldable sections with hints. Overview of Docker Apps contains direct links to the documentation or homepage of each Docker app.
Decide what will be your Backup Strategy and use the Server Backup Guide to leverage the BTRFS filesystem to backup your @, @home, @docker subvolumes and your data subvolumes easily, while also having a timeline/timemachine snapshots of your data.
Nightly maintenance of your server such as cleanup, backup and disks protection tasks.