bajsicki.com/content/posts/vps-setup.md
2024-09-27 20:03:06 +02:00

65 lines
4 KiB
Markdown

+++
title = "VPS set-up"
publishDate = 2022-08-18T00:00:00+02:00
lastmod = 2024-09-27T20:02:58+02:00
tags = ["vps", "sysadmin", "servers"]
categories = ["tech"]
draft = false
meta = true
[menu]
[menu.posts]
weight = 3011
identifier = "vps-set-up"
+++
A few months ago I took up a project to centralize and collect all of my websites and email boxes.
<!--more-->
I took some time researching what I needed, and settled on netcup.de for my host. The major reason is that they're based in Germany, which means they comply with GDPR - this way I don't have to worry about my data being processed in ways I don't explicitly agree to.
Being European, I do tend to take my privacy for granted, and am reasonably careful not to contribute information about myself to businesses if I can avoid it. (Did you know that Facebook goes into overdrive with targeted advertising when you enter the US?)
I had no experience setting up servers before, aside from basic MySQL on Windows Server around the year 2007. Maybe 2008.
However... it turns out to be a really simple process if - like me - you're using Linux as your daily driver. I normally run Arch, but after some quick research I found that it's a bad choice for servers. Ubuntu it is.
So I installed Ubuntu. That's one thing sorted.
Then I had to choose a web server. I had prior experience configuring Apache and nginx, and I found them unnecessarily complicated. I don't plan to do anything more complex. Just a bunch of simple HTML files and a mail server.
I then found Caddy, and seeing its elegant and simple configuration, I was quickly sold. The setup was simple enough, and the configuration was easy. I pointed my domains to the server, and migrated most of my websites shortly.
I had previously used Wordpress, however I wanted to avoid the heavy and resource intensive nature of Wordpress. It's not bad software by any means, but I am personally biased toward lighter solutions. Having been an Emacs user for years, it only made sense to use org-mode and export to HTML.
This way I only ever need a web server that serves files, and I don't have to deal with databases.
Then the email server. I wanted this as simple as possible. I tried a number of solutions, and having issues with them, I settled on iRedMail. The installation was simple enough, but required that I handle its own webserver - it comes bundled with nginx for webmail access.
This turned Nita an entire project as I had to learn about handling SSL. Caddy procures its own certificates from Let's Encrypt, and the nginx webmail didn't like that because iRedMail generates local certs for itself.
I reconfigured Caddy to place its SSL files in a sheared directory and made nginx would read. Didn't work, nginx complained. Eventually I gave up. Since the servers are on the same physical machine, and Caddy is the server facing the web, I let it do that, and removed the SSL option from nginx.
That solved my mail issues.
Thankfully&amp; adding DKIM and DMARC to the domains was very straightforward.
Then... something interesting happened. My wife wanted to set up a Wordpress install for her new shirt store.
I chose MariaDB for the database. The set-up process for SQL DB's hasn't become any easier in the last 20 years, for inexplicable reasons. But with a small bit of research, I was able to follow the documentation, and set it up in a day from scratch.
The Wordpress install is entirely served by Caddy, and the setup was truly painless in comparison to setting up email. Still, I got it done.
The final set-up is like so:
- Ubuntu
- Caddy
- iRedMail
- nginx (behind Caddy)
- MariaDB
- Wordpress
- Emacs
For the most part, the set-up was straightforward. The sticky points were SSL between Caddy and nginx, setting up the mail server (even though I used iRedMail, it required a bit of research to set up correctly. And MariaDB for Wordpress.
Sum total: about 10-12 hours of work. In retrospect, I'm confident I could set this up again in much less time, and it was a healthy learning experience.