Matter Extreme là một nguồn mở, tự lưu trữ thay thế cho dịch vụ nhắn tin Slack SAAS. Nói cách khác, với Matter Extreme, bạn có thể thiết lập một máy chủ nhắn tin riêng và chuyên dụng trên máy của riêng bạn cho nhóm của bạn.
Điều kiện tiên quyết
Theo yêu cầu của Matter ultra, bạn cần thiết lập cơ sở dữ liệu để lưu trữ tất cả dữ liệu cho Matter Extreme. Với mục đích đó, chúng tôi sẽ cài đặt MariaDB.
Sử dụng các lệnh sau để cài đặt MariaDB 10.2.
curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash
sudo yum install MariaDB-server MariaDB-client -y
sudo systemctl start mariadb.service
sudo systemctl enable mariadb.service
Bảo mật MariaDB 10.2
sudo /usr/bin/mysql_secure_installation
Khi được nhắc, hãy trả lời các câu hỏi.
- Nhập mật khẩu hiện tại cho root (không nhập): Chỉ cần nhấn
Enternút
- Đặt mật khẩu root? [Y / n]:
Y
- Mật khẩu mới:
your-MariaDB-root-password
- Nhập lại mật khẩu mới:
your-MariaDB-root-password
- Xóa người dùng ẩn danh? [Y / n]:
Y
- Không cho phép đăng nhập root từ xa? [Y / n]:
Y
- Xóa cơ sở dữ liệu kiểm tra và truy cập vào nó? [Y / n]:
Y
- Tải lại bảng đặc quyền bây giờ? [Y / n]:
Y
Tạo cơ sở dữ liệu MariaDB cho Vật chất tối đa.
Đăng nhập vào vỏ MariaDB với quyền root.
mysql -u root -p
Trong trình bao MariaDB, nhập các câu lệnh sau.
Lưu ý: Đối với các mục đích an ninh, hãy chắc chắn để thay thế mattermost, mattermostuservà yourpasswordvới những người thân của riêng bạn.
CREATE DATABASE mattermost;
CREATE USER 'mattermostuser'@'localhost' IDENTIFIED BY 'yourpassword';
GRANT ALL PRIVILEGES ON mattermost.* TO 'mattermostuser'@'localhost' IDENTIFIED BY 'yourpassword' WITH GRANT OPTION;
FLUSH PRIVILEGES;
EXIT;
Tải xuống và trích xuất kho lưu trữ Matter Extreme 4.1.
cd
wget https://releases.mattermost.com/4.1.0/mattermost-4.1.0-linux-amd64.tar.gz
tar -zxvf mattermost-4.1.0-linux-amd64.tar.gz
Di chuyển tất cả các tệp Matter Extreme vào /optthư mục, sau đó tạo thư mục con /opt/mattermost/datađể lưu trữ dữ liệu chương trình.
sudo mv ~/mattermost /opt
sudo mkdir /opt/mattermost/data
Tạo một người dùng chuyên dụng mattermostvà một nhóm chuyên dụng mattermostđể chạy Matter ultra.
sudo useradd --system --user-group mattermost
Sửa đổi tất cả quyền sở hữu và quyền của các tệp chương trình.
sudo chown -R mattermost:mattermost /opt/mattermost
sudo chmod -R g+w /opt/mattermost
Để thiết lập máy chủ Matter Extreme hỗ trợ HTTPS, bạn cần thực hiện sửa đổi đối với configtệp Matter Extreme .
sudo vi /opt/mattermost/config/config.json
Tìm những dòng này, từng cái một.
"SiteURL": "",
"ListenAddress": ":8065",
"ConnectionSecurity": "",
"UseLetsEncrypt": false,
"Forward80To443": false,
"DataSource": "mmuser:mostest@tcp(dockerhost:3306)/mattermost_test?charset=utf8mb4,utf8&readTimeout=30s&writeTimeout=30s",
Thay thế chúng bằng các dòng dưới đây.
"SiteURL": "https://mattermost.example.com",
"ListenAddress": ":443",
"ConnectionSecurity": "TLS",
"UseLetsEncrypt": true,
"Forward80To443": true,
"DataSource": "mattermostuser:yourpassword@tcp(localhost:3306)/mattermost?charset=utf8mb4,utf8&readTimeout=30s&writeTimeout=30s",
Lưu ý: Trong DataSourcedòng, bạn cần xác định tuần tự tên người dùng cơ sở dữ liệu mattermostuser, mật khẩu tương ứng yourpassword, vị trí máy chủ cơ sở dữ liệu localhostvà tên cơ sở dữ liệu mattermost.
Make sure that the DriverName line above the DataSource line is using the default value mysql.
"DriverName": "mysql",
Save and quit.
:wq!
Allow Mattermost to bind to privileged ports, i.e. 80 and 443.
cd /opt/mattermost/bin
sudo setcap cap_net_bind_service=+ep ./platform
Manage Mattermost with systemd.
Create a Mattermost systemd unit file.
cat <<EOF | sudo tee -a /etc/systemd/system/mattermost.service
[Unit]
Description=Mattermost
After=syslog.target network.target mysqld.service
[Service]
Type=simple
WorkingDirectory=/opt/mattermost/bin
User=mattermost
ExecStart=/opt/mattermost/bin/platform
PIDFile=/var/spool/mattermost/pid/master.pid
LimitNOFILE=49152
[Install]
WantedBy=multi-user.target
EOF
Modify permissions on this systemd unit file.
sudo chmod 664 /etc/systemd/system/mattermost.service
Start the Mattermost service and make it automatically start on system boot.
sudo systemctl daemon-reload
sudo systemctl start mattermost.service
sudo systemctl enable mattermost.service
Allow access on the http and https ports.
sudo firewall-cmd --zone=public --permanent --add-service=http
sudo firewall-cmd --zone=public --permanent --add-service=https
sudo firewall-cmd --reload
Finally, point your favorite web browser to http://mattermost.example.com or https://mattermost.example.com, and you will see the Mattermost Sign Up page.
On the Mattermost Sign Up page, input an email address, a username, and a password, and then click the Create Account button to register the first user.
Note: Be aware that the first user you register will also be the system administrator.
On the Team Name page and the Team URL page, input a team name and a URL for your first team.
You have now successfully setup a Mattermost messaging server which is robust enough to serve a small- or mid-sized team in production environment. Feel free to explore the interface of Mattermost and invite more team members.