웹사이트 검색

Debian 12(Bookworm)에 Mattermost 서버 배포


Debian 12(Bookworm)에 Mattermost Server를 배포하는 방법에 대한 자세한 가이드에 오신 것을 환영합니다. 하지만 그 전에 Mattermost가 무엇인지 알아야 합니다.

Mattermost는 전 세계 대부분의 기술 및 운영 팀이 선호하는 오픈 소스 공동작업 소프트웨어입니다. 이는 국가 수준의 보안 및 신뢰 요구 사항이 복잡한 환경에서 작업하는 다수의 동시 사용자를 위해 설계되었습니다. Mattermost를 사용하면 채팅, 음성 및 영상 통화를 통해 개인 간의 커뮤니케이션을 쉽게 설정할 수 있습니다. Mattermost의 인기 있는 경쟁자로는 MS Teams와 Slack이 있습니다.

다른 도구보다 선호되는 이유는 그것이 제공하는 멋진 기능입니다. 여기에는 다음이 포함됩니다.

  • 완전히 확장 가능하며 타사 통합을 지원합니다.
  • 사고를 신속하고 시간을 절약해 주는 사고 해결
  • 문서 저장 지원
  • 크로스 플랫폼이며 Windows, Android, Linux 및 Mac 운영 체제에서 실행할 수 있습니다.
  • 데이터 가져오기 및 내보내기 지원
  • 드래그 앤 드롭 기능 제공
  • 애플리케이션 및 네트워크 성능 모니터링을 제공합니다.
  • 워크플로우 관리 및 오케스트레이션을 제공합니다.
  • 경고/알림을 제공합니다.

설치 요구 사항

이 가이드를 위해서는 다음이 필요합니다.

  • Debian 12(Bookworm), vCPU/코어 1개, 2GB RAM(최대 1,000명의 사용자 지원)
  • 데이터베이스 서버: PostgreSQL v11+
  • sudo 권한이 있는 사용자입니다.
  • 정규화된 도메인 이름(SSL 인증서의 경우 선택 사항)

Debian 12(Bookworm)에 Mattermost 서버를 배포하려면 아래 단계를 따르세요.

1단계: PostgreSQL 데이터베이스 서버 설치

가장 먼저 해야 할 일은 데이터베이스 서버가 Mattermost용으로 설정되어 있는지 확인하는 것입니다. Mattermost에 권장되는 데이터베이스 서버는 PostgreSQL v11 이상입니다.

설치하려면 다음 명령을 사용하십시오.

sudo apt update
sudo apt install postgresql postgresql-contrib -y

서비스가 실행 중인지 확인합니다.

$ systemctl status postgresql
● postgresql.service - PostgreSQL RDBMS
     Loaded: loaded (/lib/systemd/system/postgresql.service; enabled; preset: enabled)
     Active: active (exited) since Mon 2023-08-14 03:49:03 EDT; 29s ago
   Main PID: 63061 (code=exited, status=0/SUCCESS)
        CPU: 1ms

시스템 부팅 시 서비스가 실행되도록 활성화되어 있는지 확인하세요.

sudo systemctl enable postgresql

다음 명령을 사용하여 셸에 액세스합니다.

sudo -u postgres psql

Matermost에 대한 데이터베이스 및 사용자를 생성합니다.

CREATE USER mmuser WITH PASSWORD 'P@ssw0rd!';
CREATE DATABASE mattermost OWNER mmuser;
\q

2단계: Mattermost 서버 설치

데이터베이스 서버가 설치 및 구성되면 Mattermost Server를 다운로드해야 합니다. 공식 Mattermost 다운로드 페이지에서 최신 버전을 다운로드하세요.

사용 가능한 최신 Tarball을 다운로드하십시오. 필요한 버전을 내보내면 됩니다.

VER=8.0.1

다음을 사용하여 아카이브를 가져옵니다.

wget https://releases.mattermost.com/$VER/mattermost-$VER-linux-amd64.tar.gz

다운로드한 후 아카이브를 추출합니다.

tar -xvzf mattermost*.tar.gz

