설치 가이드 · 5 min read · Oct 12, 2025

Debian 11에 Mattermost 설치하는 방법

Mattermost는 보안을 염두에 두고 만들어진 무료 오픈 소스 협업 및 메시징 플랫폼입니다. Discord 또는 Slack의 대안으로, 일대일 메시징, 무제한 검색 기록 및 파일 공유 기능, 이중 인증 및 알림 등 많은 유용한 기능을 제공합니다. Golang과 React로 작성된 자가 호스팅 온라인 채팅 서비스입니다. 조직과 기업을 위해 특별히 설계되었으며 팀이 어디에서나 안전하게 소통할 수 있도록 합니다.

이 튜토리얼에서는 Debian 11에 Mattermost 채팅 서버를 설치하는 방법을 보여드리겠습니다.

전제 조건

  • Debian 11이 실행되는 서버.
  • 서버 IP가 지정된 유효한 도메인 이름.
  • 서버에 구성된 루트 비밀번호.

MariaDB 데이터베이스 서버 설치 및 구성

Mattermost는 MySQL 또는 MariaDB를 데이터베이스 백엔드로 사용합니다. 따라서 서버에 MariaDB 서버를 설치해야 합니다. 다음 명령어를 사용하여 설치할 수 있습니다:

apt-get install mariadb-server -y

MariaDB가 설치되면 MariaDB 서비스를 시작하고 시스템 재부팅 시 시작되도록 설정합니다:

systemctl start mariadb  
systemctl enable mariadb

다음으로, 다음 명령어를 사용하여 MariaDB 셸에 연결합니다:

mysql

연결되면 다음 명령어를 사용하여 데이터베이스와 사용자를 생성합니다:

MariaDB [(none)]> create database mattermost;  
MariaDB [(none)]> create user mattermost@localhost identified by 'password';

다음으로, 다음 명령어를 사용하여 Mattermost 데이터베이스에 모든 권한을 부여합니다:

MariaDB [(none)]> grant all privileges on mattermost.* to mattermost@localhost;

다음으로, 권한을 플러시하고 다음 명령어로 MariaDB 셸에서 종료합니다:

MariaDB [(none)]> flush privileges;  
MariaDB [(none)]> exit;

작업이 완료되면 다음 단계로 진행할 수 있습니다.

Mattermost 설치

먼저, 다음 명령어를 사용하여 Mattermost 전용 사용자를 생성합니다:

useradd --system --user-group mattermost

다음으로, 다음 명령어를 사용하여 Mattermost의 최신 버전을 다운로드합니다:

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

다운로드가 완료되면 다음 명령어를 사용하여 다운로드한 파일을 추출합니다:

tar -xvzf mattermost-6.0.2-linux-amd64.tar.gz

다음으로, 추출된 디렉토리를 /opt로 이동합니다:

mv mattermost /opt

다음으로, 다음 명령어를 사용하여 Mattermost의 데이터 디렉토리를 생성합니다:

mkdir /opt/mattermost/data

다음으로, 다음 명령어를 사용하여 Mattermost 디렉토리의 소유권을 변경합니다:

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

다음으로, 다음 명령어를 사용하여 config.json 파일을 편집합니다:

nano /opt/mattermost/config/config.json

다음 줄을 찾습니다:

    "DriverName": "postgres",
    "DataSource": "postgres://mmuser:mostest@localhost/mattermost_test?sslmode=disable\u0026connect_timeout=10",

그리고 데이터베이스 설정에 따라 다음 줄로 교체합니다:

"DriverName": "mysql",
"DataSource": "mattermost:password@tcp(127.0.0.1:3306)/mattermost?charset=utf8mb4,utf8\u0026readTimeout=30s\u0026writeTimeout=30s",

작업이 완료되면 파일을 저장하고 닫습니다.

Mattermost용 Systemd 서비스 파일 생성

다음으로, Mattermost용 systemd 서비스 파일을 생성해야 합니다. 다음 명령어를 사용하여 생성할 수 있습니다:

nano /etc/systemd/system/mattermost.service

다음 줄을 추가합니다:

[Unit]
Description=Mattermost
After=syslog.target network.target mysqld.service

