如何在 Debian 11 上安装 DokuWiki

DokuWiki 是一个完全用 PHP 编程语言编写的免费开源 wiki 应用程序,并且经常部署在 LAMP 堆栈下的 Linux 中. 它提供了非常有用的功能,例如多语言支持、搜索引擎优化、身份验证、垃圾邮件黑名单、自动保存、只读页面、简单轻量级的架构等等。dokuwiki-logo

在 Debian 11 Bullseye 上安装 DokuWiki

步骤 1. 在我们安装任何软件之前,通过apt在终端中运行以下命令来确保您的系统是最新的很重要:

sudo apt update
sudo apt upgrade

步骤 2. 安装 LAMP 堆栈。

需要 Debian 11 LAMP 服务器。如果您没有安装 LAMP,请阅读我们之前的教程,在 Debian 11 上安装LAMP 服务器

步骤 3. 在 Debian 11 上安装 DokuWiki。

现在我们使用以下wget命令从官方页面下载最新版本的 DokuWiki :

wget https://download.dokuwiki.org/src/dokuwiki/dokuwiki-stable.tgz

接下来,使用以下命令提取下载的文件:

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

然后,使用以下命令复制一些必要的文件:

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

我们需要更改一些文件夹权限:

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

步骤 4. 为 DokuWiki 配置 Apache 虚拟主机。

现在我们创建一个 Apache 虚拟主机配置文件来托管 DokuWiki:

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

添加以下几行:

<VirtualHost *:80>
        ServerName    dokuwiki.your-domain.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>

保存并关闭,然后重新启动 Apache 网络服务器以进行更改:

sudo a2ensite dokuwiki.conf
sudo a2enmod rewrite
sudo systemctl reload apache2

步骤 5. 使用 Let’s Encrypt SSL 配置 DokuWiki。

首先,使用以下命令将 Certbot 安装到您的 Debian 系统:

sudo apt install certbot python3-certbot-apache

成功安装 Certbot 客户端后,运行以下命令来安装 Let’s Encrypt SSL:

certbot --apache -d dokuwiki.your-domain.com

然后系统会提示您输入证书的电子邮件地址。输入后,您必须同意条款和条件并决定是否要与电子前沿基金会共享您的电子邮件地址。

输出:

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

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

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

接下来,我们设置一个 cron 作业来自动更新 SSL 证书:

certbot renew --dry-run

您可以通过编辑以下文件来设置一个 cron 作业,以在每天凌晨 12:00 自动更新 SSL 证书:

crontab -e

添加以下行:

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

步骤 6. 访问 DokuWiki Web 界面。

成功安装后,打开 Web 浏览器并输入 URL 。您应该会看到 DokuWiki 安装屏幕:https://dokuwiki.your-domian.com/install.php

DokuWiki-web-interface

感谢您使用本教程在 Debian 系统上安装最新版本的 DokuWiki。如需其他帮助或有用信息,我们建议您查看DokuWiki 官方网站

未经允许不得转载:统信UOS之家 » 如何在 Debian 11 上安装 DokuWiki

相关文章