Install Mattermost server#

Install Mattermost Server on a 64-bit machine. Assume that the IP address of this server is

  1. Log in to the server that will host Mattermost Server and open a terminal window.

  2. Download the latest version of the Mattermost Server. In the following command, replace X.X.X with the version that you want to download:


  1. Extract the Mattermost Server files.

tar -xvzf *.gz

  1. Move the extracted file to the /opt directory.

sudo mv mattermost /opt

  1. Create the storage directory for files.

sudo mkdir /opt/mattermost/data


The storage directory will contain all the files and images that your users post to Mattermost, so you need to make sure that the drive is large enough to hold the anticipated number of uploaded files and images.

  1. Set up a system user and group called mattermost that will run this service, and set the ownership and permissions.

  1. sudo useradd --system --user-group mattermost

  2. sudo chown -R mattermost:mattermost /opt/mattermost

  3. sudo chmod -R g+w /opt/mattermost

  4. sudo restorecon -R /opt/mattermost

  1. Set up the database driver in the file /opt/mattermost/config/config.json. Open the file as root in a text editor and make the following changes:

  • If you are using PostgreSQL:

  1. Set "DriverName" to "postgres"

  2. Set "DataSource" to the following value, replacing <mmuser-password> and <host-name-or-IP> with the appropriate values:


  • If you are using MySQL:

  1. Set "DriverName" to "mysql"

  2. Set "DataSource" to the following value, replacing <mmuser-password> and <host-name-or-IP> with the appropriate values. Also make sure that the database name is mattermost instead of mattermost_test:



For a same-machine installation, replace <host-name-or-IP> above with localhost or

  1. Also set "SiteURL" to the full base URL of the site (e.g. "").

  2. Test the Mattermost server to make sure everything works.

    1. Change to the mattermost directory:

    cd /opt/mattermost

    1. Start the Mattermost server as the user mattermost:

    sudo -u mattermost ./bin/mattermost

When the server starts, it shows some log information and the text Server is listening on :8065. You can stop the server by pressing pressing Ctrl C on Windows or Linux, or C on Mac, in the terminal window.

  1. Set up Mattermost to use the systemd init daemon which handles supervision of the Mattermost process.

  1. Create the Mattermost configuration file:

sudo touch /etc/systemd/system/mattermost.service

  1. Open the configuration file in a text editor, and copy the following lines into the file:

Description=Mattermost postgresql.service




If you are using MySQL, replace postgresql.service with mysqld.service in the [unit] section.

  1. Set the service file permissions.

sudo chmod 644 /etc/systemd/system/mattermost.service

  1. Reload the systemd services.

sudo systemctl daemon-reload

  1. Set Mattermost to start on boot.

sudo systemctl enable mattermost

  1. Start the Mattermost server.

sudo systemctl start mattermost

  1. Verify that Mattermost is running.

curl http://localhost:8065

You should see the HTML that’s returned by the Mattermost server.

Now that Mattermost is installed and running, it’s time to create the admin user and configure Mattermost for use.