웹사이트 검색

Ubuntu 22.04에 DokuWiki를 설치하는 방법


이 튜토리얼은 다음 OS 버전에 대해 존재합니다.

  • Ubuntu 22.04(Jammy Jellyfish)
  • Ubuntu 18.04(Bionic Beaver)

이 페이지에서

  1. 전제 조건
  2. Apache 및 PHP 설치
  3. DokuWiki Ubuntu 22.04 설치
  4. DokuWiki용 Apache 가상 호스트 만들기\n
  5. DokuWiki 웹사이트에서 SSL 활성화\n
  6. DokuWiki에 액세스
  7. 자동 갱신 설정
  8. 결론

DokuWiki는 PHP로 작성된 간단하고 사용하기 쉬우며 다재다능한 위키 소프트웨어입니다. 무료이며 오픈 소스이며 데이터베이스 시스템을 사용하는 대신 간단한 파일 형식을 사용하여 데이터를 저장합니다. 위키 사이트를 쉽게 확장하고 최적화하는 데 도움이 되는 많은 기능을 제공합니다. 깨끗하고 읽기 쉬운 구문으로 인해 인기를 얻고 있습니다. Dokuwiki를 사용하면 Dokuwiki 웹 패널을 통해 개인 또는 비즈니스 웹사이트를 만들 수 있습니다.

이 튜토리얼에서는 Ubuntu 22.04에서 Apache 및 Lets Encrypt SSL 인증서와 함께 DokuWiki를 설치하는 방법을 보여줍니다.

전제 조건

  • Ubuntu 22.04를 실행하는 서버.\n
  • 유효한 도메인 이름이 서버를 가리킵니다.\n
  • 서버에 루트 암호가 구성되어 있습니다.\n

아파치와 PHP 설치

먼저 시스템에 Apache 웹 서버, PHP 및 기타 PHP 라이브러리를 설치해야 합니다. 다음 명령을 실행하여 모두 설치할 수 있습니다.

apt-get install apache2 php php-gd php-xml php-json -y

모든 패키지를 설치한 후 Apache 서비스를 시작하고 다음 명령을 사용하여 부팅 시 시작되도록 활성화합니다.

systemctl start apache2
systemctl enable apache2

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

DokuWiki 우분투 22.04 설치

다음으로 DokuWiki 공식 다운로드 페이지를 방문하여 다운로드 URL을 복사하고 다음 명령을 사용하여 최신 버전의 DokuWiki를 다운로드합니다.

wget https://download.dokuwiki.org/out/dokuwiki-24117f7f9e0362c4b1782ff29220b0ab.tgz

다운로드가 완료되면 Apache 웹 루트 디렉터리 내에 DokuWiki 디렉터리를 만들고 DokuWiki를 추출합니다.

mkdir /var/www/html/dokuwiki
tar -xvzf dokuwiki-24117f7f9e0362c4b1782ff29220b0ab.tgz -C /var/www/html/dokuwiki/ --strip-components=1

그런 다음 다음 명령을 사용하여 샘플 .htaccess 파일을 복사합니다.

cp /var/www/html/dokuwiki/.htaccess{.dist,}

다음으로 dokuwiki의 소유권을 www-data로 변경합니다.

chown -R www-data:www-data /var/www/html/dokuwiki

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

DokuWiki용 Apache 가상 호스트 만들기

다음으로 DokuWiki 웹사이트를 제공하기 위해 Apache 가상 호스트 구성 파일을 생성해야 합니다. 다음 명령으로 만들 수 있습니다.

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

다음 줄을 추가합니다.

<VirtualHost *:80>
        ServerName    doku.example.com      
        DocumentRoot  /var/www/html/dokuwiki

        <Directory ~ "/var/www/html/dokuwiki/(bin/|conf/|data/|inc/)">
            <IfModule mod_authz_core.c>
                AllowOverride All
                Require all denied
            </IfModule>
            <IfModule !mod_authz_core.c>
                Order allow,deny
                Deny from all
            </IfModule>
        </Directory>

        ErrorLog   /var/log/apache2/dokuwiki_error.log
        CustomLog  /var/log/apache2/dokuwiki_access.log combined
</VirtualHost>

완료되면 파일을 저장하고 닫습니다. 그런 다음 DokuWiki 가상 호스트 구성 파일을 활성화하고 다음 명령을 사용하여 Apache 서비스를 다시 로드합니다.

a2ensite dokuwiki.conf
systemctl reload 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 Sat 2022-06-25 15:44:31 UTC; 4min 30s ago
       Docs: https://httpd.apache.org/docs/2.4/
    Process: 52450 ExecReload=/usr/sbin/apachectl graceful (code=exited, status=0/SUCCESS)
   Main PID: 52131 (apache2)
      Tasks: 6 (limit: 4579)
     Memory: 16.9M
        CPU: 331ms
     CGroup: /system.slice/apache2.service
             ??52131 /usr/sbin/apache2 -k start
             ??52454 /usr/sbin/apache2 -k start
             ??52455 /usr/sbin/apache2 -k start
             ??52456 /usr/sbin/apache2 -k start
             ??52457 /usr/sbin/apache2 -k start
             ??52458 /usr/sbin/apache2 -k start

