Install Matrix Server

First Step to Develop a Matrix Client: Set Up a Local Matrix Server

The first step to developing a Matrix client is to set up your own Matrix server. This allows for a simple configuration to get started quickly. The easiest way is to use a Matrix server via Docker. For simplicity, this setup uses an SQLite database instead of the PostgreSQL database typically used in production environments.


Below is a summary of the steps, based on the official instructions found here: https://hub.docker.com/r/matrixdotorg/synapse

Install docker


The installation method depends on your operating system. Follow the instructions on the official Docker website for your OS.

Download the docker image
docker pull matrixdotorg/synapse

Generate initial configuration
docker run -it --rm --mount type=volume,src=synapse-data,dst=/data -e SYNAPSE_SERVER_NAME=my.matrix.host -e SYNAPSE_REPORT_STATS=yes matrixdotorg/synapse:latest generate

Start Matrix server
docker run -d --name synapse -v synapse-data:/data -p 8008:8008 matrixdotorg/synapse:latest

Create users
docker exec -it synapse register_new_matrix_user http://localhost:8008 -c /data/homeserver.yaml -u user2 -p password2

This command creates a user named “user2” with password “password2”.

Repeat this command to create additional users as needed.

Conclusion

Now everything is up and running (the server is listening on http://your_ip:8008). If you shut down Docker, remember to restart both Docker and the container.

For example, on openSUSE:

systemctl start docker
sudo docker start /synapse

Leave a Comment