In this post, we'll look at installing WireGuard as a service. I explored setting up a remote Raspberry Pi as an S3 server for storing backups recently, and the WireGuard VPN is key to getting a secure connection across the web.
This service will run when the system starts, creating a link between my local NAS and the remote storage Pi.
We will assume for this guide that you have a VPN set up & you you want it to run on system boot as a service. This is made really simple - just a few commands are needed;
Adding a service
- Set up your WireGuard VPN and test it out. This isn't covered in this guide, but there are loads of tutorials online - some really helpful stuff on YouTube too!
- Add the WireGuard service;
- Start the service;
- Check the service - this is important after a reboot or if you suspect something isn't working correctly;
Removing the Service
If you decide to remove the service, you can run these commands;
sudo systemctl stop wg-quick@wg0 sudo systemctl disable email@example.com sudo rm -i /etc/systemd/system/wg-quick@wg0* sudo systemctl daemon-reload sudo systemctl reset-failed
It's that easy!
Hopefully you don't encounter too many issues setting up your service. This is a great way to make sure your remote connections come up when the system starts.