
Mattermost is an open-source team communication platform designed for secure and flexible collaboration. The application allows teams to send messages, share files, and integrate with other tools all in one place, supporting self-hosted setups for complete data control. More or less, Mattermost has the same functionality as apps like Slack or Discord, hence it’s getting more and more popular these days. In this article, we will show you how to install Mattermost on Debian 13.
Table of Contents
Prerequisites
- A Debian 13 VPS with at least 2GB of RAM
- SSH access with sudo privileges, or root access.
Conventions
# – given commands should be executed with root privileges either directly as a root user or by use of sudo command
$ – given commands should be executed as a regular user
Step 1. Log in to your server via SSH
First of all, let us log in to our Debian 13 VPS via SSH as the root user:
ssh root@IP_Address -p Port_number
You will need to replace ‘IP_Address’ and ‘Port_number’ with your server’s IP address and SSH port number, respectively. Additionally, replace ‘root’ with the username of the system user with sudo privileges.
Now, let’s check whether you have the proper Debian version installed on your server with the following command:
$ lsb_release -a
The command should return an output like this:
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 13 (trixie)
Release: 13
Codename: trixie
In this article, we run the commands as root and as a Mattermost user. Please pay attention to the symbol shown before the commands.
Step 2. Update the System
Before installing Mattermost, we need to ensure that all Debian 13 packages installed on the server are up to date. You can do this by running the following commands:
# apt update
The list of available packages in the system package index has been refreshed. Let’s proceed to the next step.
Step 3. Create a New User
In this step, we will create a new system user called “mattermost”. Let’s execute the command below; you can substitute ‘mattermost’ with any username you like. This new system user will be used to run the Mattermost service.
# /usr/sbin/useradd -mrd /opt/mattermost mattermost -s /bin/bash
That’s it, we have just created a new user called Mattermost
Step 4. Install PostgreSQL Server
Initially, Mattermost supported MySQL and PostgreSQL. But, starting with Mattermost v11, support for MySQL has been completely removed from the codebase. So, PostgreSQL is the only supported database driver now. Let’s install the PostgreSQL server.
# apt install postgresql
Once the installation is finished, PostgreSQL will be automatically up and running. It is also configured to automatically run upon a server reboot.
Step 5. Create a Database
Next, let’s create a PostgreSQL database. First, we need to log in to the user ‘postgres’ then go to the PostgreSQL shell
# su - postgres
$ psql
Once logged in, let’s run the commands below to create a database and user, then grant the user access.
CREATE DATABASE mattermost;
CREATE USER mattermost WITH PASSWORD 'm0d1fyth15';
GRANT ALL ON DATABASE mattermost TO mattermost;
ALTER DATABASE mattermost OWNER TO mattermost;
GRANT USAGE, CREATE ON SCHEMA PUBLIC TO mattermost;
Next, quit from the PostgreSQL shell.
\q
That’s it, a new database has been created. Let’s exit from the postgres user.
$ exit
Step 6. Download and Install Mattermost on Debian 13
In the earlier step, we created a system user called ‘mattermost’. Let’s switch to this user account and download Mattermost. If you want to download the more recent tarball package, you can go to their download page at https://docs.mattermost.com/product-overview/mattermost-server-releases.html and get the download link
# su - mattermost
Get the download link from their download page, then download it.
$ wget https://releases.mattermost.com/11.6.1/mattermost-11.6.1-linux-amd64.tar.gz -O mattermost.tar.gz
The installation file has been downloaded and saved as mattermost.tar.gz. Now, let’s extract the file.
$ tar -xzvf mattermost.tar.gz --strip-component 1
Before running Mattermost, we need to configure it to connect to our database.
cp -a /opt/mattermost/config/config.json{,.orig}
The command above saves a copy of config.json as config.json.orig. Now, let’s edit the config.json file to connect to the PostgreSQL database.
$ nano /opt/mattermost/config/config.json
Configure the following properties in this file:
"DataSource": "postgres://mmuser:mostest@localhost/mattermost_test?sslmode=disable\u0026connect_timeout=10\u0026binary_parameters=yes",
Replace the lines with these:
"DataSource": "postgres://mattermost:m0d1fyth15@localhost/mattermost?sslmode=disable\u0026connect_timeout=10\u0026binary_parameters=yes",
Make sure to use the correct database user and password you created earlier.
Set your “SiteURL”: Your domain name for the Mattermost server (e.g., https://mattermost.yourdomain.com).
Save the file, then exit from nano editor, and exit from user ‘mattermost’
$ exit
Step 7. Create Systemd Service File
In this step, we will create a systemd service file to manage our Mattermost service. Let’s create a systemd service file for Mattermost now.
# nano /etc/systemd/system/mattermost.service
Paste the following into the systemd service file, then save it.
[Unit]
Description=Mattermost
After=network.target
[Service]
Type=notify
ExecStart=/opt/mattermost/bin/mattermost
TimeoutStartSec=3600
KillMode=mixed
Restart=always
RestartSec=10
WorkingDirectory=/opt/mattermost
User=mattermost
Group=mattermost
LimitNOFILE=49152
[Install]
WantedBy=multi-user.target
Save the file, exit, and then reload systemd for changes to take effect.
# systemctl daemon-reload
Next, let’s enable Mattermost to run on boot and run the service now.
# systemctl enable --now mattermost
The command above will return an output like this:
Created symlink '/etc/systemd/system/multi-user.target.wants/mattermost.service' → '/etc/systemd/system/mattermost.service'.
At this point, Mattermost should be up and running and will automatically start on boot. To verify, run this command:
# systemctl status mattermost
You will see an output similar to this
● mattermost.service - Mattermost
Loaded: loaded (/etc/systemd/system/mattermost.service; enabled; preset: enabled)
Active: active (running) since Sat 2026-05-09 00:31:11 EDT; 18s ago
Invocation: 4d63fe49d0574719a799490cc4b0ee45
Main PID: 8346 (mattermost)
Tasks: 29 (limit: 2226)
Memory: 624.7M (peak: 836.9M)
CPU: 10.446s
CGroup: /system.slice/mattermost.service
├─8346 /opt/mattermost/bin/mattermost
├─8363 plugins/mattermost-ai/server/dist/plugin-linux-amd64
├─8370 plugins/com.mattermost.calls/server/dist/plugin-linux-amd64
└─8375 plugins/playbooks/server/dist/plugin-linux-amd64
May 09 00:31:11 debian13 mattermost[8346]: {"timestamp":"2026-05-09 00:31:11.080 -04:00","level":"info","msg":"rtc: server is listening on udp 127.0.0.1:8443","caller":"app/plugin_api.go:1139","plugin_id":"com.mattermost.calls">
May 09 00:31:11 debian13 mattermost[8346]: {"timestamp":"2026-05-09 00:31:11.084 -04:00","level":"info","msg":"rtc: server is listening on udp 192.168.93.140:8443","caller":"app/plugin_api.go:1139","plugin_id":"com.mattermost.c>
May 09 00:31:11 debian13 mattermost[8346]: {"timestamp":"2026-05-09 00:31:11.087 -04:00","level":"info","msg":"Listening TCP on 0.0.0.0:8443","caller":"app/plugin_api.go:1139","plugin_id":"com.mattermost.calls","origin":"main.(>
May 09 00:31:11 debian13 systemd[1]: Started mattermost.service - Mattermost.
May 09 00:31:11 debian13 mattermost[8346]: {"timestamp":"2026-05-09 00:31:11.576 -04:00","level":"info","msg":"Starting Server...","caller":"app/server.go:872"}
May 09 00:31:11 debian13 mattermost[8346]: {"timestamp":"2026-05-09 00:31:11.576 -04:00","level":"info","msg":"Server is listening on [::]:8065","caller":"app/server.go:948","address":"[::]:8065"}
May 09 00:31:11 debian13 mattermost[8346]: {"timestamp":"2026-05-09 00:31:11.576 -04:00","level":"info","msg":"Sending systemd READY notification.","caller":"commands/server.go:129"}
May 09 00:31:29 debian13 mattermost[8346]: {"timestamp":"2026-05-09 00:31:29.147 -04:00","level":"info","msg":"Worker: Job is complete","caller":"jobs/batch_migration_worker.go:71"}
May 09 00:31:29 debian13 mattermost[8346]: {"timestamp":"2026-05-09 00:31:29.148 -04:00","level":"info","msg":"Worker: Job is complete","caller":"jobs/batch_migration_worker.go:71"}
May 09 00:31:29 debian13 mattermost[8346]: {"timestamp":"2026-05-09 00:31:29.149 -04:00","level":"info","msg":"Worker: Job is complete","caller":"jobs/batch_migration_worker.go:71"}
You should be able to access Mattermost at http://YOUR_SERVER_IP_ADDRESS:8065

Step 8. Install and Configure Nginx
In the previous step, we accessed Mattermost at http://YOUR_SERVER_IP_ADDRESS:8065. To access Mattermost via a domain or subdomain without including the port in the URL, we need to install and configure a reverse proxy. Let’s install and configure nginx.
# apt install nginx -y
Once installed, we can create an nginx server block for our Mattermost website.
# nano /etc/nginx/conf.d/mattermost.conf
Then, insert the following into the file.
upstream mm {
server 127.0.0.1:8065;
}
server {
listen 80;
server_name mattermost.yourdomain.com;
location ~ /api/v[0-9]+/(users/)?websocket$ {
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
client_max_body_size 50M;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Frame-Options SAMEORIGIN;
proxy_buffers 256 16k;
proxy_buffer_size 16k;
client_body_timeout 60;
send_timeout 300;
lingering_timeout 5;
proxy_connect_timeout 90;
proxy_send_timeout 300;
proxy_read_timeout 90s;
proxy_http_version 1.1;
proxy_pass http://mm;
}
location / {
client_max_body_size 50M;
proxy_set_header X-Frame-Options SAMEORIGIN;
proxy_buffers 256 16k;
proxy_buffer_size 16k;
proxy_read_timeout 600s;
proxy_cache_revalidate on;
proxy_cache_min_uses 2;
proxy_cache_use_stale timeout;
proxy_cache_lock on;
proxy_http_version 1.1;
proxy_pass http://mm;
}
}
Save the file, then exit from the editor and restart nginx
# systemctl restart nginx
That’s it, you should be able to access Mattermost at http://mattermost.yourdomain.com now.
Congratulations! You followed this article and have successfully installed Mattermost on your Debian 13 server.
Of course, you don’t have to follow this article to install Mattermost on your Debian 13 server if you have an active Mattermost hosting service with us, in which case you can simply ask our expert Linux admins to install Mattermost for you. Simply log in to the client area, then submit a ticket. Our expert administrators are available 24×7 and will respond to your request immediately. They will also help you install an SSL certificate on your Mattermost service.
If you liked this post on how to install Mattermost on Debian 13, please share it with your friends or leave a comment below.