如何在 Ubuntu 18.04 上安裝 XWiki

XWiki 是一個免費的開源高級 Wiki 軟件,它是用 Java 編寫的。 它運行在 JBoss、Tomcat 等 servlet 容器上。它使用 MySQL 或 PostgreSQL 等數據庫來存儲其信息。

在本教程中,我將解釋如何在 Ubuntu 18.04 上安裝 XWiki 軟件,使用它的獨立發行版,這是最快和最簡單的方法,因為 XWiki 所需的所有組件都會自動安裝在服務器上。 這個 XWiki 軟件提供了一個內置的 XWiki,帶有一個可移植的數據庫 (HSQLDB) 和一個輕量級的 Java 容器 (Jetty)。

XWiki 具有許多有用的功能,例如:

  • 一個非常強大的 WYSIWYG 編輯器,用於頁面編輯
  • 強大的維基語法
  • 內容組織
  • 創建您自己的應用程序
  • 版本控制
  • 高級搜索和更多

硬件和軟件要求

  • 為 XWiki >= 8.1 安裝 Java 1.8.0_101 或更高版本(XWiki < 8.1 的 Java 7 或更高版本,XWiki 版本 < 6.0 的 Java 6 或更高版本)。
  • 支持 Servlet 3.0.1 的 Servlet 容器(XWiki 版本 < 7.0 的 Servlet 2.4)
  • 數據庫和數據庫的 JDBC 4 驅動程序
  • 足夠的內存,至少 2 GB RAM(或 1 GB 用於小型 Wiki)

XWiki安裝步驟

在開始任何安裝之前,我建議您使用以下方法更新您的系統軟件 apt-update. 你可以安裝 wget 和 screen 如果之前沒有安裝這些包。

#apt-get update -y
#apt install wget screen

第 1 步:安裝 Java

如前所述,Xwiki 是一個基於 Java 的應用程序,因此您需要安裝 Java 8 或以上,以滿足其軟件要求。 默認情況下,默認 Ubuntu 存儲庫中不提供 Java 8。 因此,您可以通過將 webupd8team PPA 存儲庫添加到您的系統來安裝受支持的 Java。

#add-apt-repository ppa:webupd8team/java
#apt-get update -y

添加 PPA 存儲庫後,您需要更新存儲庫包。 完成後,您可以通過運行以下命令來安裝所需的 Java 8:

#apt-get install oracle-java8-installer -y

You can confirm the Java version installed.
~# java -version
java version "1.8.0_181"
Java(TM) SE Runtime Environment (build 1.8.0_181-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.181-b13, mixed mode)

第 2 步:下載並安裝 XWiki

首先,您需要為此 XWiki 安裝啟動一個新的屏幕會話。 現在我們需要下載適用於所有平台的通用安裝程序。 它只需要在您的系統上安裝 Java。 你可以下載 XWiki 通用安裝程序 帶有以下命令的文件:

#screen -U -S xwiki
#wget https://download.forge.ow2.org/xwiki/xwiki-enterprise-installer-generic-8.1-standard.jar

下載此安裝程序後,您可以使用 Java 安裝此下載的軟件包。 安裝程序會將您帶到各種交互式部分,如下所示,它需要像輸入這樣的輸出 1 (accept or proceed)/ 2 (quit) /3 (redisplay) 從您那裡繼續安裝。 大多數提示都可以回答 1 (accept or proceed). 安裝程序一目了然,因此您只需按照說明操作即可。

# java -jar xwiki-enterprise-installer-generic-8.1-standard.jar
Aug 7, 2018 10:08:33 AM INFO: Logging initialized at level 'INFO'
Aug 7, 2018 10:08:33 AM INFO: Commandline arguments:
Aug 7, 2018 10:08:33 AM INFO: Detected platform: ubuntu_linux,version=4.15.0-29-generic,arch=x64,symbolicName=null,javaVersion=1.8.0_181
Welcome to the installation of XWiki Enterprise 8.1!
The homepage is at: https://xwiki.org/

Press 1 to continue, 2 to quit, 3 to redisplay

按下時 1 繼續,它將為您提供 XWiki Enterprise - Readme Note 如下:

Please read the following information:
XWiki Enterprise - Readme

XWiki Enterprise is a second generation Wiki engine, features professional features like
XWiki Enterprise also includes an advanced form and scripting engine which makes it an ideal
development environment for constructing data-based intranet applications. It has powerful extensibility features, supports scripting, extensions and is based on a highly modular
architecture. The scripting engine allows to access a powerful API for accessing the XWiki repository in read and write mode.
XWiki Enterprise is used by major companies around the world and has strong Support for a professional usage of XWiki.
Here are some pointers to get you started with XWiki once you have finished installing it:
The documentation can be found on the XWiki.org web site
If you wish to talk to XWiki users or developers please use our
You can also access XWiki's
If you need commercial support please visit the
Support page

Press 1 to continue, 2 to quit, 3 to redisplay
1

按 1 繼續後,您將看到許可協議通知。

Press 1 to continue, 2 to quit, 3 to redisplay
1
See the NOTICE file distributed with this work for additional information regarding copyright ownership.
This is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.
This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with this software; if not, write to the Free
Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF site: https://www.fsf.org.

Press 1 to accept, 2 to reject, 3 to redisplay
1

接受許可協議後,它將帶您完成設置安裝文件夾、自動安裝程序、桌面快捷方式、用戶快捷方式等的各個安裝階段。我將繼續使用安裝程序選擇的默認路徑。 如果需要,您可以在本節中設置自定義路徑。

Select the installation path: [/usr/local/XWiki Enterprise 8.1]

Press 1 to continue, 2 to quit, 3 to redisplay
1

