웹 분석 · 6 min read · Nov 30, 2025

Debian 11에 Matomo 웹 분석 설치하는 방법

Matomo, 이전에 Piwik으로 알려졌던 이 애플리케이션은 개발자 커뮤니티에 의해 개발된 무료 오픈 소스 웹 분석 애플리케이션입니다. 이는 귀하의 웹사이트를 추적하고 웹사이트 및 방문자에 대한 자세한 정보를 제공하는 데 사용됩니다. 여기에는 사용한 검색 엔진 및 키워드, 사용하는 언어, 선호하는 페이지, 다운로드한 파일 등이 포함됩니다. Google AdWords, Facebook Ads, Yahoo, 검색 마케팅, 추적 및 보고 API, 클릭당 비용(CPC) 등 많은 기능을 제공합니다.

이 튜토리얼에서는 Apache2 웹 서버와 무료 Let’s Encrypt SSL 인증서를 사용하여 Debian 11에 Matomo를 설치하는 방법을 보여드리겠습니다.

전제 조건

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

Apache, MariaDB 및 PHP 설치

먼저, Apache 웹 서버, MariaDB 데이터베이스 서버, PHP 및 기타 PHP 확장을 서버에 설치해야 합니다. 다음 명령어를 실행하여 모두 설치할 수 있습니다:

apt-get install apache2 mariadb-server php libapache2-mod-php php-cli php-fpm php-fpm php-json php-json php-common php-mysql php-zip php-gd php-mbstring php-curl php-xml php-pear php-bcmath curl unzip -y

모든 패키지를 설치한 후, 다음 명령어를 사용하여 Apache 및 MariaDB 서비스를 시작하고 활성화합니다:

systemctl start apache2 mariadb  
systemctl enable apache2 mariadb

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

Matomo용 MariaDB 데이터베이스 생성

Matomo는 데이터베이스 백엔드로 MariaDB를 사용합니다. 따라서 Matomo를 위한 데이터베이스와 사용자를 생성해야 합니다.

먼저, 다음 명령어로 MariaDB에 로그인합니다:

mysql

로그인한 후, 다음 명령어로 데이터베이스와 사용자를 생성합니다:

MariaDB [(none)]> CREATE DATABASE matomodb;  
MariaDB [(none)]> CREATE USER 'matomo'@'localhost' IDENTIFIED BY 'password';

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

MariaDB [(none)]> GRANT ALL ON matomodb.* TO 'matomo'@'localhost' WITH GRANT OPTION;

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

MariaDB [(none)]> FLUSH PRIVILEGES;  
MariaDB [(none)]> EXIT;

MariaDB 데이터베이스 구성이 완료되면 다음 단계로 진행할 수 있습니다.

Matomo 다운로드

다음으로, Matomo 공식 웹사이트를 방문하여 다음 명령어로 최신 버전의 Matomo를 다운로드합니다:

wget http://builds.matomo.org/matomo-latest.zip

다운로드가 완료되면, 다음 명령어로 다운로드한 파일의 압축을 풉니다:

unzip matomo-latest.zip

다음으로, 추출된 디렉토리를 Apache 웹 루트 디렉토리로 이동합니다:

mv matomo /var/www/html/matomo

다음으로, Matomo 디렉토리의 소유권과 권한을 변경합니다:

chown -R www-data:www-data /var/www/html/matomo  
chmod -R 755 /var/www/html/matomo

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

Matomo를 위한 Apache 구성

다음으로, Matomo를 인터넷에서 호스팅하기 위해 Apache 가상 호스트 구성 파일을 생성해야 합니다. 다음 명령어로 생성할 수 있습니다:

nano /etc/apache2/sites-available/matomo.conf

다음 줄을 추가합니다:



ServerAdmin [email protected]
ServerName matomo.example.com
DocumentRoot /var/www/html/matomo/


DirectoryIndex index.php
Options FollowSymLinks
AllowOverride All
Require all granted



Options None
Require all denied



Options None
Require all granted



Options None
Require all denied



Options None
Require all denied


ErrorLog ${APACHE_LOG_DIR}/matomo_error.log
CustomLog ${APACHE_LOG_DIR}/matomo_access.log combined



작업이 완료되면 파일을 저장하고 닫은 후, 다음 명령어로 Matomo 가상 호스트와 Apache 재작성 모듈을 활성화합니다:

a2ensite matomo.conf  
a2enmod rewrite

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

systemctl restart apache2

다음 명령어로 Apache 상태를 확인할 수도 있습니다:

systemctl status apache2

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