파일을 /opt 디렉터리로 이동합니다.

sudo mv mattermost /opt

다음은 데이터를 유지하기 위한 저장소 디렉터리를 만드는 것입니다.

sudo mkdir /opt/mattermost/data

Mattermost 전용 사용자 및 그룹을 생성합니다.

sudo useradd --system --user-group mattermost

디렉터리에 필요한 권한을 설정합니다.

sudo chown -R mattermost:mattermost /opt/mattermost
sudo chmod -R g+w /opt/mattermost

이제 Mattermost를 구성하겠습니다.

sudo vim /opt/mattermost/config/config.json 

파일에서 Sqlsettings 섹션에 표시된 대로 데이터베이스 자격 증명을 추가합니다. 생성된 사용자, 비밀번호 및 데이터베이스 이름을 제공해야 합니다.

"SqlSettings": {
    "DriverName": "postgres",
    "DataSource": "postgres://mmuser:P@ssw0rd!@localhost/mattermost?sslmode=disable&connect_timeout=10&binary_parameters=yes",
    "DataSourceReplicas": [],
    "DataSourceSearchReplicas": [],
    "MaxIdleConns": 20,
    "ConnMaxLifetimeMilliseconds": 3600000,
    "ConnMaxIdleTimeMilliseconds": 300000,
    "MaxOpenConns": 300,
    "Trace": false,
    "AtRestEncryptKey": "",
    "QueryTimeout": 30,
    "DisableDatabaseSearch": false,
.........
  },

변경 사항을 저장하고 모두 괜찮은지 테스트합니다.

cd /opt/mattermost
sudo -u mattermost bin/mattermost

샘플 출력:

.......
{"timestamp":"2023-08-14 04:02:16.315 -04:00","level":"info","msg":"rtc: server is listening on udp 127.0.0.1:8443","caller":"app/plugin_api.go:973","plugin_id":"com.mattermost.calls","origin":"main.(*logger).Info log.go:95"}
{"timestamp":"2023-08-14 04:02:16.316 -04:00","level":"info","msg":"rtc: server is listening on udp 192.168.200.56:8443","caller":"app/plugin_api.go:973","plugin_id":"com.mattermost.calls","origin":"main.(*logger).Info log.go:95"}
{"timestamp":"2023-08-14 04:02:16.317 -04:00","level":"info","msg":"rtc: server is listening on udp 192.168.200.175:8443","caller":"app/plugin_api.go:973","plugin_id":"com.mattermost.calls","origin":"main.(*logger).Info log.go:95"}
{"timestamp":"2023-08-14 04:02:16.317 -04:00","level":"info","msg":"rtc: server is listening on udp 10.244.2.1:8443","caller":"app/plugin_api.go:973","plugin_id":"com.mattermost.calls","origin":"main.(*logger).Info log.go:95"}
{"timestamp":"2023-08-14 04:02:16.318 -04:00","level":"info","msg":"Listening TCP on 0.0.0.0:8443","caller":"app/plugin_api.go:973","plugin_id":"com.mattermost.calls","origin":"main.(*logger).Info log.go:95"}
{"timestamp":"2023-08-14 04:02:16.334 -04:00","level":"info","msg":"Starting Server...","caller":"app/server.go:912"}
{"timestamp":"2023-08-14 04:02:16.334 -04:00","level":"info","msg":"Server is listening on [::]:8065","caller":"app/server.go:988","address":"[::]:8065"}

이는 Mattermost가 작동하고 포트 8065(기본 포트)에서 연결을 수신하고 있음을 보여줍니다. 서비스를 중지하려면 Ctrl+C를 누른 후 다음 명령을 실행하세요.

sudo killall -9 mattermost

3단계: Mattermost Systemd 장치 생성

systemd를 사용하여 Mattermost 서비스를 관리하려면 서비스 파일을 생성해야 합니다.

cat <<EOF | sudo tee /lib/systemd/system/mattermost.service 
[Unit]
Description=Mattermost
After=network.target

