Skip to main content

Mattermost

Install Mattermost Server on Ubuntu

[object Object]

Install Mattermost Server on Ubuntu using the PPA repository for quick setup and automatic updates. Suitable for self-hosted deployments on supported Ubuntu LTS versions.


[object Object]

  • OS: Ubuntu 20.04, 22.04, or 24.04 LTS
  • Hardware: 1 vCPU, 2GB RAM (supports ~1,000 users)
  • Database: PostgreSQL v12+
  • Network:
    • Ports 80/443 (Application), 8065 (Admin Console), 10025 (SMTP)

[object Object]

[object Object]

For Ubuntu 20.04

sudo apt-key del A1B31D46F0F3A10B02CF2D44F8F2C31744774B28
curl -sL https://deb.packages.mattermost.com/pubkey.gpg | gpg --dearmor | sudo apt-key add

For Ubuntu 22.04 and 24.04

sudo rm /usr/share/keyrings/mattermost-archive-keyring.gpg
curl -sL https://deb.packages.mattermost.com/pubkey.gpg | gpg --dearmor | sudo tee /usr/share/keyrings/mattermost-archive-keyring.gpg > /dev/null

Add the Repository

curl -o- https://deb.packages.mattermost.com/repo-setup.sh | sudo bash -s mattermost


[object Object]

  1. Update and Install
sudo apt update && sudo apt install mattermost -y

  1. Path and Service Info
  • Installed at /opt/mattermost
  • Create a systemd service with:
After=postgresql.service
BindsTo=postgresql.service


[object Object]

  1. Set Up Config
  • Rename default config:
sudo install -C -m 600 -o mattermost -g mattermost /opt/mattermost/config/config.defaults.json /opt/mattermost/config/config.json

  • Edit config.json:
    • DriverName: "postgres"
    • DataSource: postgres://mmuser:<password>@<IP>:5432/mattermost?sslmode=disable
    • SiteURL: https://<your-domain>
  1. Start the Server
sudo systemctl start mattermost

  1. Verify
curl http://localhost:8065

  1. Enable on Boot
sudo systemctl enable mattermost.service


[object Object]

  • Update:
sudo apt update && sudo apt upgrade
sudo systemctl stop mattermost

  • Remove:
sudo apt remove --purge mattermost


[object Object]

  • Start on Boot:
sudo systemctl enable mattermost.service

  • Database on Same Server: Edit /lib/systemd/system/mattermost.service:
After=postgresql.service
BindsTo=postgresql.service

  • Without Proxy: Enable binding to port 443:
sudo setcap cap\_net\_bind\_service=+ep ./mattermost/bin/mattermost