Install Mattermost Server using the tarball
      
      Available on all plans
    
      
      Self-hosted deployments
    
Minimum system requirements:
- Hardware: 1 vCPU/core with 2GB RAM (support for up to 1,000 users)
 - Database: PostgreSQL v11+
 - Network:
        
- Application 80/443, TLS, TCP Inbound
 - Administrator Console 8065, TLS, TCP Inbound
 - SMTP port 10025, TCP/UDP Outbound
 
 
You can install the Mattermost Server on any 64-bit Linux system using the tarball. Deployment includes 3 steps: download, install, and setup.
Important
This is the most flexible installation method, but it comes with the highest effort, normally favored by advanced system adminsitrators.
If you are running the Mattermost Server and database on a single system, we recommend the Mattermost Omnibus install method as this greatly reduces setup and ongoing maintenance, and uses the Mattermost PPA for updates. More modern installation methods such as the Mattermost Helm Chart or Kubernetes Operator are available and are highly recommended.
Download the latest Mattermost Server tarball
In a terminal window, ssh onto the system that will host the Mattermost Server.
Using wget, download the Mattermost Server release you want to install.
Download the latest release
      wget https://releases.mattermost.com/7.10.0/mattermost-7.10.0-linux-amd64.tar.gz
    
    Copied to clipboard
  Download the current Extended Support Release (ESR)
      wget https://releases.mattermost.com/7.8.4/mattermost-7.8.4-linux-amd64.tar.gz
    
    Copied to clipboard
  Download an older release
If you are looking for an older release, these can be found in our version archive documentation.
Install
Install the Mattermost Server by extracting the tarball, creating users and groups, and setting file/folder permissions.
First extract the tarball:
  tar -xvzf mattermost*.gz
Now move the entire folder to the /opt directory (or whatever path you require):
  sudo mv mattermost /opt
Note
If you choose a custom path, ensure this alternate path is used in all steps that follow.
By default the Mattermost Server uses /opt/mattermost/data as the folder for files. This can be changed in the System Console during setup (even using alternative storage such as S3). Create the default storage folder:
  sudo mkdir /opt/mattermost/data
Now set up a user and group called mattermost:
  sudo useradd --system --user-group mattermost
Note
If you choose a custom user and group name, ensure it is used in all the steps that follow.
Set the file and folder permissions for your installation:
  sudo chown -R mattermost:mattermost /opt/mattermost
Give the mattermost group write permissions to the application folder:
  sudo chmod -R g+w /opt/mattermost
You will now have the latest Mattermost Server version installed on your system. Managaging starting and stopping the Mattermost Server is done using systemd. Create the systemd unit file:
  sudo touch /lib/systemd/system/mattermost.service
As root, edit the systemd unit file to add the following lines:
  [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 and reload systemd using sudo systemctl daemon-reload. Mattermost Server is now installed and is ready for setup.
Note
If you are installing the Mattermost server on the same system as your database, you may want to add both After=postgresql.service and BindsTo=postgresql.service to the [Unit] section of the systemd unit file.
Setup
Before you start the Mattermost Server, you need to edit the configuration file. A sample configuration file is located at /opt/mattermost/config/config.defaults.json.
Rename this configuration file with correct permissions:
  sudo install -C -m 600 -o mattermost -g mattermost /opt/mattermost/config/config.defaults.json /opt/mattermost/config/config.json
Configure the following properties in this file:
Set
DriverNameto"postgres". This is the default and recommended database for all Mattermost installations.Set
DataSourceto"postgres://mmuser:<mmuser-password>@<host-name-or-IP>:5432/mattermost?sslmode=disable&connect_timeout=10"replacingmmuser,<mmuser-password>,<host-name-or-IP>, andmattermostwith your database name.Set your
"SiteURL": The domain name for the Mattermost application (e.g.https://mattermost.example.com).
After modifying the config.json configuration file, you can now start the Mattermost server:
  sudo systemctl start mattermost
Verify that Mattermost is running: curl http://localhost:8065. You should see the HTML that’s returned by the Mattermost Server.
The final step, depending on your requirements, is to run sudo systemctl enable mattermost.service so that Mattermost will start on system boot.
Updates
Updating your Mattermost Server installation when using the tarball requires several manual steps. See the upgrade Mattermost Server documentation for details.
Remove Mattermost
If you wish to remove the Mattermost Server for any reason, you must stop the Mattermost Server, back up all important files, and then run this command:
 sudo rm /opt/mattermost
Note
Depending on your configuration, there are several important folders in /opt/mattermost to backup. These are config, logs, plugins, client/plugins, and data. We strongly recommend you back up these locations before running the rm command.
You may also remove the Mattermost systemd unit file and the user/group created for running the application.
Frequently asked questions
Why doesn’t Mattermost start at system boot?
To have the Mattermost Server start at system boot, the systemd until file needs to be enabled. Run the following command:
  sudo systemctl enable mattermost.service
Why does Mattermost fail to start at system boot?
If your database is on the same system as your Mattermost Server, we recommend editing the default /lib/systemd/system/mattermost.service systemd unit file to add After=postgresql.service and BindsTo=postgresql.service to the [Unit] section.
Tip
We recommend the Mattermost Omnibus install method over the tarball if you are running the Mattermost Server and database a single system as this greatly reduces setup and ongoing maintenance.