What is Mattermost?
Mattermost is a secure collaboration platform for accelerating mission-critical collaborative work. The platform is built to meet the custom needs of technical and operational teams in rigorous and complex environments, including government, defense, and critical infrastructure. Mattermost gives organizations full control over their data with self-hosted and private deployment options and access to the source code. - https://docs.mattermost.com/about/product.html
Installation
- Log into the Linux device
- Run the following commands in terminal
# update software repositories
sudo apt update
# install available software updates
sudo apt upgrade
# install prerequisites
sudo apt install wget git apt-transport-https -y
# install postgresql
sudo apt install postgresql postgresql-client -y
# enable the postgresql service and start it
sudo systemctl enable postgresql --now
# connect to postgresql
sudo -u postgres psql postgres
# create mattermost database user
create user mattermost_rw with password 'Matt3rM0st';
# create mattermost database
create database mattermost with encoding='UTF8' template='template0' owner='mattermost_rw';
# close postgresql connection
exit
# create mattermost user
sudo useradd -mrd /opt/mattermost mattermost -s "$(which bash)"
# create /opt/mattermost directory
sudo mkdir /opt/mattermost -p
# set owner of /opt/mattermost
sudo chown mattermost:mattermost /opt/mattermost -R
# switch to mattermost user
sudo su - mattermost
# fetch the latest download URL
regex='(https:\/\/releases\.mattermost\.com\/[^/]*\/mattermost-[^/]*-linux-amd64\.tar\.gz)' && response=$(curl https://docs.mattermost.com/about/version-archive.html) && [[ $response =~ $regex ]] && downloadURL="${BASH_REMATCH[1]}"
# download mattermost
wget -O /tmp/mattermost.tar.gz $downloadURL
# extract the download
tar -xvzf /tmp/mattermost.tar.gz -C /opt/mattermost --strip-component 1
# backup config json file
cp /opt/mattermost/config/config.json /opt/mattermost/config/config.json.orig
# edit config.json
nano /opt/mattermost/config/config.json - Set the SiteURL value
"SiteURL": "http://debian.local",
- Scroll down to find the SqlSettings configuration, update the DataSource value as follows
"DataSource": "postgres://mattermost_rw:Matt3rM0st@localhost/mattermost?sslmode=disable\u0026connect_timeout=10\u0026binary_parameters=yes",
- Press CTRL+O, Enter, CTRL+X to write the changes
Running Mattermost as a Service
- Back in the Terminal, continue with the following commands
# exit the mattermost user shell
exit
# create mattermost service file
sudo nano /etc/systemd/system/mattermost.service - Paste the following into mattermost.service
[Unit]
Description=Mattermost
After=postgresql.service
BindsTo=postgresql.service[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 - Press CTRL+O, Enter, CTRL+X to write the changes
- Continue with the following commands
# reload systemd services
sudo systemctl daemon-reload
# start mattermost service on boot and now
sudo systemctl enable mattermost --now - Open a web browser and navigate to http://DNSorIP:8065
- Click the View in Browser button
- Complete the form to create an account
- Enter an Organization Name > Click Continue
- Complete the remaining prompts or choose to skip
- Welcome to Mattermost
Source: https://docs.mattermost.com/install/install-tar.html