Self-hosting, Part 1

Today I will be describing to you my experiences with self-hosting and how you can get started as well.

I’m not going to go into detail in this article about how to install and configure anything, but the websites for respective pieces of software have great documentation and you can always look for more information online. Followup blog posts may come in the future describing setups that I’ve created.

1. Hardware

Believe it or not, you don’t actually need a server computer to host your websites, email or other networked software. You can use pretty much any old computer to do what you want. I know a guy who uses a laptop without a screen as a server, and quite successfully so. Your server could be anything, from an old Android phone to a router to an actual server computer, just as long as you have it connected to a network.

I have personally been using Raspberry Pi computers for my personal servers. What you might learn the hard way, though, that you really don’t want to do many write operations on a simple SD card, instead, I recommend getting a 2.5” Hard Disk Drive or a even a Solid State Drive with a simple USB to SATA converter, which you can get cheap off eBay or AliExpress. I’ve had quite a few corrupted SD cards on my Raspberry Pi’s due to high amount of concurrent writes.

1.1. Hosting services

For most of the heavy-lifting, though, I recommend using Virtual Private Servers for online services. I use a 10€/month cloud server from Hetzner to host most of my websites, databases and email. I can only really recommend Hetzner and OVH because I’ve had the best experiences with them, but you can search around the web for VPS hosting. Be sure to look at reviews and make sure to read the Terms of Service notices!

If you have more money to spend, you can also look for hosted dedicated servers.

With hosting services, you also avoid the problem of having to expose your IP address or open ports on your local network. If you don’t like your IP address being public or you simply are unable to open ports on your network, I strongly recommend that you get a low cost virtual private server instead of any local computer.

2. Operating System

What you’re looking for here is an operating system based on the Linux kernel. I can recommend Debian, CentOS and Arch Linux. Linux systems are (mostly, there are paid enterprise solutions) completely free, in every sense of the word, and open source.

If you run into any issues with Linux systems, or just want to know how to configure or use a certain program, an absolutely wonderful online resource is the Arch Linux Wiki, and you don’t even have to use Arch Linux in order for it to be useful to you.

3. Software

There’s a lot of things you can run on your own server computer, so in this section, I’m going to tell you about some of the more common and more useful services.

3.1. Website hosting

Of course everybody wants to have a website. What would a self-hosted server be without a website?

The first thing you need in order to run a website is a web server. For beginners and simple setups, the most popular choice is the Apache HTTP Server, however for more versatility and better (in my opinion) configuration and proxying, I recommend nginx as well.

For the actual content of the website, you also have a lot of options. A very good and popular free platform you can use is WordPress. Of course, there’s the possibility of writing a website yourself, either in PHP and HTML or just HTML and CSS.

3.2. Private File Cloud

If you’re like me and don’t like having your files on someone else’s computer, hosting a “file cloud” yourself is a good bet. The best software to do this (by far) is NextCloud. It allows you to easily synchronize files between your computers and mobile phones and you always know that your files are safe in your own hands.

Be warned though, this application server takes a good chunk of your computer resources, so you might need something more powerful than a Raspberry Pi for this one.

3.2.1. Online Documents

NextCloud can very easily help you transfer documents between your devices, but there’s also the option to integrate an Office platform, such as Collabora Online, which allows you to view and edit your Office documents on the go, just like Google Docs or Office 356 Online, but you’re in control!

Be warned again, these applications are also a significant load on your server.

3.3. Mail Server

Okay, so you’ve got it in your head that you also want to host a mail server for yourself, but let me stop you right there. Setting up a mail server is a really tedious and time consuming task and you’ll probably end up giving up and using Gmail or Outlook in the end anyway. A misconfigured email server could also do a lot of harm, so please be careful with what you configure and always read the documentation if you really do plan on hosting your own mail server.

If that didn’t scare you, you may proceed. Just know that you should NEVER host an open email relay unless you really know what you’re doing.

3.3.1. Mail Transfer Agent (MTA)

The MTA is the program used to send emails. It does not necessarily let you read/manage inboxes on its own.

One of the more popular MTAs, and the one I use, is Postfix. Creating the perfect configuration to meet your needs is, again, a tedious task. You can look for example configurations online and try them out yourself.

3.3.2. Mail access (IMAP, POP3)

This is the application that actually allows you to access and store your emails on your server.

The most popular software for this is Dovecot. Dovecot is really good at doing what it does and it allows you to set up mailboxes and can even do message sorting (pigeonhole sieve).

3.3.3. Mail filtering

Mail filtering is what you would use to combat spam.

A great free software for combating spam is SpamAssassin and you can use ClamAV to detect viruses in incoming mail.

3.4. Database

If you need a database, your own server is also a good place for that. For SQL databases, I recommend using MariaDB. For NoSQL, you could use MongoDB. You’ll need a MariaDB database if you’re going to host WordPress on your server.

4. Communication

Communication is an important part of society. Did you know that there are free and open source solutions that you can put on your own server that allows you to communicate with your friends? Here are some that I have personally come in contact with and can recommend.

1. An aging, historical solution: IRC
IRC (Internet Relay Chat) is an old text-based protocol used in ages old chat rooms. Believe it or not, it is still used to this day. IRC is a quick and easy way to communicate in text. A popular IRC server application is inspIRCd.

I personally still host an IRC server for me and my friends.

2. Purely for voice chatting: Mumble
Mumble is a free and open source low latency voice chatting application. In order to host your own server for Mumble, you need Murmur (mumble-server).

3. Up-and-coming communication standard: Matrix
Matrix is a free and open source decentralized communication protocol. Anyone can host a server (called a homeserver) and people from different servers are able to communicate with each-other. The current go-to homeserver solution is Synapse, however more options are coming in the future.

As a disclaimer I’d like to say that Synapse is a large application and it might not be plausible for you to host it on your machine.

4. Simple and modern: Rocket.Chat
Rocket.Chat is a free and open source communication platform aimed for teams. Despite being aimed for teams, it’s also a great solution for chatting with your friends. It allows you to create rooms and also provides end-to-end encryption for messages.

I’ve personally hosted a Rocket.Chat instance and can say that it is a good platform, however me and my buddies are old-school and like our IRC server more.

4.1. Your own social network!

Have you ever thought about running a Twitter-like platform that you had full control over? Well, now you can! With Mastodon, you can create your own social networking platform, called an instance. Instances are joined together in a global federated network called the Fediverse, which allows you to communicate with anyone on any Mastodon (or other platform on the Fediverse) server without making multiple accounts.

Conculsion, for now..

There’s a lot of things you can do with your own server. Hopefully this blog post was of any use to you.