Skip to content
  • Networking and privacy
  • Linux VPS
  • Ubuntu 24.04

Self-host a Matrix server on a VPS

A Matrix homeserver with Synapse runs well on a GhostRDP Linux VPS Standard plan with 4 vCPU and 8 GB RAM in Germany or the Netherlands, from €12.99/mo.

Matrix is an open, federated chat network. With your own homeserver, your accounts and messages live on a server you control, and you still talk to people on other Matrix servers. This guide uses the matrix.org packages from the Synapse docs.

  • Your own chat server

    Accounts and rooms on a server you control.

  • Federated

    Talk to people on any other Matrix server.

  • End-to-end encryption

    Element and other clients encrypt private chats.

Plans for Matrix (Synapse)

A small server for friends or a team runs on Basic. Joining large public rooms uses much more memory, so Standard or Pro is the safer choice for that.

  • Linux VPS Basic

    €5.99/mo

    €5.09/mo billed yearly, save €10/year

    • 2 vCPU
    • 6 GB ECC RAM
    • 40 GB NVMe
    • 1 Gbps port
    Order Basic
  • Linux VPS Standard

    Recommended

    €12.99/mo

    €11.04/mo billed yearly, save €23/year

    • 4 vCPU
    • 8 GB ECC RAM
    • 70 GB NVMe
    • 1 Gbps port
    Order Standard
  • Linux VPS Pro

    €25.99/mo

    €22.09/mo billed yearly, save €46/year

    • 6 vCPU
    • 12 GB ECC RAM
    • 90 GB NVMe
    • 1 Gbps port
    Order Pro

What you need

  • Operating system
    Linux VPS with Ubuntu 24.04 (the packages are amd64 only)
  • Domain
    A domain with an A record such as matrix.example.com pointing to your server
  • Server name
    Decide it first: Synapse can't change it later

Official site: Synapse docs

How to install Matrix (Synapse)

Written for Ubuntu 24.04 from the official instructions. Run the commands as root and replace YOUR_SERVER_IP with your server's address.

  1. 1

    Connect to your server over SSH

    Use the IP address and root password from your welcome email (the server page has a Copy SSH command button). Windows 10 and 11, macOS and Linux all include an SSH client in the terminal.

    Shell
    ssh root@YOUR_SERVER_IP
  2. 2

    Update the system

    Install the latest security updates before you add anything else.

    Shell
    apt update && apt -y upgrade
  3. 3

    Add the matrix.org repository and install Synapse

    The commands from the Synapse install docs. The installer asks for your server name: use your domain, for example matrix.example.com.

    Shell
    apt install -y lsb-release wget apt-transport-https
    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" | tee /etc/apt/sources.list.d/matrix-org.list
    apt update
    apt install -y matrix-synapse-py3
  4. 4

    Add HTTPS with Caddy

    Caddy gets a certificate automatically and passes Matrix traffic to Synapse on port 8008. Port 8448 is for other Matrix servers. Replace the domain with yours.

    Shell
    apt install -y caddy
    cat > /etc/caddy/Caddyfile <<EOF
    matrix.example.com, matrix.example.com:8448 {
      reverse_proxy /_matrix/* localhost:8008
      reverse_proxy /_synapse/client/* localhost:8008
    }
    EOF
    systemctl reload caddy
  5. 5

    Create your first user

    Adds a registration secret, restarts Synapse and creates an admin account. Answer yes when it asks whether to make an admin.

    Shell
    echo "registration_shared_secret: $(openssl rand -hex 32)" > /etc/matrix-synapse/conf.d/registration.yaml
    systemctl restart matrix-synapse
    register_new_matrix_user -c /etc/matrix-synapse/conf.d/registration.yaml http://localhost:8008

After installing

  • Sign in
    In Element or another Matrix client, choose your own homeserver, enter https://matrix.example.com and sign in.
  • Use PostgreSQL for real use
    The package starts with SQLite, which the Synapse docs call acceptable only for testing. Move to PostgreSQL before you invite many people.
  • Firewall
    Allow 22, 80, 443 and 8448 over TCP; Synapse's own port 8008 stays local.

Matrix (Synapse) questions

Which plan do I need for Matrix?

Basic for a few people. Joining big public rooms uses a lot of memory, so pick Standard or Pro for that.

Do I need a domain?

Yes. Matrix user IDs include your server name, and HTTPS needs a domain. Choose it carefully, because Synapse can't change it later.

Can I talk to people on matrix.org?

Yes. Matrix is federated, so your server talks to other homeservers over port 8448.

Can I let anyone register?

You can, but open registration attracts spam accounts, and spam from your server breaks our rules. Create accounts yourself or use invite tokens.

Stuck on a step? Our team answers on live chat and in tickets.

More on GhostRDP

Run Matrix (Synapse) on your own server.

Online in minutes. Pay with crypto, no ID needed.