? apache2.service - The Apache HTTP Server
     Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
     Active: active (running) since Sun 2022-03-06 06:33:24 UTC; 5s ago
       Docs: https://httpd.apache.org/docs/2.4/
    Process: 55482 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
   Main PID: 55486 (apache2)
      Tasks: 6 (limit: 4679)
     Memory: 12.4M
        CPU: 108ms
     CGroup: /system.slice/apache2.service
             ??55486 /usr/sbin/apache2 -k start
             ??55487 /usr/sbin/apache2 -k start
             ??55488 /usr/sbin/apache2 -k start
             ??55489 /usr/sbin/apache2 -k start
             ??55490 /usr/sbin/apache2 -k start
             ??55491 /usr/sbin/apache2 -k start

Mar 06 06:33:24 debian11 systemd[1]: Starting The Apache HTTP Server...
Mar 06 06:33:24 debian11 apachectl[55485]: AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 209>
Mar 06 06:33:24 debian11 systemd[1]: Started The Apache HTTP Server.

Matomo 웹 UI에 접근

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

Matomo 웹 설치 프로그램

다음 버튼을 클릭합니다. PHP 구성 확인 페이지가 표시됩니다:

PHP 설정 확인

모든 구성이 올바른지 확인한 후 NEXT 버튼을 클릭합니다. MariaDB 데이터베이스 설정 페이지가 표시됩니다:

데이터베이스 설정

데이터베이스 서버, 사용자 이름, 데이터베이스 이름, 비밀번호를 제공한 후 NEXT 버튼을 클릭합니다. 다음 페이지가 표시됩니다:

데이터베이스 테이블 생성

NEXT 버튼을 클릭합니다. 슈퍼 사용자 생성 페이지가 표시됩니다:

Matomo 슈퍼 사용자

관리자 사용자 이름, 비밀번호, 이메일을 제공한 후 NEXT 버튼을 클릭합니다. 웹사이트 설정 페이지가 표시됩니다:

웹사이트 설정

웹사이트 이름, URL, 시간대를 제공한 후 NEXT 버튼을 클릭합니다. 다음 페이지가 표시됩니다:

추적 코드

NEXT 버튼을 클릭합니다. 구성 확인 페이지가 표시됩니다:

Matomo 설정

CONTINUE TO MATOMO를 클릭합니다. Matomo 로그인 페이지가 표시됩니다:

Matomo 로그인

관리자 사용자 이름, 비밀번호를 제공한 후 SIGN IN 버튼을 클릭합니다. 다음 페이지에서 Matomo 대시보드를 볼 수 있습니다. 이제 위 이미지에 표시된 추적 코드를 복사하여 웹사이트의 모든 페이지에 붙여넣을 수 있습니다.

Matomo 대시보드

Let’s Encrypt SSL로 Matomo 보안 설정

다음으로, 웹사이트에 Let’s Encrypt SSL을 설치하기 위해 Certbot 클라이언트를 설치해야 합니다. 다음 명령어로 설치할 수 있습니다:

dnf install epel-release -y dnf install certbot python3-certbot-apache

다음으로, 다음 명령어로 lets 도메인에 대한 SSL 인증서를 얻고 설치합니다:

certbot --apache -d matomo.example.com

이메일 주소를 제공하고 서비스 약관에 동의하라는 메시지가 표시됩니다:

Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator apache, Installer apache
Enter email address (used for urgent renewal and security notices)
 (Enter 'c' to cancel): [email protected]

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
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.
Requesting a certificate for matomo.example.com
Performing the following challenges:
http-01 challenge for matomo.example.com
Waiting for verification...
Cleaning up challenges
Deploying Certificate to VirtualHost /etc/httpd/conf.d/matomo.conf
Redirecting all traffic on port 80 to ssl in /etc/httpd/conf.d/matomo.conf

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Congratulations! You have successfully enabled https://matomo.example.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Subscribe to the EFF mailing list (email: [email protected]).


IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/matomo.example.com/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/matomo.example.com/privkey.pem
   Your certificate will expire on 2022-05-09. To obtain a new or
   tweaked version of this certificate in the future, simply run
   certbot again with the "certonly" option. To non-interactively
   renew *all* of your certificates, run "certbot renew"
 - 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

결론

축하합니다! Debian 11에 Matomo를 성공적으로 설치했습니다. 이제 웹사이트에 추적 코드를 추가하고 Matomo 대시보드에서 모니터링을 시작할 수 있습니다. 질문이 있으면 언제든지 문의해 주세요.

Share: X/Twitter LinkedIn

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

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