The cart is empty

Matrix is an open standard for decentralized communication, enabling users to send messages, make voice calls, and share files across various services and platforms with a focus on privacy and security. Synapse is the reference server implementation of the Matrix protocol, written in Python, allowing the creation of standalone communication servers that can be federated with the global Matrix network for enhanced interoperability. This article will guide you through the process of setting up and managing a federated Matrix Synapse server.

1. Installation of Synapse

1.1 Prerequisites

Before you begin, ensure that your system meets the minimum requirements. For a small to medium server, it is recommended to have at least 2 GB of RAM and 2 CPU cores, along with sufficient disk space for storing data.

1.2 Installation on Ubuntu/Debian

For installing Synapse on Ubuntu or Debian, add the official Matrix.org repository and import the GPG key:

sudo apt update
sudo apt install -y lsb-release wget apt-transport-https
sudo wget -O /usr/share/keyrings/matrix-org-archive-keyring.gpg https://packages.matrix.org/debian/matrix-org-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/matrix-org-archive-keyring.gpg] https://packages.matrix.org/debian/ $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/matrix-org.list
sudo apt update

Then install Synapse:

sudo apt install matrix-synapse-py3

2. Configuration of Synapse

2.1 Generating Configuration File

After installation, it is necessary to generate a basic configuration file:

sudo -u matrix-synapse python3 -m synapse.app.homeserver \
  --server-name your.domain.com \
  --config-path /etc/matrix-synapse/homeserver.yaml \
  --generate-config \
  --report-stats=yes|no

Replace your.domain.com with your server's domain.

2.2 TLS Setup

For secure communication, it is important to set up TLS. If you already have existing SSL certificates, place them in the appropriate directories and update homeserver.yaml with the paths to these files. For automatic certificate renewal, you can use Let's Encrypt.

3. Starting and Basic Management

3.1 Starting Synapse

After configuration, you can start Synapse with the command:

sudo systemctl start matrix-synapse

And set the service to start automatically on system boot:

sudo systemctl enable matrix-synapse

3.2 User Management

You can manage users using the integrated script register_new_matrix_user, located in /usr/bin/:

sudo register_new_matrix_user -c /etc/matrix-synapse/homeserver.yaml http://localhost:8008

4. Federation

For federation with other Matrix servers, properly configure the DNS records of your domain name, including SRV records pointing to your server. This step will enable other servers to discover and communicate with your server.

5. Security and Maintenance

Securing your Matrix server should be a priority. Regularly update your software and adhere to security best practices. Backups are crucial for recovery in case of failures.

 

Setting up and managing a federated Matrix Synapse server requires careful configuration and maintenance but offers a powerful tool for decentralized communication. By following best practices and performing regular maintenance, you ensure that your server is secure and reliable for your users.