How to get started with Self-hosting
Hello my Imaginary friend, long time no see? Clearly I have watched too much Mr. Robot during these lockdowns. Let me ask what is the most important thing is to you apart from family and friends? To me it’s my privacy. I don’t want big companies to collect, mine, and even sell my data. How does one protect their data you may ask? According to me, you can either use services from privacy-focused companies or Self-host your services but the sweet spot is probably in the middle.
I know some of you might be thinking what is self-hosting? And yes it is exactly what is in your mind when you hear self-hosting or self-hosted services the first time, making your own servers that will run services only for you and users that you allow, probably friends and families.
Before I go any further, let me get this straight, Self-hosting is not for the faint-hearted amongst you. The main thing stopping more people from self-hosting is not necessarily hardware but the time investment it needs. It takes a lot of time to configure services correctly and even after you configured everything there will be errors that pop out of nowhere and/or you might not have noticed before. You might not want to self-host if
If you don’t have either patience or time to invest in managing your servers. Things do break and it takes a lot of time to debug it.
If your self-hosted service is mission-critical to your business and you are not an IT specialist. While you can self-host but you probably should not. Self-hosted services can have a lot of vulnerabilities if not configured correctly. One such service is your own mail server, trust me never host your own mail server it’s no a good idea.
If you want to access your services outside of your home network, which generally you do, and don’t have a good enough bandwidth connection. So what is a good enough bandwidth connection? According to me anything above 40mbps download and upload speeds is good enough.
If you don’t want to invest any money into self-hosting , you do need to pay your electricity bills that will have an additional touch for your constantly running servers. Earlier I mentioned that hardware is generally not a barrier, you do need some computer that will be running 24x7. In my defense, you can run your services on pretty inexpensive hardware. I will recommend some systems on which you can start your self-hosting journey in a while.
I listed why one should not self-host services then it is only fair to list why one should consider self-hosting there services
Privacy. This is a big point for me and many who host their own services. By self-hosting your services you not only own the hardware but also all the data you generate. You are personal data is your personal data and no company can mine it to serve you any kind of ads.
Security. If configured correctly, your services will inherently be more secure. Chances are that services will have very few users, the people you know, this will make your service virtually hidden to black hats. Even if they find out about your service, the very little user base will make your service not a very profitable target. Moreover, the majority of the services are opensource and have been audited by many.
Control. When you start self-hosting your services, you will have control over your life like you never had before. You will not be at the mercy of tech giants. You have times like you are watching a TV Show on Netflix and they decide to remove before you have finished? Well, if you were self-hosting you wouldn’t face anything like that at all because you will be the king of your own content.
Fun. While I know I mentioned that it takes a lot of time to configure and maintain your servers, but once you do its feeling nothing could compare. The feeling when you are trying to set up your new service for a few hours or days and when it finally works is magical. You can’t get a high better than this.
Flaunting Rights. It is just an understatement that self-hosting is cool. When you have configured your first service and you tell someone that you have hosted this or that, it’s an amazing feeling. The fact that many of them will not understand what exactly you have done will just add to that feeling.
I mentioned opensource under security. Many of you know what opensource is if not you really need to know. Opensource is this really awesome thing where developers make their codebase public and allow anyone to edit it. I am getting sidetracked here, but if you really want to go deep in what is opensource, why contribute to opensource and how to contribute it check this article out.
Are you on board with the idea of self-hosting? Yes? then let’s move forward, if not then in the end I will add some privacy-focused services that you could replace with your current service. First let us take the hardware out from the equation. If you are starting with self-hosting, as you will considering you have read this article till here, you can start your self-hosting journey on:
Raspberry Pi. It’s a fan favorite amongst the self-hosting community. Raspberry pi is a single board arm based computer. With new Raspberry Pi 4, you can go up to 4gb of ram! Starting from Raspberry Pi 4 from ₹4000 or $35 for 1gb of Ram, you can’t go wrong with it. There is a cheaper and less powerful Raspberry pi zero, but I will not recommend getting it unless you exactly know what you are gonna do with it.
Old PC or Laptop. Many repurpose their old rigs to host their services. I know that PC will be much better than I laptop because of its additional customizability but if it works then it works, right? The main thing to keep in mind while using your old machine is efficiency. Old hardware is not regarded as the most efficient. That’s why many people prefer Raspberry Pis over old hardware. Just I quick side note: I run most of my services on my old laptop which also gives me a little power backup if there is some interruption with the electricity.
Cloud. Using the cloud might not be that obvious. And the costs might increase as you start hosting more of your services. But using the cloud will give you an easy way to try and test if self-hosting is for you. You could get a droplet from digital oceans and/or use any of the many cloud services providers to get a VPS(Virtual Private Server) as per your requirements.
Now that hardware is out of the equation, on the software side you could go in a couple of directions. For OS I would recommend going with some kind of Linux preferably server edition of Debian (and Ubuntu 19.10 for RPI), although you could also self-host on Mac or Windows. If you have a relatively well-specced pc, I would recommend installing ProxMox instead of some kind of Linux distro as the base os with Docker.
ProxMox is an opensource Level 1 hypervisor, meaning it can run multiple virtual machines on the same system. I know many recommend using docker on top of a single os, but there is a rational explanation for this. I know virtualizing requires a higher threshold than docker but as a beginner in self-hosting, that also includes me, we can very easily fuck up our os and trust me you don’t want that.
Apart from all the beginner stuff with ProxMox, using virtual machines provides your every instance with isolation and ability to port your VMs to a new node when you finally decide to build a dedicated server painlessly not to mention you get a visually appealing and simple GUI to maintain all your VMs.
I am not completely sure about this, but according to me Raspberry Pi will not be able to run Proxmox due to its arm processors. For raspberry pi, docker is your only option that will be installed over your current operating system.
Since you have now a working server, I want to go further into additional configurations. First you will be required to set a static IP for your server. If you want to run your system headless you will require toinstall Openssh-server and SSH into your server via your primary machine. If you want to access your services outside of your home networks, you will need to have a static IP or use a Dynamic DNS service. Now you all ready to rock and roll.
You might have some questions regarding what all one can self-host? So here is the list of a few services you can self-host.
Nextcloud. If you could just host one of the services, make it’s this one. Nextcloud is essentially an alternative for Google Drive but its heck of a lot more. You can use it as an email client for your email, a calendar, photo gallery, a platform for video and audio chat, heck there is a complete suite of Apps that will make you ditch complete Microsoft Office and Google Suite apps.
Plex. This service enables you to manage your media like a pro. If you own a lot of media on your drives and want to share this with multiple peoples, this is the last thing you will need. Plex arranges your media in a very pleasing way and adds Tittles, and Covers for every media you add to it.
PiHole. This is a must-have for everyone. This is a Pi centric service, as the name suggests but you could quite as easily set it on a PC with docker. PiHole is a DNS Sinkhole, meaning any DNS request that goes out of your network will pass through this, which essentially means you could remove all the Ads from the internet, AD-Free internet 4 lyf. You could very easily also block third-party tracking links from the big giants such as Google, Facebook and Amazon.
Bitwarden. Bitwarden is the by far the best password manager on the market, you can take not just my word but all the self-hosted community agrees. It provides a browser plugin, and apps for android, ios, mac and windows. If you decide to host Bitwarden, I recommend hosting bitwarden_rs, it’s a fork o original Bitwarden and doesn’t consume a lot of resources compared to original,
This is not at all an exhaustive list of all the service you can self-host, I can’t possibly add that it in a blog post. There is an awesome GitHub repo listing all the services, and you may be surprised what all you could find so do check that out.
Earlier I mentioned that I will list all the companies that values your privacy, so here it is :
Tutanota. Tutanota is an open-source hosted email service. I have been using Tutanota for a while now and I couldn’t be happier. The best feature of Tutanota, according to me, is its end-to-end encryption. Your message will be encrypted and no one will be able to read your message until they have the correct keys for your message. No more Google reading your emails. Apart from emails, they also provide support for storying calendar and contacts
ProtonMail and ProtonVpn. Both the mail and VPN are owned by the same company. Proton Mail and Proton VPN are regarded as the gold standard of companies that is privacy-focused.
Nextcloud. I know I have mention Nextcloud as a self-hosted service but there are nextcloud providers that will provide you with storage service. Although I have never use nextcloud from other providers and I would strongly recommend you look into the privacy policy of different providers as they are independent and have no relation with Nextcloud.
This is not at all an exhaustive list for privacy-focused services. And there is much more in setting up a privacy-focused environment for you. I will cover these techniques in an upcoming blog because I wanted to focus on self-hosting for this one.
Conclusion
You might have heard that “If you are not paying for a product, You are the product” So self-hosting may cost you but it will ensure that your data is truly yours. You will gain a lot more security as well. And while you are there, you might learn a new skill that has potential into a new career option for you. If you are self-hosting anything please make sure you are using proper encryption for your services or else it would be completely useless. I could’ve gone into much more detail about securing your networks and servers but that’s a topic for another day.
During your self-hosting journey you will get stuck, so StackOverflow and google is your best option to resolve your issues. And you might want to join following communities on Reddit
Self-Hosted
Homelab
Do let me know if I am missing any community. And you can always contact me if you are stuck somewhere.