本教程适用于以下操作系统版本
- Ubuntu 22.04(Jammy Jellyfish)
- Ubuntu 20.04(Focal Fossa)
本页内容
- 准备工作
- 更新系统
- 安装 LAMP 服务器
- 为 Tiki Wiki 创建数据库
- 下载 Tiki Wiki
- 为 Tiki Wiki 配置 Apache
- 访问 Tiki Wiki Web 界面
- 使用 Let's Encrypt SSL 保护 Tiki Wiki
- 总结
Tiki(也称为 TikiWiki)是一个开源的基于 Wiki 的内容管理系统。它可帮助初学者在数分钟内托管自己的 Wiki 站点。它基于 PHP 开发,并使用 MariaDB/MySQL 来存储内容。Tiki 提供了用于创建强大的知识库、协作与项目管理、网站和博客发布、CRM 帮助台、电子学习等工具。它还提供丰富的功能,如 Wiki 页面、博客、论坛、文件、多语言支持、紧密集成以及图片库。
本教程将向您展示如何在 Ubuntu 22.04 服务器上安装 Tiki Wiki。
准备工作
- 一台运行 Ubuntu 22.04 的服务器。
- 一个已指向您服务器 IP 的域名。
- 服务器上已配置 root 密码。
更新系统
首先,建议将您的系统软件包更新到最新版本。您可以使用以下命令进行更新:
apt-get update -y
所有软件包更新完成后,您可以继续进行下一步。
安装 LAMP 服务器
首先,使用以下命令安装 Apache Web 服务器和 MariaDB 服务器:
apt-get install apache2 mariadb-server unzip git gnupg -y
安装完上述软件包后,您需要在系统上安装 PHP 及其所需的扩展。Tiki Wiki 仅支持 PHP 7.4 版本。默认情况下,Ubuntu 22.04 自带 PHP 8.1 版本。因此,您需要将 Ondrej PHP 软件源添加到您的服务器中。
您可以使用以下命令添加:
apt-get install software-properties-common -y
add-apt-repository ppa:ondrej/php
添加软件源后,使用以下命令更新软件源并安装带有所需扩展的 PHP:
apt-get install php7.4 php7.4-tidy php7.4-gd php7.4-xmlrpc php7.4-mbstring libapache2-mod-php7.4 php7.4-mysql php-apcu php7.4-curl php7.4-intl php7.4-sqlite3 php7.4-zip php-memcache php7.4-pspell php7.4-zip php7.4-memcached php-pear php7.4-common php7.4-opcache php7.4-xml php7.4-zip -y
所有软件包安装完成后,编辑 php.ini 文件并进行一些修改:
nano /etc/php/7.4/apache2/php.ini
修改以下行:
memory_limit = 256M upload_max_filesize = 100M max_execution_time = 300 date.timezone = UTC
至此,LAMP 服务器已安装在您的服务器上。
为 Tiki Wiki 创建数据库
接下来,您需要为 Tiki Wiki 创建一个数据库和用户。首先,使用以下命令登录到 MariaDB 控制台:
mysql
登录后,使用以下命令创建数据库和用户:
CREATE DATABASE tiki CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'tiki'@'localhost' IDENTIFIED BY 'yourpassword';
接下来,使用以下命令授予 tiki 数据库所有权限:
GRANT ALL ON tiki.* TO 'tiki'@'localhost' WITH GRANT OPTION;
接下来,使用以下命令刷新权限并退出 MariaDB shell:
FLUSH PRIVILEGES;
EXIT;
下载 Tiki Wiki
接下来,您需要从 Sourceforge 网站下载最新版本的 Tiki Wiki。您可以使用以下命令下载:
wget https://sourceforge.net/projects/tikiwiki/files/latest/download --no-check-certificate
下载完成后,使用以下命令解压下载的文件:
unzip download
接下来,将解压后的目录移动到 Apache 根目录:
mv tiki-24.2 /var/www/html/tikiwiki
接下来,修改 tikiwiki 目录的所有者和权限:
chown -R www-data:www-data /var/www/html/tikiwiki/
chmod -R 755 /var/www/html/tikiwiki/
至此,Tiki Wiki 已下载并配置完成。
为 Tiki Wiki 配置 Apache
接下来,使用以下命令为 Tiki Wiki 创建 Apache 虚拟主机配置文件:
nano /etc/apache2/sites-available/tikiwiki.conf
添加以下行:
<VirtualHost *:80>
ServerAdmin
[email protected]
DocumentRoot /var/www/html/tikiwiki
ServerName tikiwiki.example.com
<Directory /var/www/html/tikiwiki/>
Options FollowSymlinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
完成后保存并关闭文件。然后,使用以下命令启用 Apache 虚拟主机:
a2ensite tikiwiki.conf
接下来,使用以下命令启用 Apache 重写模块并重启 Apache 服务:
a2enmod rewrite
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-11-20 11:44:46 UTC; 3min 43s ago
Docs: https://httpd.apache.org/docs/2.4/
Process: 122937 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
Process: 124446 ExecReload=/usr/sbin/apachectl graceful (code=exited, status=0/SUCCESS)
Main PID: 122942 (apache2)
Tasks: 6 (limit: 2242)
Memory: 23.7M
CPU: 247ms
CGroup: /system.slice/apache2.service
??122942 /usr/sbin/apache2 -k start
??124450 /usr/sbin/apache2 -k start
??124451 /usr/sbin/apache2 -k start
??124452 /usr/sbin/apache2 -k start
??124453 /usr/sbin/apache2 -k start
??124454 /usr/sbin/apache2 -k start
Nov 20 11:44:46 ubuntu2204 systemd[1]: Starting The Apache HTTP Server...
访问 Tiki Wiki Web 界面
现在,打开您的 Web 浏览器,使用 URL http://tikiwiki.example.com/tiki-install.php 访问 Tiki Wiki Web 界面。您应该会看到以下页面:

