There are many ways to run your own server, from setting up a Raspberry Pi on your desk to renting a physical server at a provider.
In this post, we will focus on setting up a virtual server with DigitalOcean, which is one of the easiest ways to get started.
If you are asking yourself, why should I run my own server, I cover that in part one of this series: Benefits of running your own server
Setting up a virtual machine on DigitalOcean
DigitalOcean is a cloud provider that makes it easy to create and manage virtual servers. Here’s how to get started:
Sign up for a DigitalOcean account ($200 free credit with my referral code)
Create a droplet and fill out the wizard
- Choose a region and data center close to your usual location. This can affect the speed of your server, so it’s important to choose a location that is convenient for you.
- Choose the latest
.04release of Ubuntu, at the time of writing
22.04. This is a long-term support (LTS) release that will receive updates and support for a longer period of time.
- Choose a basic droplet with regular SSD. This will provide enough resources to run a simple server.
- Choose SSH key authentication and add your SSH key. This will allow you to log in to your server securely without needing to enter a password.
- Add the improved metrics. This gives you some basic monitoring for free, which can help you keep an eye on your server’s performance.
- I would suggest activating the backup option. This will create regular backups of your server, which can be useful in case anything goes wrong.
- Choose a hostname you’d like to use. I usually choose planets or characters from Stargate or Star Trek, but you can choose whatever you like.
Locking down the firewall
Once your virtual machine is set up, it’s important to secure it. One of the first steps you should take is to lock down the firewall to only allow required ports. This will help prevent unauthorized access to your server.
DigitalOcean provides an easy way to manage your firewall. Simply go to the Networking section of your server and click on “Create Firewall”. Give your firewall a name and then add the ports you want to allow. For example, you may want to allow SSH (port 22) and HTTP/HTTPS (port 80/443).
It’s important to keep an eye on your server to make sure it’s running smoothly. There are many tools you can use to monitor your server, including open-source options like Nagios and Zabbix you can host yourself.
One of the simplest ways to monitor your server is to use an external service like Pingdom or UptimeRobot. These services will periodically check your server to make sure it’s responding and send you an alert if it’s not. I would recommend to always have at least one external service monitoring your server.
Finally, it’s important to document your credentials and any other important information about your server. This can include your SSH key, login credentials, and any other configuration details.
Make sure to store this information in a secure way, like your password manager. This will help ensure that you can access your server if anything goes wrong.
In conclusion, getting started with running your own server is not complicated. In addition it is important to note that there are hundreds of great, in-depth, tutorials for any and all aspect of running your own server that can help if you get stuck somewhere.
This is a multi part series, read more here:
- Part 1: Benefits of running your own server
- Part 2: This post
- Part 3: What to do with your own server
Host your own server on DigitalOcean ($200 free credit with my referral code)