Install

If you want to host a Matrix Server, then you are here on the right place.

Options:

There are 2 options:

  1. Use pkg_add (which I don't recommend, because it is likely going to fail)
  2. Install using pip

Option 2:

Create user:

Firstly make the user called synapse, by using this command:

$ doas adduser

And fill in the fields like:

login   synapse
passwd  *
uid     1010
groups  synapse
change  NEVER
class
gecos   synapse
dir     /home/synapse
shell   /bin/ksh
expire  NEVER

Then login into the user (ssh or su)

Install

To install the synapse:

cd ~/
mkdir -p ~/synapse
python3.8 -mvenv /home/synapse/synapse/env
. ~/synapse/env/bin/activate
pip3.8 install --upgrade pip
pip3.8 install --upgrade setuptools
pip3.8 install matrix-synapse

Create config

To make the config:

cd ~/synapse
python -m synapse.app.homeserver \
    --server-name my.domain.name \
    --config-path homeserver.yaml \
    --generate-config \
    --report-stats=[yes|no]

Make sure to edit homeserver.yaml

And make the ssl certs and such... also open the tls port (8448) in the config file and on your firewall

Start

To start the server:

alias synctl="/usr/local/share/synapse/synctl"
synctl start

Recommended

Recommended to add this to the synapse account .profile file:

start_synapse(){
        python3.8 -mvenv /home/synapse/synapse/env
        export ENV="/home/synapse/synapse/env/bin/activate"
        alias synctl="/usr/local/share/synapse/synctl"
        synctl start
}

Then when you need to start the server, just execute: start_synapse

P.s. only works when you have executed the .profile file...

Test

Use element: https://app.element.io and try to connect