sudo apt update sudo apt install postgresql postgresql-contrib
sudo -i -u postgres
psql
create role mmuser with login createdb password 'password'; create database mattermost with encoding 'UTF8' owner mmuser;
\q exit
sudo mkdir /mnt/postgresql chown -R postgres:postgres /mnt/postgresql/ sudo systemctl stop postgresql.service
sudo apt-key del A1B31D46F0F3A10B02CF2D44F8F2C31744774B28 curl -sL -o- https://deb.packages.mattermost.com/pubkey.gpg | gpg --dearmor | sudo apt-key add
sudo rm /usr/share/keyrings/mattermost-archive-keyring.gpg curl -sL -o- https://deb.packages.mattermost.com/pubkey.gpg | gpg --dearmor | sudo tee /usr/share/keyrings/mattermost-archive-keyring.gpg > /dev/null
curl -o- https://deb.packages.mattermost.com/repo-setup.sh | sudo bash -s mattermost
sudo apt update
sudo apt install mattermost -y
sudo vi /usr/lib/systemd/system/mattermost.service
[Unit] After=postgresql.service BindsTo=postgresql.service
sudo install -C -m 600 -o mattermost -g mattermost /opt/mattermost/config/config.defaults.json /opt/mattermost/config/config.json
vi /opt/mattermost/config/config.json
"DriverName": "postgres", "DataSource": "postgres://mmuser:@localhost:5432/mattermost?sslmode=disable&connect_timeout=10", "SiteURL": "https://mattermost.example.com"
sudo systemctl daemon-reload sudo systemctl start mattermost sudo systemctl enable mattermost.service