Matrix is an open-source, real-time web-based platform for communications on the internet, supporting federation, encryption, and VoIP. Synapse is an open-source Matrix home server written and maintained by the Matrix.org Foundation.  With Synapse, you to host your server to fit your needs, giving you the ability to bridge to other chat networks (such as IRC, XMPP, Discord, Telegram, etc) or to host bots. Below is how to install and use Matrix Synapse on Ubuntu Linux.

How to install Matrix Synapse chat server on Ubuntu Linux

As mentioned above, Matrix is an open-source, real-time web-based platform for communications on the internet, supporting federation, encryption, and VoIP. Below is how to install Matrix Synapse on Ubuntu Linux.

Install prerequisite packages

Before you can install Synapse on Ubuntu, make sure to install the packages below. They will help you get Synapse installed successfully.

Add Matrix package repository

By default, Synapse packages are not available in Ubuntu repositories. To install Matrix Synapse, you must first add its repository and key. Run the commands below to add the Synapse repository GPG key. After that, run the commands below to add its repository file. Finally, update the Ubuntu package index and install Matrix Synapse. During the installation, you’ll be prompted to enter the server hostname. Type in a hostname and continue. After installation, Matrix Synapse service is started and listening on port 8008.

Configure Matrix Synapse

Now that the installation is complete, go and configure the Matrix Synapse server. First, create a secret registration shared key using the following command. Grab the string and store it somewhere for later. You’ll use it in the configuration file later. Next, run the commands below to open the Matrix Synapse default configuration file. Then disable registration for new users and define the secret key created above as highlighted below. Save the file and exit. After that, restart the Matrix Synapse server. You should now be able to access its portal using the hostname of the server provider.

Create Matrix Synapse super user

Now that the server is running, run the commands below to create a super user to manage the platform. You will be prompted to create an admin account. The most efficient way to use Matrix Synapse is to run it behind a reverse proxy. Below are two posts that show you how to set up a reverse proxy with either Nginx or Apache.

How to set up a reverse proxy with Nginx How to set up a reverse proxy with Apache

You may also use the Let’s Encrypt certificate with Sails. Below are two posts that may help you.

Set up Let’s Encrypt with Nginx Set up Let’s Encrypt with Apache

That should do it! Everything’s set up, so now you can connect to your homeserver with any Matrix client and start communicating with others.  Login with the admin account and you are done. That should do it! Conclusion: This post showed you how to set up your own Matrix Synapse server on Ubuntu Linux. If you find any error above or have something to add, please use the comment form below.