[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
EOF

다음 명령을 사용하여 systemd를 다시 로드합니다.

sudo systemctl daemon-reload

서비스를 시작하고 활성화합니다.

sudo systemctl start mattermost.service
sudo systemctl enable mattermost.service

서비스 상태를 확인하세요.

$ systemctl status mattermost.service 
●mattermost.service - Mattermost
     Loaded: loaded (/lib/systemd/system/mattermost.service; enabled; preset: enabled)
     Active: active (running) since Mon 2023-08-14 04:07:42 EDT; 10s ago
   Main PID: 63819 (mattermost)
      Tasks: 26 (limit: 4623)
     Memory: 290.0M
        CPU: 6.237s
     CGroup: /system.slice/mattermost.service
             ├─63819 /opt/mattermost/bin/mattermost
             ├─63833 plugins/com.mattermost.nps/server/dist/plugin-linux-amd64
             ├─63843 plugins/com.mattermost.calls/server/dist/plugin-linux-amd64
             └─63849 plugins/playbooks/server/dist/plugin-linux-amd64

방화벽이 활성화된 경우 방화벽을 통해 포트를 허용하십시오.

sudo ufw allow 8065

4단계: Mattermost 웹 인터페이스에 액세스

이제 Mattermost가 설치 및 시작되었으므로 URL http://IP_Address:8065 또는 http://domain_name:8065를 사용하여 웹 인터페이스에 액세스할 수 있습니다.

데스크탑 앱을 사용하거나 웹 인터페이스를 계속 사용할 수 있습니다. 여기서는 웹 UI를 진행하겠습니다. 필요한 세부 정보를 제공하여 사용자 계정을 만듭니다.

조직 이름 설정

귀하의 환경에서 사용하는 도구를 선택하십시오.

팀에 구성원을 초대할 수 있는 링크가 제공됩니다.

그게 다야! 이제 Mattermost를 사용할 준비가 되었습니다.

5단계: Let’s Encrypt로 Mattermost를 보호하세요

SSL 인증서로 Mattermost를 보호하는 방법에는 두 가지가 있습니다. 이것들은:

  • Mattermost 서버에서 TLS를 설정합니다.
  • NGINX와 같은 프록시를 사용하고 프록시에 TLS를 설정하세요.

이 가이드에서는 더 나은 성능을 위해 사용자가 200명 이상인 경우 권장되는 프록시를 사용합니다. 이 방법은 표준 HTTP 요청 로그도 제공합니다.

다음 명령을 사용하여 Debian 12에 Nginx 프록시를 설치합니다.

sudo apt install nginx -y

설치가 완료되면 가상 호스트 파일을 구성합니다.

sudo vim /etc/nginx/conf.d/mattermost.conf

파일에 아래 줄을 추가합니다.

    server {
        listen       80 default_server;
        listen       [::]:80 default_server;
        server_name  mattermost.computingforgeeks.com;

        location / {
	proxy_pass http://localhost:8065/;
            index  index.html index.htm;
        }

        error_page 404 /404.html;
            location = /40x.html {
        }

        error_page 500 502 503 504 /50x.html;
            location = /50x.html {
        }
    }

기본 nginx 사이트를 비활성화합니다.

sudo rm -rf /etc/nginx/sites-enabled/default

파일을 저장하고 nginx를 다시 시작합니다.

sudo systemctl restart nginx

가상 호스트가 생성되면 Let’s Encrypt로 인증서를 생성하는 데 필요한 도구를 설치합니다.

sudo apt install certbot python3-certbot-nginx

가상 호스트 파일에 캡처된 도메인 이름에 대해 신뢰할 수 있는 SSL 인증서를 발급합니다.

sudo certbot --nginx

표시된 대로 진행하세요.

Saving debug log to /var/log/letsencrypt/letsencrypt.log
Enter email address (used for urgent renewal and security notices)
 (Enter 'c' to cancel): Enter a valid Email address here          

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Please read the Terms of Service at
https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf. You must
agree in order to register with the ACME server. Do you agree?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Y)es/(N)o: y

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Would you be willing, once your first certificate is successfully issued, to
share your email address with the Electronic Frontier Foundation, a founding
partner of the Let's Encrypt project and the non-profit organization that
develops Certbot? We'd like to send you email about our work encrypting the web,
EFF news, campaigns, and ways to support digital freedom.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Y)es/(N)o: y
Account registered.

