Mattermost is an open-source, self-hosted messaging platform that can be used by teams for secure communication, file sharing, group chat, and more. In this tutorial, we will show you how to install Mattermost on Arch Linux.
Before proceeding with the installation, make sure that your system is up-to-date by running the command:
sudo pacman -Syu
Mattermost requires a database to store its data. We will use PostgreSQL as the database server.
Run the following command to install PostgreSQL:
sudo pacman -S postgresql
After installation, initialize the PostgreSQL database cluster:
sudo postgresql-setup --initdb --unit postgresql
Then, start the PostgreSQL service:
sudo systemctl start postgresql
Enable the PostgreSQL service to start automatically at boot time:
sudo systemctl enable postgresql
We will install Mattermost by downloading the pre-built binary package from the official website https://mattermost.org/download/.
Start by creating a new user named "mattermost" with a home directory:
sudo useradd -r -s /bin/nologin mattermost
sudo mkdir /opt/mattermost
sudo chown mattermost:mattermost /opt/mattermost
Go to the Mattermost downloads page and download the latest version of the binary package for Linux.
cd /tmp
wget https://releases.mattermost.com/5.40.1/mattermost-team-5.40.1-linux-amd64.tar.gz
After the download completes, extract the package to the /opt/mattermost directory:
sudo tar xf mattermost-team-5.40.1-linux-amd64.tar.gz -C /opt/mattermost
sudo chown -R mattermost:mattermost /opt/mattermost
To configure Mattermost, we will create a new PostgreSQL database and user for Mattermost.
Switch to the PostgreSQL user:
sudo -i -u postgres
Create a new PostgreSQL user:
createuser --username=postgres --no-createrole --no-createdb --no-superuser --pwprompt mattermost
Create a new PostgreSQL database and grant all privileges to the "mattermost" user:
createdb --username=postgres --owner=mattermost mattermost
Exit from the PostgreSQL user session by running the command:
exit
Rename the file config.json
to config.orig.json
and create a new config.json
file:
cd /opt/mattermost/config/
sudo mv config.json config.orig.json
sudo nano config.json
Copy and paste the following contents to the config.json
file:
{
"TeamSettings": {
"SiteName": "Mattermost",
"MaxUsersPerTeam": 150,
"EnableUserAccessTokens": true,
"EnableCustomEmoji": true,
"EnableClickToReply": true,
"EnableUserTypingMessages": true,
"ExperimentalViewArchivedChannels": true,
"ExperimentalEnableAuthenticationTransfer": true,
"ExperimentalEnableAuthenticationTransfer":
{
"AuthType": "",
"AuthSettings": {
}
}
},
"ServiceSettings": {
"SiteURL": "https://example.com",
"ListenAddress": ":8065",
"ConnectionSecurity": "TLS",
"TLSCertFile": "",
"TLSKeyFile": "",
"UseLetsEncrypt": false,
"LetsEncryptCertCacheFile": "",
"Forward80To443": false,
"TrustedProxyIPHeader": "",
"ReadTimeout": 300,
"WriteTimeout": 300,
"MaximumLoginAttempts": 10,
"GoroutineHealthThreshold": -1,
"GoogleDeveloperKey": "",
"GoogleCloudTraceSamplingRate": 1,
"EnableOAuthServiceProvider": false,
"EnableIncomingWebhooks": true,
"EnableOutgoingWebhooks": true,
"EnableCommands": true,
"EnableOnlyAdminIntegrations": true,
"EnablePostUsernameOverride": false,
"EnablePostIconOverride": false,
"EnableUserAccessToken": false,
"EnableCustomBrand": false,
"EnableLocalMode": false,
"EnableSaml": false,
"EnableMobileSso": false,
"EnableEmailInvitations": false,
"SendEmailNotifications": false,
"RequireEmailVerification": false,
"FeedbackNameAndEmail": false,
"EmailSettings": {
"EmailBackend": "",
"EmailServer": "",
"EmailPort": "",
"SendEmailNotifications": false,
"EnableSMTPAuth": false,
"SMTPUsername": "",
"SMTPPassword": "",
"ConnectionSecurity": "",
"InviteSalt": ""
},
"RateLimitSettings": {
"Enable": false,
"PerSec": 10,
"MaxBurst": 100,
"MemoryStoreSize": 10000,
"VaryByRemoteAddr": true,
"VaryByHeader": ""
}
},
"SqlSettings": {
"DriverName": "postgres",
"DataSource": "postgres://mattermost:[password]@localhost:5432/mattermost?sslmode=disable&connect_timeout=10",
"DataSourceReplicas": [],
"MaxIdleConns": 20,
"ConnMaxLifetimeMilliseconds": 3600000,
"MaxOpenConns": 300,
"Trace": false,
"AtRestEncryptKey": "",
"QueryTimeout": 30
},
"LogSettings": {
"EnableConsole": true,
"ConsoleLevel": "CONSOLE_LEVEL_INFO",
"EnableFile": false,
"FileLevel": "FILE_LEVEL_DEBUG",
"FileFormat": "",
"FileLocation": "",
"EnableWebhookDebugging": true,
"EnableDiagnostics": false,
"DiagnosticsSettings": {
"Enable": false
},
"EnableForwarding": false,
"ForwardingSettings": {
"Enable": false,
"Token": "",
"Url": "",
"FwdStdout": false
}
},
"FileSettings": {
"DriverName": "local",
"Directory": "/opt/mattermost/data/",
"EnablePublicLink": false,
"PublicLinkSalt": "",
"ThumbnailHeight": 0,
"ThumbnailWidth": 0,
"PreviewWidth": 0,
"PreviewHeight": 0,
"ProfileWidth": 128,
"ProfileHeight": 128,
"InitialFont": "",
"AmazonS3AccessKeyId": "",
"AmazonS3SecretAccessKey": "",
"AmazonS3Bucket": "",
"AmazonS3Region": "",
"AmazonS3Endpoint": "",
"AmazonS3SSL": false,
"AmazonS3SignV2": false,
"AmazonS3Trace": false,
"AmazonS3BucketEndpoint": "",
"AmazonS3LocationConstraint": "",
"GoogleCloudStorageBucket": "",
"GoogleCloudStorageAccessId": "",
"GoogleCloudStoragePrivateKey": "",
"GoogleCloudStorageBucketLocation": "",
"GoogleCloudStorageEndpoint": "",
"GoogleCloudStoragePathPrefix": "",
"GoogleCloudStorageTLS": false,
"GoogleCloudStorageSSE": "",
"GoogleCloudStorageChunkSize": 0,
"EnableFileAttachments": false,
"EnableMobileUpload": true,
"MobileUploadAndroid": true,
"MobileUploadiOS": true
},
"NotificationLogSettings": {
"EnableConsole": true,
"ConsoleLevel": "CONSOLE_LEVEL_INFO",
"EnableFile": false,
"FileLevel": "FILE_LEVEL_DEBUG",
"FileFormat": "",
"FileLocation": "",
"EnableWebhookDebugging": true,
"EnableDiagnostics": false,
"DiagnosticsSettings": {
"Enable": false
},
"EnableForwarding": false,
"ForwardingSettings": {
"Enable": false,
"Token": "",
"Url": "",
"FwdStdout": false
}
},
"SupportSettings": {
"TermsOfServiceLink": "",
"PrivacyPolicyLink": "",
"AboutLink": "",
"HelpLink": "",
"ReportAProblemLink": "",
"SupportEmail": "",
"EnableAskCommunityLink": false,
"EnableDeveloper": false,
"DeveloperSettings": {
"Enable": false,
"Url": "",
"EnableIncomingWebhooks": false,
"EnableOutgoingWebhooks": false,
"EnableCommands": false,
"EnableCustomIntegrations": false,
"EnableOAuthServiceProvider": false,
"AppType": "INTERNAL",
"Name": "",
"Description": "",
"IconURL": "",
"CallbackURL": ""
},
"CustomUrlSchemes": [],
"ExperimentalFeatures": {
"EnableAuthenticationTransfer": true,
"EnableClickToReply": true,
"EnableCustomEmojis": true,
"EnableEmojiPicker": true,
"EnablePostMetadata": true,
"EnableUserAccessTokens": true
}
}
}
Replace mattermost:[password]
with the correct PostgreSQL username:password
.
Press CTRL + X
, then press Y
, and hit Enter
to save and exit the config.json
file.
Create a Mattermost service unit file in the /etc/systemd/system
directory:
sudo nano /etc/systemd/system/mattermost.service
Copy and paste the following contents to the mattermost.service
file:
[Unit]
Description=Mattermost
After=syslog.target network.target postgresql.service
[Service]
Type=simple
WorkingDirectory=/opt/mattermost/bin
User=mattermost
ExecStart=/opt/mattermost/bin/platform
PIDFile=/var/run/mattermost.pid
UMask=007
Restart=always
RestartSec=10
[Install]
WantedBy=multi-user.target
Save and close the file.
Reload the systemd daemon:
sudo systemctl daemon-reload
Enable the Mattermost service to start automatically at boot time:
sudo systemctl enable mattermost
Start the Mattermost service:
sudo systemctl start mattermost
Verify that the Mattermost service is running:
sudo systemctl status mattermost
You should see the output:
● mattermost.service - Mattermost
Loaded: loaded (/etc/systemd/system/mattermost.service; enabled; vendor preset: disabled)
Active: active (running) since Mon 2022-01-10 02:12:21 UTC; 6s ago
Main PID: 9362 (platform)
Tasks: 38 (limit: 4705)
Memory: 16.9M
CGroup: /system.slice/mattermost.service
└─9362 /opt/mattermost/bin/platform
Jan 10 02:12:21 archlinux platform[9362]: {"level":"info","ts":1641807141.766981,"caller":"app/main.go:118","msg":"Starting Mattermost..."}
Jan 10 02:12:21 archlinux platform[9362]: {"level":"info","ts":1641807141.768982,"caller":"sqlstore/postgres_store.go:170","msg":"Pinging SQL store"}
Jan 10 02:12:21 archlinux platform[9362]: {"level":"info","ts":1641807141.954231,"caller":"app/server.go:264","msg":"Current version is 5.40.1 (5.40.1/Thu Dec 16 08:24:44 UTC 2021/3c88ab8ae5ca5f5d5d740878cd2c02f6b987eec2/none)","ver":"5.40.1","commit":"3c88ab8ae5ca5f5d5d740878cd2c02f6b987eec2","build_date":"Thu Dec 16 08:24:44 UTC 2021","build_number":"none"}
Access the Mattermost web interface by opening your browser and navigating to http://localhost:8065
.
In this tutorial, we have shown how to install and configure Mattermost on Arch Linux using PostgreSQL. Mattermost is a great team communication tool that can be used to enhance productivity and collaboration.
If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!
Alternatively, for the best virtual desktop, try Shells!