IntroductionEncrypted, decentralized messaging has never been as important as it is today. With solutions such as the Matrix protocol and its web client Element, you can guarantee the confidentiality and integrity of your communications and keep full control over them by hosting them yourself.This guide is for youWhether you are a seasoned system administrator or an open source enthusiast, this guide will show you how to install Matrix and Element with Docker, on the latest versions of Debian 12, Ubuntu 24.04, and other Linux distributions.
You will learn how to deploy a robust, secure and customizable server, step by step.Why choose Matrix and Element?Decentralization: Unlike proprietary solutions, Matrix lets you host your data on your own server, while remaining interoperable with other instances.
Stronger security: End-to-end encryption for truly private communications.
Flexibility: Thanks to Docker, deployment is quick and suited to a variety of Linux environments.
Scalability: Ideal for personal use or for professional teams, with advanced options such as federation and third-party integrations.

Prerequisites
Before you start, make sure you have the following:
- A working Linux server:Debian 12 or Ubuntu 24.04 (or another Docker-compatible distribution).Minimum: 2 CPUs, 2 GB of RAM and 20 GB of storage.
- Debian 12 or Ubuntu 24.04 (or another Docker-compatible distribution).
- Minimum: 2 CPUs, 2 GB of RAM and 20 GB of storage.
- Root access or a user with sudo rights.
- Docker and Docker Compose installed.
- A domain or subdomain:matrix.mydomain.com and element.mydomain.com
Installing Matrix and Element
The installation steps must be carried out on a Linux server with a user holding sudo or root administrator rights.
- Create a directory for Matrix
sudo mkdir matrix && cd matrix
- Create a Docker network; Matrix and Element will have their own isolated network
sudo docker network create --driver=bridge --subnet=10.10.10.0/24 --gateway=10.10.10.1 matrix_net
