XWiki是一个免费的开源企业wiki平台,允许用户创建,管理和共享知识。它是用Java编写的,可以通过一系列插件和扩展轻松扩展和定制。XWiki提供了一个简单且用户友好的Web界面,可帮助您从任何设备和浏览器创建和管理内容。
在 Ubuntu 22.04 LTS Jammy Jellyfish 上安装 XWiki
第 1 步。首先,通过在终端中运行以下命令,确保所有系统软件包都是最新的。apt
<span class="pln">sudo apt update sudo apt upgrade</span>
第 2 步。安装爪哇。
如果您的系统上未安装 Java,则可以通过运行以下命令进行安装:
<span class="pln">sudo apt install </span><span class="kwd">default</span><span class="pun">-</span><span class="pln">jdk gnupg2</span>
使用以下命令验证 Java 版本:
<span class="pln">java </span><span class="pun">--</span><span class="pln">version</span>
有关安装 Java 的其他资源,请阅读下面的帖子:
- 如何在 Ubuntu Linux √ 上安装 Java
第 3 步。在 Ubuntu 22.04 上安装 XWiki。
默认情况下,XWiki 在 Ubuntu 22.04 基础存储库中不可用。现在运行以下命令,将最新的 XWiki 存储库添加到您的 Ubuntu 系统中:
<span class="pln">wget </span><span class="str">"https://maven.xwiki.org/stable/xwiki-stable.list"</span> <span class="pun">-</span><span class="pln">O </span><span class="pun">/</span><span class="pln">etc</span><span class="pun">/</span><span class="pln">apt</span><span class="pun">/</span><span class="pln">sources</span><span class="pun">.</span><span class="pln">list</span><span class="pun">.</span><span class="pln">d</span><span class="pun">/</span><span class="pln">xwiki</span><span class="pun">-</span><span class="pln">stable</span><span class="pun">.</span><span class="pln">list</span>
接下来,使用以下命令添加 GPG 密钥:
<span class="pln">wget https</span><span class="pun">:</span><span class="com">//maven.xwiki.org/xwiki-keyring.gpg -O /usr/share/keyrings/xwiki-keyring.gpg</span>
更新存储库后,您可以使用以下命令安装最新版本的 XWiki:
<span class="pln">sudo apt update sudo apt install xwiki</span><span class="pun">-</span><span class="pln">tomcat9</span><span class="pun">-</span><span class="pln">common xwiki</span><span class="pun">-</span><span class="pln">tomcat9</span><span class="pun">-</span><span class="pln">mariadb</span>
在安装过程中,系统将要求您为 XWiki 配置数据库,如下所示:
选择 Yes 并按回车键。您需要为 XWiki 数据库设置密码,如下所示:
第 4 步。为 XWiki 配置 Nginx。
首先,使用以下命令安装 Nginx Web 服务器:
<span class="pln">sudo apt install nginx</span>
接下来,我们创建一个新的 Nginx 虚拟主机配置:
<span class="pln">nano </span><span class="pun">/</span><span class="pln">etc</span><span class="pun">/</span><span class="pln">nginx</span><span class="pun">/</span><span class="pln">sites</span><span class="pun">-</span><span class="pln">available</span><span class="pun">/</span><span class="pln">xwiki</span><span class="pun">.</span><span class="pln">conf</span>
添加以下行:
<span class="pln">server </span><span class="pun">{</span><span class="pln"> listen </span><span class="lit">80</span><span class="pun">;</span><span class="pln"> server_name xwiki</span><span class="pun">.</span><span class="pln">your</span><span class="pun">-</span><span class="pln">domain</span><span class="pun">.</span><span class="pln">com</span><span class="pun">;</span><span class="pln"> access_log </span><span class="pun">/</span><span class="kwd">var</span><span class="pun">/</span><span class="pln">log</span><span class="pun">/</span><span class="pln">nginx</span><span class="pun">/</span><span class="pln">xwiki</span><span class="pun">-</span><span class="pln">access</span><span class="pun">.</span><span class="pln">log</span><span class="pun">;</span><span class="pln"> error_log </span><span class="pun">/</span><span class="kwd">var</span><span class="pun">/</span><span class="pln">log</span><span class="pun">/</span><span class="pln">nginx</span><span class="pun">/</span><span class="pln">xwiki</span><span class="pun">-</span><span class="pln">error</span><span class="pun">.</span><span class="pln">log</span><span class="pun">;</span><span class="pln"> location </span><span class="pun">/</span> <span class="pun">{</span><span class="pln"> proxy_set_header X</span><span class="pun">-</span><span class="typ">Real</span><span class="pun">-</span><span class="pln">IP $remote_addr</span><span class="pun">;</span><span class="pln"> proxy_set_header </span><span class="typ">Host</span><span class="pln"> $host</span><span class="pun">;</span><span class="pln"> proxy_http_version </span><span class="lit">1.1</span><span class="pun">;</span><span class="pln"> proxy_set_header </span><span class="typ">Upgrade</span><span class="pln"> $http_upgrade</span><span class="pun">;</span><span class="pln"> proxy_set_header </span><span class="typ">Connection</span> <span class="str">'upgrade'</span><span class="pun">;</span><span class="pln"> proxy_cache_bypass $http_upgrade</span><span class="pun">;</span><span class="pln"> proxy_pass http</span><span class="pun">:</span><span class="com">//127.0.0.1:8080;</span> <span class="pun">}</span> <span class="pun">}</span>
保存并关闭文件,然后使用以下命令激活 Nginx 虚拟主机:
<span class="pln">ln </span><span class="pun">-</span><span class="pln">s </span><span class="pun">/</span><span class="pln">etc</span><span class="pun">/</span><span class="pln">nginx</span><span class="pun">/</span><span class="pln">sites</span><span class="pun">-</span><span class="pln">available</span><span class="pun">/</span><span class="pln">xwiki</span><span class="pun">.</span><span class="pln">conf </span><span class="pun">/</span><span class="pln">etc</span><span class="pun">/</span><span class="pln">nginx</span><span class="pun">/</span><span class="pln">sites</span><span class="pun">-</span><span class="pln">enabled</span><span class="pun">/</span>
在使用XWiki之前,你需要修改Nginx配置文件中的一些东西:
<span class="pln">nano </span><span class="pun">/</span><span class="pln">etc</span><span class="pun">/</span><span class="pln">nginx</span><span class="pun">/</span><span class="pln">nginx</span><span class="pun">.</span><span class="pln">conf</span>
在下面添加以下行:http {
<span class="pln">server_names_hash_bucket_size </span><span class="lit">64</span><span class="pun">;</span>
保存并关闭文件,然后重新启动 Nginx 服务以应用更改:
<span class="pln">sudo systemctl restart nginx</span>
有关安装和管理 Nginx 的其他资源,请阅读下面的帖子:
- 如何在 Ubuntu Linux √ 上安装 Nginx
第5步。配置防火墙。
现在我们使用Nginx设置了一个简单的防火墙(UFW),以允许在HTTP和HTTPS的默认Web端口上进行公共访问:
<span class="pln">sudo ufw allow </span><span class="typ">OpenSSH</span><span class="pln"> sudo ufw allow </span><span class="str">'Nginx Full'</span><span class="pln"> sudo ufw enable</span>
第 6 步。访问XWiki网页界面。
成功安装后,打开您的网络浏览器并使用 URL 访问 XWiki 网页用户界面。您将被重定向到以下页面:http://xwiki.your-domain.com/xwiki
感谢您使用本教程在 Ubuntu 22.04 LTS Jammy Jellyfish 系统上安装 XWiki 开源企业 wiki 平台。如需更多帮助或有用信息,我们建议您查看XWiki网站。