Which names would you like to activate HTTPS for?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: mattermost.computingforgeeks.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate numbers separated by commas and/or spaces, or leave input
blank to select all options shown (Enter 'c' to cancel): 1

Requesting a certificate for mattermost.computingforgeeks.com
Performing the following challenges:
http-01 challenge for mattermost.computingforgeeks.com
Waiting for verification...
Cleaning up challenges
Deploying Certificate to VirtualHost /etc/nginx/conf.d/mattermost.conf
Redirecting all traffic on port 80 to ssl in /etc/nginx/conf.d/mattermost.conf

Successfully received certificate.
Certificate is saved at: a2enmod ssl
/etc/letsencrypt/live/mattermost.computingforgeeks.com/fullchain.pem
Key is saved at:         /etc/letsencrypt/live/mattermost.computingforgeeks.com/privkey.pem
This certificate expires on 2022-01-09.
These files will be updated when the certificate renews.
Certbot has set up a scheduled task to automatically renew this certificate in the background.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
If you like Certbot, please consider supporting our work by:
 * Donating to ISRG / Let's Encrypt:   https://letsencrypt.org/donate
 * Donating to EFF:                    https://eff.org/donate-le
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

SSL 인증서가 conf 파일에 자동으로 추가됩니다. 방화벽을 통해 HTTPS를 허용합니다.

sudo ufw allow 443

서비스를 다시 시작합니다.

sudo systemctl restart nginx

이제 https://domain_name URL을 사용하여 HTTPS를 통해 서비스에 액세스하세요.

6단계: Mattermost Desktop 설치 및 사용

Mattermost는 두 가지 액세스 방법을 제공합니다. 데스크톱 앱을 설치하고 사용할 수도 있습니다. Mattermost 데스크톱 앱 페이지에 캡처된 다양한 운영 체제용 데스크톱 앱이 있습니다. 이 가이드에서는 Linux 시스템에 앱을 다운로드하고 설치하는 방법을 보여 드리겠습니다.

명령을 사용하여 Mattermost 데스크탑 설치

  • Debian/Ubuntu에서
curl -o- https://deb.packages.mattermost.com/setup-repo.sh | sudo bash
sudo apt update && sudo apt  install mattermost-desktop -y
  • RHEL/CentOS/Rocky Linux에서는 최신 RPM 패키지를 다운로드해야 합니다.

RPM 버전을 내보냅니다.

VER=5.4.0

RPM 패키지를 가져와 설치합니다.

##For 64-bit
wget https://releases.mattermost.com/desktop/$VER/mattermost-desktop-$VER-linux-x86_64.rpm
sudo rpm -u mattermost-desktop-$VER-linux-x86_64.rpm

##For 32-Bit
wget https://releases.mattermost.com/desktop/$VER/mattermost-desktop-$VER-linux-i686.rpm
sudo rpm -u mattermost-desktop-$VER-linux-i686.rpm

설치가 완료되면 앱 메뉴에서 데스크톱 앱을 실행하세요.

서버 URL(HTTPS 권장)과 표시 이름을 제공하여 Mattermost 서버에 연결하세요.

서버에 로그인하세요.

연결되면 이런 모습이 뜹니다.

짜잔!

우리는 Debian 12(Bookworm)에 Mattermost Server를 배포하는 방법을 성공적으로 살펴보았습니다. 이것이 당신에게 매우 중요했기를 바랍니다.

우리 페이지에서 더 많은 내용을 확인하세요:

  • Kubernetes 클러스터에 Mattermost 설치 및 구성
  • Docker 컨테이너에서 Mattermost 서버를 실행하는 방법
  • CentOS 8|RHEL 8에 Mattermost 서버 설치
  • Ubuntu 22.04|20.04|18.04에 Mattermost 서버 설치

관련기사: