Skip to content

下載

jetty

https://www.eclipse.org/jetty/

xwiki 免費版 www.xwiki.org

  1. WAR Package for Servlet Container https://www.xwiki.org/xwiki/bin/view/Download/ 副檔名改成 .zip,解壓縮到
  2. 新建資料夾 新建 ~/jetty/webapps/x12/data/extension/repository
  3. XIP Package 副檔名改成 .zip,解壓縮到 ~/jetty/webapps/x12/data/extension/repository

新建 ~/jetty/webapps/xwiki/data

{{% callout note %}} ~/jetty/webapps/xwiki/data/extension ~/jetty/webapps/xwiki/data/extension/repository {{% /callout %}}

下載安裝 postgreSQL J Connector

https://jdbc.postgresql.org/download.html

下載到 /home/zon/jetty/webapps/x12/WEB-INF/lib

建立postgreSQL 帳號

密碼 ex: xwiki pwd:d6g981a0

# postgres 登入
> psql postgres
CREATE DATABASE xwiki
WITH OWNER = zon
ENCODING = 'UNICODE'
TABLESPACE = pg_default;
# 確認資料庫建立成功
> \l
# 連接使用資料庫
> \connect xwiki
> CREATE USER xwiki PASSWORD 'd6g981a0' VALID UNTIL 'infinity';
#確認使用者建立成功
> \du
> GRANT ALL ON SCHEMA public TO xwiki;

修改xwiki 參數檔

在 /var/www/html/jetty/webapps/xwiki/WEB-INF

  • hibernate.cfg.xml
  • xwiki.cfg
  • xwiki.properties

hiberate.cfg.xml

移動 → 來註解預設database 區塊 移動 → 取消註解Mysql區塊

xwiki.cfg

xwiki.properties ##

uncomment以下

environment.permanentDirectory=/home/zon/jetty/webapps/xwiki/data/
store.file.directory=/home/zon/jetty/webapps/xwiki/data/store/file/

其他看情況,安裝正確完成後,日後修改

初次啟動安裝

{{% callout warning %}} 不要使用systemclt service 啟動方式 否則xwiki 會用root權限建立相關檔案,這樣會無法啟動初始化精靈 cd ~/jetty java -jar start.jar 安裝完成後,關閉 jetty ^C {{% /callout %}}

postgreSQL 手動新增index

> psql postgres
> \c xwiki
--Required
create index xwl_value on xwikilargestrings (xwl_value(50));
create index xwd_parent on xwikidoc (xwd_parent(50));
create index xwd_class_xml on xwikidoc (xwd_class_xml(20));
create index ase_page_date on  activitystream_events (ase_page, ase_date);
create index xda_docid1 on xwikiattrecyclebin (xda_docid);
create index ase_param1 on activitystream_events (ase_param1(200));
create index ase_param2 on activitystream_events (ase_param2(200));
create index ase_param3 on activitystream_events (ase_param3(200));
create index ase_param4 on activitystream_events (ase_param4(200));
create index ase_param5 on activitystream_events (ase_param5(200));
--Only required if you use stats (feature is off by default)
create index xws_number on xwikistatsdoc (XWS_NUMBER);
create index xws_classname on xwikistatsdoc (XWS_CLASSNAME);
create index xwr_number on xwikistatsreferer (XWR_NUMBER);
create index xwr_classname on xwikistatsreferer (XWR_CLASSNAME);
create index xwr_referer on xwikistatsreferer (XWR_REFERER(50));
create index xwv_user_agent on xwikistatsvisit (XWV_USER_AGENT(255));
create index xwv_cookie on xwikistatsvisit (XWV_COOKIE(255));
create index xwv_classname on xwikistatsvisit (XWV_CLASSNAME);
create index xwv_number on xwikistatsvisit (XWV_NUMBER);

以 systemd 啟動 on-daemon

$ sudo vi /etc/systemd/system/xwiki.service
[Unit]
Description=xwiki

[Service]
#Type=simple
WorkingDirectory=/home/zon/jetty/
ExecStart=/bin/java -jar start.jar
#User=zon
Type=simple
#Restart=always
#ExecReload=/bin/kill -HUP $MAINPID
KillMode=process
Restart=on-failure
RestartSec=15s

[Install]
WantedBy=multi-user.target
$ sudo systemctl daemon-reload
$ sudo systemctl start xwiki.service
$ sudo systemctl enable xwiki.service