Deploy Matrix Synapse federated chat server on Ubuntu with Element client — end-to-end encrypted and fully self-hosted.
enable_registration: false in homeserver.yaml if you want a private server.
Grab the automated bash script from GitHub to follow along with the video.
wget https://raw.githubusercontent.com/mhmdali94/Docker/main/communication/matrix/matrix-ubuntu.sh
chmod +x matrix-ubuntu.sh
sudo bash matrix-ubuntu.sh
wget https://raw.githubusercontent.com/mhmdali94/Docker/main/communication/matrix/matrix-ubuntu.sh
chmod +x matrix-ubuntu.sh
The script installs Docker, then deploys Synapse server with PostgreSQL and the Element web client automatically.
sudo bash matrix-ubuntu.sh
Open your browser and navigate to:
http://<your-server-ip>:8008
Register your admin account, configure your server name, and optionally disable open registration if you want a private server.
# Register admin user inside the container
docker exec -it synapse register_new_matrix_user -u admin -p yourpassword -a -c /data/homeserver.yaml http://localhost:8008
| Port | Purpose |
|---|---|
| 8008 | Synapse HTTP |
| 8448 | Matrix Federation |
| 5432 | PostgreSQL (internal) |
Matrix is an open standard and decentralised communication protocol that enables real-time messaging, voice, and video across a federated network of independently hosted servers. Synapse is the reference homeserver implementation — self-hosting it gives your organisation a private, federated messaging platform.
Matrix is the only open messaging protocol that combines E2E encryption, federation (communicate across servers), and bridges to every major platform — Slack, Discord, WhatsApp, Telegram, IRC. If you want messaging infrastructure you truly own, with no vendor lock-in and the ability to talk to users on other servers, Matrix is unmatched. Synapse is the reference server implementation.
Port 8008 (Synapse HTTP — internal, proxy in front of it) and 8448 (Matrix federation HTTPS — must be publicly accessible if you want to federate). PostgreSQL on 5432 is internal only. Use a reverse proxy on 443 pointing to 8008, and expose 8448 for federation.
Direct alternatives: Mattermost (simpler, no federation, channel-based), Zulip (topic threading, no E2E encryption), Rocket.Chat (feature-rich). For pure E2E encrypted messaging without federation: Signal (no self-hosting), Wire (limited self-hosting). Cloud: Slack, Microsoft Teams.
Don't use Matrix if your team just needs simple team chat — Mattermost or Zulip are far easier to operate. Matrix is complex: federation, key management, and bridges add significant operational overhead. If you don't need federation or E2E encryption, a simpler tool is better.
PrismaTechWork provides end-to-end infrastructure services — from initial deployment and security hardening to ongoing monitoring, automated backups, and dedicated support. Whether you need a single-server setup or a multi-site network, our team ensures your infrastructure is built right, secured properly, and maintained reliably.
Matrix is the open protocol. Synapse is the reference server implementation. Element is the official client (web, desktop, mobile). You run Synapse; your users connect via Element or any other Matrix client.
Yes — if federation is enabled and port 8448 is publicly accessible, your users can join rooms and message users on any Matrix server, including matrix.org.
Use a bridge service: mautrix-slack for Slack, mautrix-discord for Discord. Deploy the bridge as a separate container alongside Synapse and register it as an Application Service in homeserver.yaml.
E2E encryption is enabled for direct messages by default. For rooms/channels, encryption must be enabled per-room. Once enabled, it cannot be disabled for that room.
Federation breaks permanently — other servers won't trust your server anymore. Back up the signing key file from your Synapse data directory. You cannot regenerate it without losing federation history.
Synapse (Python-based) is memory-hungry — expect 1-2 GB RAM for a small team. For larger deployments, use Dendrite (Go-based, lighter) or enable Synapse workers. PostgreSQL also needs adequate RAM for indexing.
There's no direct automated importer from Mattermost. Slack exports can be partially imported via third-party tools. Most Matrix migrations start fresh and keep old logs as archives.
Run `docker compose pull && docker compose up -d`. Synapse runs database migrations automatically on startup. Always check the upgrade notes on GitHub before major version jumps — some versions have manual migration steps.