Follow this guide to install Node.js 16.x
1. Install PostgreSQL
apt install postgresql postgresql-contrib
2. Login to the DB with the postgresql user
sudo -u postgres psql
- OR -
su - postgresql
psql
3. Create a new PostgreSQL user for Wiki.js
CREATE USER wikijs WITH PASSWORD '****************';
4. Create a new DB.
CREATE DATABASE wiki OWNER wikijs;
5. Set privileges on the new DB.
GRANT ALL PRIVILEGES ON DATABASE wiki TO wikijs;
1. Download Wiki.js:
wget https://github.com/Requarks/wiki/releases/latest/download/wiki-js.tar.gz
2. Extract the package to directory of choice: ('wiki' in this case)
mkdir /opt/wiki
tar xzf wiki-js.tar.gz -C /opt/wiki
3. Rename the sample config to config.yml
cd /opt/wiki
mv config.sample.yml config.yml
4. Edit the config file to reflect DB settings (PostgreSQL needs to be configured with DB manually. wiki.js won't create it.)
vim config.yml
...
db:
type: postgres
host: localhost
port: 5432
user: wikijs
pass: [dbpassword]
db: wiki
ssl: [true/false]
...
5. Start Wiki.js (from inside the install directory)
node server
1. Create a new user to run the service.
adduser wiki --disabled-password
2. Create a new file for the service
vim /etc/systemd/system/wiki.service
3. Paste these contents into wiki.service
and modify as needed
[Unit]
Description=Wiki.js
After=network.target
[Service]
Type=simple
ExecStart=/usr/bin/node server
Restart=always
User=wiki
Environment=NODE_ENV=production
WorkingDirectory=/opt/wiki #(where ever wiki.js was unpackaged/installed to)
[Install]
WantedBy=multi-user.target
4. Save and Exit wiki.service
5. Reload systemd
systemctl daemon-reload
6. Enable and Run the new service
systemctl enable wiki.service
systemctl start wiki.service