Setting up WriteFreely on a VPS

Requirements Domain Name VPS/VM

Optional Requirements Password Manager

The first step is locating a VPS, according to Forbes the top 3 VPS services are IONOS, GoDaddy, and DreamHost. I selected to use IONOS for my project. I chose their cheapest tier, as my blog doesn't get a ton of traffic. If you wanted to use technology that is a little more agile, you could look into Azure or Amazon LightSail. Most of these folks can also sell you a domain name as well, if you need to purchase one of those.

Once you have purchased a VPS and a domain name, you will need to connect to it to configure it. DigitalOcean has a good write up on connecting to a machine via SSH. Tools like PuTTy can be used if you are on a Windows machine.

Once you have connected you will need to create a user account, and disable the root login. This Baeldung article goes into reasoning as to why this should be disabled. Additionally, IBM has a great article on how you can set up RSA keys. Once you have tested and confirmed you can login with your key with the following command:

ssh -i /path/to/private/key user@host

To disable password login you can check your /etc/ssh/sshd_config file, there should be a PasswordAuthentication in that file, or one of its dependencies, that is set to yes and it needs to be set to no.

These commands are for Ubuntu:

$ adduser [username] $ usermod -aG sudo [username] $ passwd username

Before running this command, confirm you can login with the new username and run sudo commands, as this command will lock your root account. However, you may want to hold off on this command until after you are finished configuring WriteFreely, as file permissions between root and your user account can create a headache with automation.

$ sudo passwd -l root

Then set up sql db, I largely used this DigitalOcean article.

$ sudo apt install mysql-server $ sudo systemctl start mysql.service

Then you can open mysql, and set a password for the root account. I recommend using a password manager to keep track of passwords, KeePass, Keeper, and 1Password are great options.Additionally, I would create a service user for WriteFreely to use.


To get Write Freely to run on start up you need to create a service file: nano /etc/system/system/writefreely.service

[Unit] Description=Write Freely Instance

[Service] Type=simple StandardOutput=syslog StandardError=syslog WorkingDirectory=/var/www/[your.domain]/writefreely ExecStart=/var/www/[your.domain]/writefreely/writefreely Restart=always


Then run: sudo systemctl enable writefreely.service sudo systemctl start writefreely.service

If you reboot the VPS, WriteFreely should start after a few minutes. If it does not then you need to make sure root owns both the WriteFreely Binary, and config.ini. You can do this by using the chown command. Additionally you may need to use the chmod command on the WriteFreely binary in order to execute it.

At this point, you should have a working WriteFreely instance. Next time, we’ll explore some ways to use Ansible to automate the process, and some backup solutions for the data.

Thanks for reading!