[Service]
Type=notify
WorkingDirectory=/opt/mattermost
User=mattermost
ExecStart=/opt/mattermost/bin/mattermost
PIDFile=/var/spool/mattermost/pid/master.pid
TimeoutStartSec=3600
LimitNOFILE=49152

[Install]
WantedBy=multi-user.target

파일을 저장하고 닫은 후, 다음 명령어로 systemd 데몬을 다시 로드하여 변경 사항을 적용합니다:

systemctl daemon-reload

다음으로, Mattermost를 시작하고 시스템 재부팅 시 시작되도록 설정합니다:

systemctl start mattermost  
systemctl enable mattermost

다음으로, 다음 명령어로 Mattermost의 상태를 확인합니다:

systemctl status mattermost

다음과 같은 출력을 얻을 수 있습니다:

? mattermost.service - Mattermost
     Loaded: loaded (/etc/systemd/system/mattermost.service; disabled; vendor preset: enabled)
     Active: active (running) since Fri 2021-11-12 13:56:25 UTC; 4s ago
   Main PID: 2888 (mattermost)
      Tasks: 31 (limit: 4679)
     Memory: 273.3M
        CPU: 12.191s
     CGroup: /system.slice/mattermost.service
             ??2888 /opt/mattermost/bin/mattermost
             ??2915 plugins/com.mattermost.plugin-channel-export/server/dist/plugin-linux-amd64
             ??2925 plugins/playbooks/server/dist/plugin-linux-amd64
             ??2931 plugins/focalboard/server/dist/plugin-linux-amd64

