Getting Started With Self-Hosting
October 11, 2020  |  Publishing  ·  Self-Hosting

Self-hosting is a broad concept and there are many ways to do it right and even more ways to do it wrong. In this article, I cover the basic concepts of self-hosting and the easiest ways to start this challenging journey to your digital sovereignty.

Illustration by Florian Krumm

What is Self-Hosting?

There are no clear definitions so let me define what I mean by self-hosting:

Self-hosting is a process of setting up and maintaining your own servers.

I’ll define “server” a bit later but lets unpack “maintenance” first. By maintenance I mean at least:

  • Providing adequate level of security (firewall, logging, monitoring, etc).
  • Knowing your software and being able to configure it.
  • Keeping your software is up-to-date.
  • Dealing with the hardware issues (when using your own hardware).

Those tasks aren’t hard but they are consequential. If you aren’t ready to learn how to do it, self-hosting is not for you.

You can also read this post where I describe certain less technical reasons to set up your own server:

Self-Hosting is a Productive Hobby

What is a Server?

As you may have guessed already, server is a broad concept too. In short, it makes sense to split certain programs in two parts: client and server. There are many reasons for that. Let’s take OpenStreetMap as an example. The whole world map is too big to keep it on your smartphone. It makes total sense to keep the entire map on a server and to give clients only the parts of that map that were requested by the user.

So, server is just a role, and it’s applicable to both hardware and software. There is a popular misconception that servers are always “somewhere else” but nothing stops us from running both client and server software on the same piece of hardware. In fact, it happens pretty often. In the context of this article, we’re going to focus on the server software which is located in a particular place: your dedicated server hardware.

Here are a few examples of server hardware:

  • Raspberry Pi 4 running in your house.
  • Virtual server from Scaleway, Digital Ocean or any other provider.
  • Your old dusty laptop or a PC which you no longer use.

What do they have in common? They’re all capable of running software and that’s all we need from a server. You can also connect them to your LAN end even make them accessible from the Internet (and it’s not always a good thing).

Why do I Need a Server?

Servers may do many things but the most popular one is data storage. One of the benefits of cloud file storage services such as Dropbox is the fact that it makes it harder to lose your data. Computers are unreliable and your hard drive or an SSD might fail at any moment, and you may end up losing all of your data. Dropbox solves this problem by keeping all of your data on their servers so you can always request their copy of your data if something happens with your own local replica.

Servers store and process your personal data and that can be very useful. Unfortunately, collecting and selling your personal data is a booming business and companies simply can’t resist doing that. Even worse, companies that collect a lot of sensitive data for a lot of people are perfect targets for many hackers and most companies are very bad at protecting the data they collect. That’s not good: your data is constantly being sold or stolen and there is nothing you can do about it as long as you keep relying on someone else’s servers. That’s why it’s very important to understand who owns the servers you rely on and what incentives influence their actions.

How to Choose a Server

First thing you have to figure out is location. Let’s say you want to host your own Dropbox alternative. Nextcloud offers same features and many more, and you can install it on your own server. Running Nextcloud server from home can be a good idea. Here is why:

  • Speed: You can move data much faster when it happens within your home network. Most current routers offer Gigabit Ethernet and pretty fast Wi-Fi. It’s important to move files fast, isn’t it?

  • Latency: High speed is important for moving large files but certain kinds of client-server communications are more sensitive to so-called “response time”. Data can’t travel faster than the speed of light, which means that even if you have the best Internet connection possible, having a server far from your house will slow things down quite a bit.

  • Privacy: Data centers have fewer incentives to touch your data, so I wouldn’t worry too much about using a virtual server from a well known and reputable provider but keeping your servers and your data at home eliminates the need to trust the data centers and that’s a good thing.

  • Cost: Cloud servers are cheap but cloud storage is pretty expensive. Let’s say you need to keep 2TB of family photos and other heavy but important files. This will cost you a lot to rent this space in the cloud and you’ll need to double those expenses if you need a backup (and you really need a backup). On the other hand, HDDs and SSDs are cheap and they will last your for years, with no monthly bills!

Self-hosting from home has its benefits but there are certain downsides as well:

  • Maintenance: Buying hardware and dealing with hardware failures takes time and effort. Renting a virtual server is pretty much effortless.

  • Reliability: I bet that the internet connection and an electricity supply in your house are less reliable than in an average data center. Hosting a popular blog from home might not be a good idea so you should consider your tolerance for service interruptions.

I tend to keep my articles practical, and it means I can’t be too abstract, and I have to make certain choices. When I make those choices, I try to explain the reasons behind them. One of those choices is using Raspberry Pi 4 as a server. Here is why:

  • It’s reproducible: You might have an old Dell laptop that can be transformed into a nice server but there aren’t many people in the same situation. Advising people to buy an old second hand laptop is also problematic for various reasons. On the other hand, Raspberry Pi is widely available and still up to date. It’s easy to set up, and it has a first-class Linux support, so you won’t have any driver issues.

  • It’s cheap: It starts from $35. Very much worth it, especially for a beginner who can easily get stuck with trying to install Linux on an incompatible or poorly supported piece of hardware.

  • It’s reasonably fast: If all of the above sounds too good to be true, there is a reason for that: $35 server will have the performance of a $35 server, and it’s not the highest performance possible. Literally any laptop or a PC would run the same programs much faster. In my opinion, you should consider switching to something more powerful once you’re comfortable enough with maintaining your own servers but Raspberry Pi 4 can easily run most of the apps you might need and the performance should be OK.

  • Dealing with hardware issues is easy: Just replace the whole board with the identical one. That’s fast and effective. It can be done in seconds, just remove the SD card and connect it to other board. If you have any USB peripherals, connect them too and that’s it, everything will work just fine.

How to Choose an Operating System

Raspberry Pi computers have their own official Linux distribution: Raspberry Pi OS. In my opinion, it’s not that good for a server, and it’s not its main focus anyway. It’s more of a desktop operating system aimed at teaching kids how to program which means it lacks some tools that are aimed at different audiences.

Ubuntu is the most popular Linux distribution, and it works like a charm on a Raspberry Pi, so I would recommend it as a solid foundation for your self-hosting needs. It also provides a nice layer of hardware abstraction in a sense that you can easily migrate from a Raspberry Pi 4 to any other computer or rent a virtual server. Chances are, all of those options would work well with Ubuntu, so you won’t need to learn from scratch how to configure and maintain your new server.

Conclusion

Self-hosting is not easy, and it was a privilege only a few could enjoy. Today, it’s easier than ever to self-host your own server. Raspberry Pi is easy get started with, even if you don’t have a lot of time. It has a huge focus on kids and education and it says something about how approachable it is if you’re interested enough. Linux isn’t a scary beast anymore and Ubuntu is a well polished and well documented distribution. Using containers and Docker makes deploying software easy and fun, so things seem to get better and I hope that it gives more people the ability to use self-hosting as a way to control their own digital stuff.