Installing [Matrix] Synapse on Debian/Ubuntu
Whether it be for privacy or simply for fun, a time will come that you will want to set up a Matrix homeserver. Currently that pretty much means Synapse, as other solutions are less…”feature complete”, though the Readme does not really include enough information for less tech-savvy people to do so easily, so here is that information.
First things first, get ahold of a machine with 2GB+ RAM, modern enough CPU and some disk space. It’ll also need an IP Address, public if you wish to connect to it from anywhere, and optionally a domain if you don’t want to have to type the IP for everything. This guide will take you through installation, basic configuration and even setting up Let’s Encrypt Certificates in a fashion that you can copy and paste or dig deeper into and understand.
Make sure you log in as root for the installation, this just means that you will not have to authorize each and every action you do with
sudo. This can often be done using the command
sudo su. If you are using a VPS from the likes of DigitalOcean they often provide you direct access to the root user without sudo, though if you are new, be careful not to mistype things.
Next we will trust repository key and add the repository to apt’s repository list.
If it complains about
add-apt-repository: command not found you should run
apt-get update && apt-get install software-properties-common -y and rerun the failed command.
At this stage the system knows about the Synapse package, and we can install it.
The installer will ask you for a server name, enter what you would like to see as the server part of your username, often your domain.
If I wanted usernames like
email@example.com I would enter
bit.ovh, this will even work if
bit.ovh does not resolve to the server hosting synapse.
After this it will ask you about reporting analytics, this choice is up to you. Some time later, once apt is done installing Synapse you will see your prompt return and you can continue.
At this stage you will do any configurations you may need.
If you configured your server_name to be a domain which does not point at the server and wish to federate your server you will have to create an SRV record as detailed here
To start your new server you will have to run
service matrix-synapse start assuming your distro ships with upstart/systemd/similar.
See more documentation at https://github.com/matrix-org/synapse