step by step , setup a wiki server

Install

  1. Download the latest version of Wiki.js:
wget https://github.com/Requarks/wiki/releases/download/2.5.170/wiki-js.tar.gz
  1. Extract the package to the final destination of your choice:
mkdir wiki
tar xzf wiki-js.tar.gz -C ./wiki
cd ./wiki
  1. Rename the sample config file to config.yml:
mv config.sample.yml config.yml
  1. Edit the config file and fill in your database and port settings (Configuration Reference):
nano config.yml
  1. For SQLite installations only: (skip this step otherwise) Fetch native bindings for SQLite3:
npm rebuild sqlite3
  1. Run Wiki.js
node server
  1. Wait until you are invited to open to the setup page in your browser.
  2. Complete the setup wizard to finish the installation.

Run as service

There are several solutions to run Wiki.js as a background service. We'll focus on systemd in this guide as it's available in nearly all linux distributions.

  1. Create a new file named wiki.service inside directory /etc/systemd/system.
nano /etc/systemd/system/wiki.service
  1. Paste the following contents (assuming your wiki is installed at /var/wiki):
[Unit]
Description=Wiki.js
After=network.target

[Service]
Type=simple
ExecStart=/usr/bin/node server
Restart=always
# Consider creating a dedicated user for Wiki.js here:
User=nobody
Environment=NODE_ENV=production
WorkingDirectory=/var/wiki

[Install]
WantedBy=multi-user.target
  1. Save the service file (CTRL+X, followed by Y).
  2. Reload systemd:
systemctl daemon-reload
  1. Run the service:
systemctl start wiki
  1. Enable the service on system boot.
systemctl enable wiki

Note: You can see the logs of the service using journalctl -u wiki

configuration file demo:

# ---------------------------------------------------------------------
# Port the server should listen to
# ---------------------------------------------------------------------

port: 3000

# ---------------------------------------------------------------------
# Database
# ---------------------------------------------------------------------
# Supported Database Engines:
# - postgres = PostgreSQL 9.5 or later
# - mysql = MySQL 8.0 or later (5.7.8 partially supported, refer to docs)
# - mariadb = MariaDB 10.2.7 or later
# - mssql = MS SQL Server 2012 or later
# - sqlite = SQLite 3.9 or later

db:
  type: postgres

  # PostgreSQL / MySQL / MariaDB / MS SQL Server only:
  host: localhost
  port: 5432
  user: wikijs
  pass: wikijs
  db: wiki
  ssl: false

of course ,need to install and configure the postgresql and database ,reference the configuration ubove

tips: how to install node new version

ubuntu 安装指定版本nodejs(一次成功)

wget -qO- https://deb.nodesource.com/setup_10.x | sudo -E bash -
sudo apt-get install -y nodejs

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

海里的鱼2022

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值