Nov 12 13:56:24 debian11 mattermost[2888]: {"timestamp":"2021-11-12 13:56:24.681 Z","level":"info","msg":"Scheduling next survey for Dec 3, 2>
Nov 12 13:56:25 debian11 mattermost[2888]: {"timestamp":"2021-11-12 13:56:25.064 Z","level":"info","msg":"Post.Message has size restrictions">
Nov 12 13:56:25 debian11 mattermost[2888]: {"timestamp":"2021-11-12 13:56:25.084 Z","level":"info","msg":"info [2021-11-12 13:56:25.083 Z] co>
Nov 12 13:56:25 debian11 mattermost[2888]: {"timestamp":"2021-11-12 13:56:25.131 Z","level":"info","msg":"\n    -- collation of mattermost's >
Nov 12 13:56:25 debian11 mattermost[2888]: {"timestamp":"2021-11-12 13:56:25.491 Z","level":"info","msg":"debug [2021-11-12 13:56:25.488 Z] i>
Nov 12 13:56:25 debian11 mattermost[2888]: {"timestamp":"2021-11-12 13:56:25.777 Z","level":"info","msg":"info [2021-11-12 13:56:25.777 Z] Se>
Nov 12 13:56:25 debian11 mattermost[2888]: {"timestamp":"2021-11-12 13:56:25.963 Z","level":"info","msg":"Starting Server...","caller":"app/s>
Nov 12 13:56:25 debian11 mattermost[2888]: {"timestamp":"2021-11-12 13:56:25.964 Z","level":"info","msg":"Server is listening on [::]:8065",">
Nov 12 13:56:25 debian11 mattermost[2888]: {"timestamp":"2021-11-12 13:56:25.964 Z","level":"info","msg":"Sending systemd READY notification.>
Nov 12 13:56:25 debian11 systemd[1]: Started Mattermost.

Mattermost용 Nginx를 리버스 프록시로 구성

기본적으로 Mattermost는 포트 8065에서 수신 대기합니다. 따라서 Mattermost에 포트 80으로 접근하기 위해 Nginx를 리버스 프록시로 설치하고 구성하는 것이 좋습니다. 먼저, 다음 명령어로 Nginx를 설치합니다:

apt-get install nginx -y

Nginx가 설치되면 다음 명령어로 Nginx 가상 호스트 구성 파일을 생성합니다:

nano /etc/nginx/conf.d/mattermost.conf

다음 줄을 추가합니다:

upstream mattermost {
   server localhost:8065;
   keepalive 32;
}

proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=mattermost_cache:10m max_size=3g inactive=120m use_temp_path=off;

server {
   listen 80;
   server_name mattermost.example.com;

   location ~ /api/v[0-9]+/(users/)?websocket$ {
       proxy_set_header Upgrade $http_upgrade;
       proxy_set_header Connection "upgrade";
       client_max_body_size 50M;
       proxy_set_header Host $http_host;
       proxy_set_header X-Real-IP $remote_addr;
       proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
       proxy_set_header X-Forwarded-Proto $scheme;
       proxy_set_header X-Frame-Options SAMEORIGIN;
       proxy_buffers 256 16k;
       proxy_buffer_size 16k;
       client_body_timeout 60;
       send_timeout 300;
       lingering_timeout 5;
       proxy_connect_timeout 90;
       proxy_send_timeout 300;
       proxy_read_timeout 90s;
       proxy_pass http://mattermost;
   }

   location / {
       client_max_body_size 50M;
       proxy_set_header Connection "";
       proxy_set_header Host $http_host;
       proxy_set_header X-Real-IP $remote_addr;
       proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
       proxy_set_header X-Forwarded-Proto $scheme;
       proxy_set_header X-Frame-Options SAMEORIGIN;
       proxy_buffers 256 16k;
       proxy_buffer_size 16k;
       proxy_read_timeout 600s;
       proxy_cache mattermost_cache;
       proxy_cache_revalidate on;
       proxy_cache_min_uses 2;
       proxy_cache_use_stale timeout;
       proxy_cache_lock on;
       proxy_http_version 1.1;
       proxy_pass http://mattermost;
   }
}

파일을 저장하고 닫은 후, 다음 명령어로 Nginx 구성의 구문 오류를 확인합니다:

ginx -t

다음과 같은 출력을 보게 될 것입니다:

ginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

다음으로, 다음 명령어로 Nginx 서비스를 시작하여 변경 사항을 적용합니다:

systemctl start nginx

다음 명령어를 사용하여 Nginx의 상태를 확인할 수도 있습니다:

systemctl status nginx

다음과 같은 출력을 얻을 수 있습니다:

? nginx.service - A high performance web server and a reverse proxy server
     Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
     Active: active (running) since Fri 2021-11-12 13:57:02 UTC; 1min 12s ago
       Docs: man:nginx(8)
    Process: 3384 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
    Process: 3392 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
   Main PID: 3602 (nginx)
      Tasks: 3 (limit: 4679)
     Memory: 6.6M
        CPU: 55ms
     CGroup: /system.slice/nginx.service
             ??3602 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
             ??3604 nginx: worker process
             ??3605 nginx: worker process

Nov 12 13:57:01 debian11 systemd[1]: Starting A high performance web server and a reverse proxy server...
Nov 12 13:57:02 debian11 systemd[1]: nginx.service: Failed to parse PID from file /run/nginx.pid: Invalid argument
Nov 12 13:57:02 debian11 systemd[1]: Started A high performance web server and a reverse proxy server.

이 시점에서 Nginx가 설치되고 Mattermost의 리버스 프록시로 구성되었습니다. 이제 다음 단계로 진행할 수 있습니다.

Mattermost 웹 인터페이스 접근

이제 웹 브라우저를 열고 URL http://mattermost.example.com을 사용하여 Mattermost 웹 인터페이스에 접근합니다. 다음 페이지로 리디렉션됩니다:

Mattermost 로그인

관리자 이메일 주소, 사용자 이름, 비밀번호를 입력하고 계정 생성 버튼을 클릭합니다. 다음 페이지가 표시됩니다:

Mattermost

이제 시스템 콘솔로 이동을 클릭합니다. 다음과 같이 Mattermost 대시보드로 리디렉션됩니다:

Mattermost 대시보드

결론

축하합니다! Debian 11에 Nginx를 리버스 프록시로 사용하여 Mattermost를 성공적으로 설치했습니다. 이제 조직에서 Mattermost를 구현하고 팀이 어디에서나 서로 소통할 수 있도록 할 수 있습니다.

Share: X/Twitter LinkedIn

새 게시물을 받은 편지함에서 받기

스팸은 없습니다. 언제든지 구독 해지 가능합니다.