Jun 25 15:44:30 ubuntu2204 systemd[1]: Starting The Apache HTTP Server...

이 시점에서 Apache 웹 서버는 DokuWiki 사이트를 제공하도록 구성됩니다. 이제 웹 사이트에 Lets Encrypt SSL 설치를 진행할 수 있습니다.

DokuWiki 웹사이트에서 SSL 활성화

DokuWiki에서 SSL을 활성화하려면 시스템에 Certbot 클라이언트를 설치해야 합니다. Certbot은 SSL을 다운로드하고 관리하는 데 사용되는 Lets Encrypt 도구입니다.

다음 명령을 사용하여 Certbot을 설치할 수 있습니다.

apt-get install certbot python3-certbot-apache -y

설치가 완료되면 다음 명령을 실행하여 웹사이트에 Lets Encrypt SSL을 설치합니다.

certbot --apache -d dokuwiki.linuxbuz.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): 

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
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 at
https://acme-v02.api.letsencrypt.org/directory
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(A)gree/(C)ancel: A

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Would you be willing 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

Obtaining a new certificate
Performing the following challenges:
http-01 challenge for dokuwiki.linuxbuz.com
Enabled Apache rewrite module
Waiting for verification...
Cleaning up challenges
Created an SSL vhost at /etc/apache2/sites-available/dokuwiki-le-ssl.conf
Enabled Apache socache_shmcb module
Enabled Apache ssl module
Deploying Certificate to VirtualHost /etc/apache2/sites-available/dokuwiki-le-ssl.conf
Enabling available site: /etc/apache2/sites-available/dokuwiki-le-ssl.conf

다음으로 아래와 같이 HTTP 트래픽을 HTTPS로 리디렉션할지 여부를 선택합니다.

Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: No redirect - Make no further changes to the webserver configuration.
2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for
new sites, or if you're confident your site works on HTTPS. You can undo this
change by editing your web server's configuration.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 2

2를 입력하고 Enter 키를 눌러 프로세스를 시작합니다. 설치가 완료되면 다음과 같은 결과가 표시되어야 합니다.

Enabled Apache rewrite module
Redirecting vhost in /etc/apache2/sites-enabled/dokuwiki.conf to ssl vhost in /etc/apache2/sites-available/dokuwiki-le-ssl.conf

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Congratulations! You have successfully enabled https://dokuwiki.linuxbuz.com

You should test your configuration at:
https://www.ssllabs.com/ssltest/analyze.html?d=dokuwiki.linuxbuz.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/dokuwiki.linuxbuz.com/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/dokuwiki.linuxbuz.com/privkey.pem
   Your cert will expire on 2020-09-05. 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

이 시점에서 Dokuwiki 사이트는 Lets Encrypt SSL로 보호됩니다.

DokuWiki에 액세스

이제 웹 브라우저를 열고 URL https://dokuwiki.linuxbuz.com/install.php를 입력하십시오. DokuWiki 설치 화면이 나타납니다:

위키 이름, 관리자 사용자 이름, 비밀번호, 이메일을 제공하고 정책을 선택한 다음 저장 버튼을 클릭합니다. 다음 페이지로 리디렉션됩니다.

"새로운 DokuWiki"를 클릭하세요. 다음 화면이 표시됩니다.

로그인 버튼을 클릭합니다. 아래와 같이 DokuWiki 로그인 화면으로 리디렉션됩니다.

관리자 사용자 이름, 암호를 제공하고 로그인 버튼을 클릭합니다. 다음 화면에서 DokuWiki 대시보드를 볼 수 있습니다.

자동 갱신 설정

기본적으로 Let’s Encrypt 인증서는 90일 동안 유효합니다. 따라서 SSL 인증서를 자동 갱신하려면 cron 작업을 설정해야 합니다. 매주 또는 매일 실행되는 cron 작업을 만드는 것이 안전합니다.

SSL 인증서를 수동으로 갱신하려면 다음 명령을 실행하십시오.

certbot renew --dry-run

다음 파일을 편집하여 매일 오전 6시에 SSL 인증서를 자동 갱신하도록 cron 작업을 설정할 수 있습니다.

crontab -e

다음 줄을 추가합니다.

00 06 * * *   root /usr/bin/certbot renew >/dev/null 2>&1

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

결론

축하합니다! DokuWiki를 성공적으로 설치하고 Ubuntu 22.04에서 Lets Encrypt SSL로 보호했습니다. 이제 DokuWiki를 사용하여 자신만의 위키 사이트를 만들 수 있습니다. 궁금한 점이 있으면 언제든지 문의해 주세요.