How to Install Synapse on Debian Latest

Synapse is a popular and open-source Matrix homeserver which can be used to create and manage chat rooms for communities, businesses, and other organizations. In this tutorial, we will walk you through the installation of Synapse on a Debian latest server.

Prerequisites

Before you go ahead, make sure the following requirements are fulfilled.

Step 1: Update your Debian System

First of all, update your Debian system with the latest security and package updates. You can use the following command to update the system:

sudo apt update && sudo apt upgrade -y

Step 2: Install Required Dependencies

Synapse server requires a few dependencies to be installed on your system for its smooth operation. Use the below command to install the required dependencies.

sudo apt install -y python3 python3-pip sqlite3 libssl-dev python3-dev libjpeg-dev libffi-dev libxslt1-dev libxml2-dev libpq-dev

Step 3: Create a Synapse User

The Synapse server should not be run as root, thus it’s important to create a non-root user that will run the Synapse server. You can create a new user and give it the name ‘synapse’.

sudo adduser synapse

Step 4: Install Synapse

We will use the pip3 package installer to install the Synapse Matrix homeserver. Run the following command:

sudo pip3 install matrix-synapse

Step 5: Configuration

After installation, we need to configure Synapse. First, we need to create a configuration file. Run the following command to create the configuration file.

sudo mkdir /etc/synapse/
sudo chown synapse:synapse /etc/synapse/
touch /etc/synapse/homeserver.yaml

Open the newly created configuration file at /etc/synapse/homeserver.yaml and add the following lines in it:

server_name: server.domain.com

listeners:
 - port: 8008
   tls: false

database:
 name: sqlite3
 args:
  database: /var/lib/matrix-synapse/homeserver.db

media_store_path: "/var/lib/matrix-synapse/media_store"

uploads_path: "/var/lib/matrix-synapse/uploads"

enable_registration: False

Note: Replace the server.domain.com with your own domain name.

Step 6: Run the Synapse server

You can now run the Synapse server using the following command:

synctl start

Step 7: Verify that Synapse is running

You can check the status of the Synapse server using the following command:

systemctl status matrix-synapse

You should see a message that the Synapse homeserver service is active and running.

● matrix-synapse.service - LSB: Matrix Synapse server
   Loaded: loaded (/etc/init.d/matrix-synapse; generated)
   Active: active (running) since Sun 2021-12-19 04:11:26 UTC; 6s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 2505318 ExecStart=/etc/init.d/matrix-synapse start (code=exited, status=0/SUCCESS)
   CGroup: /system.slice/matrix-synapse.service
           └─2505329 /usr/bin/python3 -u -m synapse.app.homeserver --config-path /etc/synapse/homeserver.yaml

Conclusion

Congratulations! You have successfully installed and configured Synapse Matrix homeserver on your Debian latest server. You are now ready to start using Synapse to create and manage chat rooms for your communities, businesses, or other organizations.

If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!

Alternatively, for the best virtual desktop, try Shells!