Mattermost
Overview
Mattermost Team Edition is an MIT-licensed, self-hosted team collaboration and messaging platform, and an open-source alternative to Slack. It gives your organisation channels, threads, direct messages and file sharing while keeping every conversation on infrastructure you control.
The SecureAnyCloud image installs Mattermost Team Edition 10.5.5, the free open-source build with no Enterprise license prompt.
What you get:
- Mattermost Team Edition 10.5.5 (MIT-licensed open-source build) installed at /opt/mattermost and served by
mattermost.serviceas the non-rootmattermostuser - A local PostgreSQL 16 database on loopback
127.0.0.1:5432, with a per-VM database password generated on first boot - nginx reverse proxy on port
80, proxying to Mattermost on127.0.0.1:8065with the WebSocket upgrade headers Mattermost's realtime channel needs for/api/v4/websocket - All state on a dedicated 40 GiB Azure data disk at
/var/lib/mattermost: the file store, plugins, logs and the PostgreSQL data directory - A unique per-VM System Admin account (
admin@sac.local), created non-interactively on first boot, with the password written to a root-only credentials file - Open sign-up disabled by default, so only the seeded System Admin exists until you invite users
- An unauthenticated
GET /healthendpoint on nginx for load-balancer and uptime checks - 24/7 SecureAnyCloud support
Mattermost binds loopback 127.0.0.1:8065 only. You reach it through the nginx reverse proxy on port 80. PostgreSQL is never exposed. It listens on 127.0.0.1:5432 only.
Prerequisites
- An active Azure subscription
- An SSH key pair
- A VNet and subnet in the target region
Standard_B4ms (4 vCPU, 16 GiB RAM) is a good starting point.
In the NSG inbound rules, allow 22/tcp from your management network and 80/tcp from the clients that will use Mattermost. For production, front the VM with TLS (see the final step) and allow 443/tcp instead of plain 80.
Step 1 - Deploy from the Azure Marketplace
Sign in to the Azure Portal, choose Create a resource, search the Marketplace for Mattermost Team Edition by SecureAnyCloud and select Create.
On Basics, pick your subscription, resource group, region and size (Standard_B4ms). Under Administrator account, choose SSH public key and paste your key. Under Inbound port rules, allow SSH (22) and HTTP (80). Then choose Review + create and Create.
Step 2 - Deploy from the Azure CLI
# Accept the Marketplace terms once per subscription (required before the first CLI deploy)
az vm image terms accept --urn sac1647283583153:mattermost-ubuntu-24-04:default:latest
az vm create \
--resource-group <your-rg> \
--name mattermost \
--image sac1647283583153:mattermost-ubuntu-24-04:default:latest \
--size Standard_B4ms \
--admin-username azureuser \
--ssh-key-values ~/.ssh/id_ed25519.pub \
--vnet-name <your-vnet> --subnet <your-subnet> \
--public-ip-sku Standard
az vm open-port --resource-group <your-rg> --name mattermost --port 80 --priority 900Step 3 - Connect to your VM
ssh azureuser@<vm-public-ip>Step 4 - Confirm Mattermost, PostgreSQL and nginx are running
systemctl is-active postgresql mattermost nginxYou should see three active lines:
active active activeMattermost binds loopback only, and nginx fronts it on port 80. Confirm the listeners:
ss -tln | grep -E ':8065|:5432|:80'LISTEN 0 511 0.0.0.0:80 0.0.0.0:* LISTEN 0 4096 127.0.0.1:8065 0.0.0.0:* LISTEN 0 200 127.0.0.1:5432 0.0.0.0:*The Mattermost API answers an unauthenticated health ping, and nginx exposes a static /health endpoint for load balancers:
curl -s http://127.0.0.1:8065/api/v4/system/ping{"status":"OK"}curl -s -o /dev/null -w '%{http_code}\n' http://localhost/health200Step 5 - Retrieve your per-VM System Admin password
Each VM generates its own System Admin password on first boot and writes it to a root-only credentials file:
sudo cat /root/mattermost-credentials.txtThe file contains MATTERMOST_ADMIN_PASSWORD, the username (admin), the email (admin@sac.local), the web URL and the System Console URL. Store the password in your secrets manager. In the commands below, <MATTERMOST_ADMIN_PASSWORD> stands for the value of MATTERMOST_ADMIN_PASSWORD.
Set the Site URL to your public address
First boot sets Mattermost's Site URL from the address Azure reports. With a Standard SKU public IP (the Azure default, and the --public-ip-sku Standard in Step 2), the image records the VM's private address (http://10.0.0.x). Mattermost then refuses the realtime WebSocket from a browser at the public IP (HTTP 403). You can sign in, but messages and channels do not update live. Check the Site URL:
sudo grep '^MATTERMOST_URL=' /root/mattermost-credentials.txtIf it shows a 10. address, set the public IP on the VM. Azure's instance metadata service reports the public IP to the VM itself, and nothing leaves the VM:
PUBLIC_IP=$(curl -s -H Metadata:true 'http://169.254.169.254/metadata/loadbalancer?api-version=2020-10-01' | grep -o '"frontendIpAddress":"[^"]*"' | head -1 | cut -d'"' -f4)
PRIV=$(hostname -I | awk '{print $1}'); echo "public $PUBLIC_IP, private $PRIV"
sudo /opt/mattermost/bin/mmctl --local config set ServiceSettings.SiteURL "http://$PUBLIC_IP"
sudo sed -i "s/\b$PRIV\b/$PUBLIC_IP/g" /root/mattermost-credentials.txtThe change applies at once and survives restarts. Your password does not change. When you move to a DNS name and TLS (Step 10), set the Site URL to that https:// address the same way.
Step 6 - Sign in to the Mattermost web UI
Open http://<vm-public-ip>/ in a browser. Sign in with the email admin@sac.local and the per-VM password from Step 5.
You land in your team's channels: Town Square, Off-Topic and any channels you create. Post messages, start threads and share files with your team.
Mattermost keeps every conversation self-hosted on your own Azure VM. Create channels, threads and direct messages as you would in any modern team messenger.
Step 7 - Administer the server from the System Console
As the System Admin, you can manage users, teams, channels, authentication and server settings from the System Console at http://<vm-public-ip>/admin_console. The Edition and License page confirms that you are running the MIT-licensed Team Edition.
Step 8 - Verify authentication from the API
The credentials file drives a real login round-trip. This command reads the per-VM password from the file and posts it to the login API. The API returns 200 for the correct password and rejects a wrong one with 401:
PW=$(sudo grep '^MATTERMOST_ADMIN_PASSWORD=' /root/mattermost-credentials.txt | cut -d= -f2-)
curl -s -o /dev/null -w 'login=%{http_code}\n' -X POST -H 'Content-Type: application/json' \
-d "{\"login_id\":\"admin@sac.local\",\"password\":\"$PW\"}" \
http://127.0.0.1:8065/api/v4/users/loginlogin=200Step 9 - Where your data lives
All Mattermost state is on the dedicated Azure data disk mounted at /var/lib/mattermost. It survives image updates and can be snapshotted independently:
df -h /var/lib/mattermost | tail -1/dev/sda 40G 285M 37G 1% /var/lib/mattermostThe file store (data/), plugins, logs and the PostgreSQL data directory (pgdata/) all live on this disk.
Step 10 - Put TLS in front for production
The image serves plain HTTP on port 80 so you can validate it immediately. Before you expose Mattermost to real users, terminate TLS with your own domain and a certificate.
A common approach is to point a DNS record at the VM, add an 443 inbound rule to the NSG, and use Certbot with the nginx plugin to obtain and install a certificate. Set ServiceSettings.SiteURL in the System Console (or config.json) to your https:// URL, so links and the realtime WebSocket use the correct host.
Support
SecureAnyCloud maintains this image and provides 24/7 support. Mattermost Team Edition is distributed under the MIT license. For product help, contact SecureAnyCloud support through the Azure Marketplace listing.
Deploy on Azure
Launch Mattermost Team Edition on Ubuntu 24.04 LTS on Azure with 24/7 support from SecureAnyCloud.
View this image
Need Help?
Our support team is available 24/7.
sales@secureanycloud.com
Overview
This image runs Mattermost Team Edition as a single Go binary behind nginx, which is configured as a websocket-aware reverse proxy. PostgreSQL provides the database, bound to the loopback interface only.
What you get:
- The Mattermost server listening on
127.0.0.1:8065, reached through nginx on port 80 (and 443 once you add TLS). - A Mattermost System Administrator account and a PostgreSQL password generated on the first boot of every instance. Two instances launched from the same Amazon Machine Image never share passwords.
- The initial administrator password and the database password written to
/root/mattermost-credentials.txtwith mode 0600, so only the root user can read them. - The PostgreSQL data directory on its own EBS volume at
/var/lib/postgresql, and Mattermost file storage (uploads and plugins) on a second volume at/opt/mattermost/data. Each is separate from the operating system disk and independently resizable.
Prerequisites
Before you deploy this image, you need:
- An Amazon Web Services account where you can launch EC2 instances
- IAM permissions to launch instances, create security groups and subscribe to AWS Marketplace products
- An EC2 key pair in the target Region for SSH access to the instance
- A VPC and subnet in the target Region, with a security group that allows inbound port 22 from your management network and inbound ports 80 and 443 from the networks your users will reach Mattermost on
- The AWS CLI (version 2) installed locally, if you plan to deploy from the command line
Launch the Instance from the AWS Marketplace
Sign in to the AWS Management Console, open the EC2 service and select Launch instance. Under Application and OS Images, choose AWS Marketplace AMIs and search for Mattermost. Select the SecureAnyCloud listing, choose Select, then choose Continue on the subscription summary.
Pick an instance type of m5.large or larger. Choose your EC2 key pair under Key pair (login). Under Network settings, select your VPC and subnet. Create or select a security group that allows inbound port 22 from your management network and inbound ports 80 and 443 from the networks your users use. Leave the root volume at the default size or larger.
Select Launch instance. First-boot initialisation takes approximately one to two minutes after the instance state becomes Running and the status checks pass.
Launch the Instance from the AWS CLI
This command launches an instance from the SecureAnyCloud Mattermost Marketplace AMI into an existing subnet and security group. Replace <ami-id> with the AMI ID shown on the Marketplace listing and <key-name> with your EC2 key pair name. Replace <subnet-id> with your subnet ID and <security-group-id> with a security group that opens ports 22, 80 and 443.
aws ec2 run-instances \
--image-id <ami-id> \
--instance-type m5.large \
--key-name <key-name> \
--subnet-id <subnet-id> \
--security-group-ids <security-group-id> \
--block-device-mappings '[{"DeviceName":"/dev/sda1","Ebs":{"VolumeSize":30,"VolumeType":"gp3"}}]' \
--tag-specifications 'ResourceType=instance,Tags=[{Key=Name,Value=mattermost-01}]'The command prints a JSON document on success. Note the instance ID, then retrieve its public address once the instance is running with aws ec2 describe-instances --instance-ids <instance-id> --query "Reservations[].Instances[].PublicIpAddress" --output text.
Connect and Retrieve Initial Credentials
Connect over SSH with the key pair you selected and the public IP address from step 2. The SSH login user depends on the operating system of the AMI variant you launched. For the Mattermost 11 on Ubuntu 24.04 variant, the login user is ubuntu.
The first-boot service runs before the SSH daemon becomes ready, so the credentials file is always in place when you log in for the first time.
ssh <login-user>@<public-ip>
sudo cat /root/mattermost-credentials.txtThe credentials file is plain text. It contains the Mattermost URL, the administrator username (admin), the administrator password, and the PostgreSQL database name, user and password. Copy these values somewhere secure, such as a password manager or encrypted vault. Do not commit them to source control.
From the same SSH session, you can confirm that the deployment is healthy. The system ping endpoint is open and returns JSON:
curl -fsS http://127.0.0.1/api/v4/system/ping{"AndroidLatestVersion":"","AndroidMinVersion":"","IosLatestVersion":"","IosMinVersion":"","status":"OK"}A "status":"OK" response confirms that the full stack (nginx, the Mattermost server and PostgreSQL) is serving.
First Login
Open a web browser and go to http://<public-ip>/. On the Mattermost sign-in page, enter the username admin and the administrator password from /root/mattermost-credentials.txt. Then select Log in.
The Mattermost Team Edition sign-in page, served on first boot with no manual setup.
The first-boot service sets Mattermost's Site URL to the instance's own address automatically, so the site works immediately on its launch address. When you move Mattermost behind a custom domain or a load balancer, update the Site URL in the System Console (Step 7) or with the CLI.
Create Your First Team and Channels
On first sign-in, create a team. A team is a workspace that contains channels and members. Give it a name and a URL, and you land in the team's default Town Square channel.
Create public or private channels for projects and topics from the + next to the channel list. Start direct messages from the Direct Messages section.
The Mattermost channels view: real-time messaging with channels, threads and direct messages.
Connect Desktop and Mobile Apps
Mattermost has native desktop apps (Windows, macOS, Linux) and mobile apps (iOS, Android). Download them from https://mattermost.com/download/, point each app at your instance address and sign in. This image serves the same REST API that the apps use. To verify that it is live and gated, run:
# Without a token the API returns 401 curl -s -o /dev/null -w '%{http_code}\n' http://127.0.0.1/api/v4/users/me
# Logging in with the admin credentials returns 200 curl -s -o /dev/null -w '%{http_code}\n' -d '{"login_id":"admin","password":"<new-password>"}' http://127.0.0.1/api/v4/users/loginThe System Console
The System Console is the administration area for the whole server. Open it from the settings menu (the gear icon), or go to http://<public-ip>/admin_console. From here you manage users and teams, configure authentication, email, file storage and integrations, and review site statistics and server logs.
The System Console: Team Edition under the Mattermost MIT Compiled License.
User management in the System Console, showing the per-instance System Admin account generated on first boot.
You can also administer the server from the command line with the Mattermost CLI in local mode:
sudo -u mattermost /opt/mattermost/bin/mmctl --local user list --allConfigure Outbound Email
Mattermost sends mail for invitations, password resets and notifications. In the System Console, open Environment then SMTP, and enter your provider's host, port, encryption and credentials.
For reliable delivery on a cloud instance, route mail through an SMTP provider such as Amazon SES, SendGrid or Mailgun. Then send a test email.
Enable HTTPS with Let's Encrypt
For any production Mattermost deployment, serve the site over HTTPS so session tokens and messages cannot be intercepted. The image ships with nginx, which certbot can configure automatically.
These steps assume you have a DNS record that points your fully qualified domain name at the instance's public IP address.
sudo apt-get update && sudo apt-get install -y certbot python3-certbot-nginx
sudo certbot --nginx -d mattermost.your-domain.example \
--non-interactive --agree-tos -m you@your-domain.example \
--redirectAfter certbot finishes, set the Site URL to the HTTPS address, so Mattermost generates correct links:
sudo -u mattermost /opt/mattermost/bin/mmctl --local config set ServiceSettings.SiteURL https://<your-domain>
sudo systemctl restart mattermostBackups and Maintenance
Back up two things together: the PostgreSQL database and the file storage directory /opt/mattermost/data (uploads and plugins).
Ship both to an Amazon S3 bucket or another object store. Because the database and file tiers are on their own EBS volumes, you can also take coordinated EBS snapshots.
sudo -u postgres pg_dump mattermost > <backup-dir>/mattermost-db-$(date +%F).sql
sudo tar -czf <backup-dir>/mattermost-data-$(date +%F).tgz -C /opt/mattermost dataUbuntu's unattended-upgrades is enabled by default for kernel and package updates. To upgrade Mattermost itself, follow the upgrade guide at https://docs.mattermost.com/.
Scaling Beyond a Single Instance
For larger deployments, move away from the single-instance pattern:
- Move PostgreSQL to Amazon RDS for PostgreSQL and update
SqlSettings.DataSourcein the System Console orconfig.json. - Move file storage to Amazon S3 under Environment then File Storage in the System Console.
- Put the web tier behind an Application Load Balancer with sticky sessions and websocket support.
- Serve static assets through Amazon CloudFront.
Each of these is documented in the official Mattermost documentation at https://docs.mattermost.com/.
Support
SecureAnyCloud provides 24/7/365 expert technical support for this image, with a guaranteed response within 24 hours and a one hour average for critical issues. Contact sales@secureanycloud.com.
For general Mattermost administration questions, consult the documentation at https://docs.mattermost.com/. Mattermost is a trademark of Mattermost, Inc.; use of the name here is nominative and does not imply affiliation or endorsement.
Deploy on AWS
Launch Mattermost on AWS with 24/7 support from SecureAnyCloud.
View on Marketplace
Need Help?
Our support team is available 24/7.
sales@secureanycloud.com