选择您的语言并点击“继续”按钮。您应该会看到以下页面:

点击“继续”以同意许可协议。您应该会看到以下页面:

确保所有测试均为绿色,然后点击“继续”。您应该会看到以下页面:


填写您的数据库信息并点击“继续”按钮。您应该会看到以下页面:

选择您的数据库引擎并点击“安装”按钮。安装完成后,您应该会看到以下页面:

点击“继续”按钮。您应该会看到以下页面:



填写您的站点信息并点击“继续”按钮。您应该会看到以下页面:

点击“继续”按钮。您应该会看到管理员用户创建页面:

点击“进入 Tiki 并锁定安装程序”。您应该会看到管理员用户创建页面:

设置您的管理员密码并点击“应用”按钮。您将在以下页面看到 Tiki Wiki 仪表盘:

使用 Let's Encrypt SSL 保护 Tiki Wiki
使用 Let's Encrypt SSL 证书保护您的 Wiki 站点是个好主意。为此,您必须在系统中安装 Certbot 客户端。
您可以使用以下命令安装 Certbot:
apt-get install certbot python3-certbot-apache -y
Certbot 客户端安装成功后,运行以下命令为您的网站安装 Let's Encrypt SSL:
certbot --apache -d tikiwiki.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 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 tikiwiki.example.com Enabled Apache rewrite module Waiting for verification... Cleaning up challenges Created an SSL vhost at /etc/apache2/sites-available/tikiwiki-le-ssl.conf Enabled Apache socache_shmcb module Enabled Apache ssl module Deploying Certificate to VirtualHost /etc/apache2/sites-available/tikiwiki-le-ssl.conf Enabling available site: /etc/apache2/sites-available/tikiwiki-le-ssl.conf
接下来,选择是否将 HTTP 流量重定向到 HTTPS,或配置 Nginx 将所有流量重定向到安全的 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 并按回车键以开始该过程。安装完成后,您应该会看到类似以下的输出:
Enabled Apache rewrite module Redirecting vhost in /etc/apache2/sites-enabled/tikiwiki.conf to ssl vhost in /etc/apache2/sites-available/tikiwiki-le-ssl.conf - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Congratulations! You have successfully enabled https://tikiwiki.example.com You should test your configuration at: https://www.ssllabs.com/ssltest/analyze.html?d=tikiwiki.example.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - IMPORTANT NOTES: - Congratulations! Your certificate and chain have been saved at: /etc/letsencrypt/live/tikiwiki.example.com/fullchain.pem Your key file has been saved at: /etc/letsencrypt/live/tikiwiki.example.com/privkey.pem Your cert will expire on 2023-02-12. 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
至此,您的 Tiki Wiki 站点已通过 Let's Encrypt SSL 得到保护。您现在可以使用 HTTPS 协议安全地访问您的站点了。
总结
恭喜!您已成功在 Ubuntu 22.04 服务器上安装了 Tiki Wiki。现在,您可以使用 Tiki Wiki 托管您自己的 Wiki。如需更多信息,您可以访问 Tiki Wiki 文档页面。如果您有任何问题,欢迎随时向我提问。