[x] Pack 'Core' required
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
[x] Include optional pack 'Default Wiki'
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Enter Y for Yes, N for No:
Y
Done!

Press 1 to continue, 2 to quit, 3 to redisplay
1
[ Starting to unpack ]
[ Processing package: Core (1/2) ]
[ Processing package: Default Wiki (2/2) ]
[ Unpacking finished ]
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Create shortcuts in the Start-Menu
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Enter Y for Yes, N for No:
Y
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Create additional shortcuts on the desktop
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Enter Y for Yes, N for No:
Y
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
create shortcut for: all users
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Enter Y for Yes, N for No:
Y
Aug 7, 2018 10:11:08 AM WARNING: Shortcut 'Go to my wiki' has URL but type ('Application') is not 'Link'
Aug 7, 2018 10:11:08 AM WARNING: Shortcut 'Go to my wiki' has URL but type ('Application') is not 'Link'
Aug 7, 2018 10:11:08 AM WARNING: Shortcut 'Documentation' has URL but type ('Application') is not 'Link'
Aug 7, 2018 10:11:08 AM WARNING: Shortcut 'Documentation' has URL but type ('Application') is not 'Link'
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Generate an automatic installation script
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Enter Y for Yes, N for No:
Y
Select the installation script (path must be absolute)[/usr/local/XWiki Enterprise 8.1/auto-install.xml]

Installation was successful
application installed on /usr/local/XWiki Enterprise 8.1
[ Writing the uninstaller data ... ]
[ Console installation done ]

安裝完成後,它將顯示應用程序安裝文件夾,如我們的輸出所示 /usr/local/XWiki Enterprise 8.1. 現在您需要移動到應用程序文件夾並運行 XWiki 啟動腳本,如下所示:

# cd /usr/local/XWiki Enterprise 8.1/
1:/usr/local/XWiki Enterprise 8.1# bash start_xwiki.sh
Starting Jetty on port 8080, please wait...
2018-08-09 09:31:08.832:INFO::main: Logging initialized @692ms
2018-08-09 09:31:09.354:INFO:oejs.Server:main: jetty-9.2.13.v20150730
2018-08-09 09:31:09.378:INFO:oejs.AbstractNCSARequestLog:main: Opened /usr/local/XWiki Enterprise 8.1/data/logs/2018_08_09.request.log
2018-08-09 09:31:09.383:INFO:oejdp.ScanningAppProvider:main: Deployment monitor [file:/usr/local/XWiki%20Enterprise%208.1/jetty/contexts/] at interval 0
2018-08-09 09:31:32,621 [main] INFO o.x.s.s.i.EmbeddedSolrInstance - Starting embedded Solr server...
2018-08-09 09:31:32,633 [main] INFO o.x.s.s.i.EmbeddedSolrInstance - Using Solr home directory: [data/solr]
2018-08-09 09:31:38,070 [coreLoadExecutor-6-thread-1] WARN o.a.s.c.SolrCore - [xwiki] Solr index directory '/usr/local/XWiki Enterprise 8.1/data/solr/xwiki/data/index' doesn't exist. Creating new index...
2018-08-09 09:31:39,756 [main] INFO o.x.s.s.i.EmbeddedSolrInstance - Started embedded Solr server.
2018-08-09 09:31:41.705:INFO:oejsh.ContextHandler:main: Started o.e.j.w.WebAppContext@6df97b55{/xwiki,file:/usr/local/XWiki%20Enterprise%208.1/webapps/xwiki/,AVAILABLE}{/xwiki}
2018-08-09 09:31:41.802:INFO:oejsh.ContextHandler:main: Started o.e.j.w.WebAppContext@389a9ff6{/,file:/usr/local/XWiki%20Enterprise%208.1/webapps/root/,AVAILABLE}{/root}
2018-08-09 09:31:41.862:INFO:oejs.ServerConnector:main: Started ServerConnector@6a6b8692{HTTP/1.1}{0.0.0.0:8080}
2018-08-09 09:31:41.862:INFO:oejs.Server:main: Started @33722ms
2018-08-09 09:31:41.862:INFO:oxtjl.NotifyListener:main: ----------------------------------
2018-08-09 09:31:41.869:INFO:oxtjl.NotifyListener:main: Server started, you can now open https://ubuntu18.example.com:8080/ in your browser to access your wiki.
2018-08-09 09:31:41.871:INFO:oxtjl.NotifyListener:main: ----------------------------------

應用程序將自動在端口 8080 上啟動。您需要等待幾分鐘才能啟動應用程序。 完成後,您可以通過您的域或端口 8080 上的服務器 IP 訪問 XWiki。不要 close 我們出現的屏幕終端窗口。 我們的 XWiki 服務器需要它才能運行。 您可以通過終止此屏幕終端來停止此 XWiki 服務器。

PS:默認情況下,應用程序在端口 8080 上運行。但是如果您想使用自定義端口 8081,請確保端口 8081 上沒有運行任何內容並使用以下命令啟動 XWiki:

#bash start_xwiki.sh -p 8081

第 3 步:啟動應用程序

XWiki 啟動後,您可以將瀏覽器指向 https://ServerIP or Hostname:8080/ 訪問 Web 界面。

您可以使用默認設置登錄管理面板 Admin 用戶(首字母大寫),默認密碼為 admin (小寫)。

登錄

Xwiki儀表板

結論

歡呼! 我們已經成功安裝並配置了我們的 XWiki。 我希望本教程將幫助您使用 XWiki 設置您自己的自託管 Wiki。 請就此發表您的寶貴建議和意見。

另請閱讀:

  • 15 個用於處理終端會話的 Linux 屏幕命令
  • 如何在 Ubuntu 18.04 上安裝 Java 8