How to Install Wiki.js on Ubuntu 18.04 LTS

Wiki.js is an open source, modern and powerful wiki app based on Node.js, Git, and Markdown. Wiki.js runs on the flamingly fast Node.js engine and is optimized to conserve CPU resources. Some of the Wiki.js features worth mentioning are:

  • Markdown editing, backed by Git
  • Lightweight, yet extremely powerful
  • Beautifully designed for the modern web
  • Integrated Access Control
  • Intuitive Assets Management
  • Built-in search engine

In this tutorial, we will walk you through the Wiki.js version 1 installation process on a Ubuntu 18.04 LTS operating system by using NGINX as a reverse proxy server, MongoDB as a database server, PM2 as a process manager and optionally you can secure transport layer by using client and Let's Encrypt certificate authority to add SSL support.


Requirements to run Wiki.js are the following:

  • Node.js 6.11.1 to 10.x is required.
  • MongoDB version 3.2 or later.
  • Git version 2.7.4 or later.
  • Web Server software such as NGINX, Apache, Caddy, H2O...
  • An empty Git repository (optional).
  • Minimum of 512MB RAM. 1GB of RAM recommended.
  • About 300MB of disk space.
  • Domain name with A/AAAA DNS records set up.


  • An Ubuntu 18.04 LTS operating system.
  • A non-root user with sudo privileges.

Initial Steps

Check your Ubuntu version:

lsb_release -ds
# Ubuntu 18.04.1 LTS

Set up the timezone:

sudo dpkg-reconfigure tzdata

Update your operating system packages (software). This is an important first step because it ensures you have the latest updates and security fixes for your operating system's default software packages:

sudo apt update && sudo apt upgrade -y

Install some essential packages that are necessary for basic administration of Ubuntu operating system:

sudo apt install -y curl wget vim git unzip socat bash-completion apt-transport-https build-essential

Step 1- Install Node.js and npm

Wiki.js is built on Node.js. We are going to install the latest recommended version for Wiki.js which is version 10 at the time of this writing. On Linux, you have a few Node.js installation options: Linux Binaries (x86/x64), Source Code or via Package Managers. We will use a Package Management option which makes installing and updating Node.js a breeze.

Download and install the latest recommended version of Node.js from the NodeSource repository:

curl -sL | sudo -E bash -
sudo apt install -y nodejs

NOTE: npm is distributed with Node.js - which means that when you download Node.js, you automatically get npm installed on your system.

Check Node.js and npm version:

node -v && npm -v
# v10.15.1
# 6.4.1

Npm is a separate project from Node.js and tends to update more frequently. As a result, even if you’ve just downloaded Node.js (and therefore npm), you’ll probably need to update your npm. Luckily, npm knows how to update itself! To update your npm, type this into your terminal:

sudo npm install -g [email protected]

This command will update npm to the latest stable version.

Re-check npm version with:

npm -v
# 6.8.0

And it should return the latest version number.

Step 2 - Install MongoDB database

Wiki.js needs a database to store its data, and the current stable version of Wiki.js supports only MongoDB database engine. According to that, we will need to install MongoDB database.

Download and install MongoDB database:

sudo apt install -y mongodb

Check the MongoDB version:

mongo --version | head -n 1 && mongod --version | head -n 1
# MongoDB shell version v3.6.3
# db version v3.6.3

Start and enable (set it to start on rebootMongoDB service if not already started and enabled:

sudo systemctl start mongodb.service
sudo systemctl enable mongodb.service

Step 3 - Install client and obtain Let's Encrypt certificate (optional)

Securing your website with HTTPS is not necessary, but it is a good practice to secure your site traffic. In order to obtain an SSL certificate from Let's Encrypt, we will use client. is a pure UNIX shell software for obtaining SSL certificates from Let's Encrypt with zero dependencies. 

Download and install

sudo su - root
git clone
./ --install --accountemail [email protected]
source ~/.bashrc
cd ~

Check version: --version
# v2.8.1

Obtain RSA and ECC/ECDSA certificates for your domain/hostname:

# RSA 2048 --issue --standalone -d --keylength 2048
# ECDSA --issue --standalone -d --keylength ec-256

If you want fake certificates for testing you can add --staging flag to the above commands.

To list your issued certs you can run: --list

Create folders to store your certs. We will use /etc/letsencrypt but it can be anything you prefer to store SSL certs.

mkdir -p /etc/letsencrypt/
mkdir -p /etc/letsencrypt/example.com_ecc

Install/copy certificates to /etc/letsencrypt directory.

# RSA --install-cert -d \
--cert-file /etc/letsencrypt/ \
--key-file /etc/letsencrypt/ \
--fullchain-file /etc/letsencrypt/ \
--reloadcmd "sudo systemctl reload nginx.service"

# ECC/ECDSA --install-cert -d --ecc \
--cert-file /etc/letsencrypt/example.com_ecc/cert.pem \
--key-file /etc/letsencrypt/example.com_ecc/private.key \
--fullchain-file /etc/letsencrypt/example.com_ecc/fullchain.pem \
--reloadcmd "sudo systemctl reload nginx.service"

After running the above commands, your certificates and keys will be in:

  • For RSA: /etc/letsencrypt/ directory.
  • For ECC/ECDSA: /etc/letsencrypt/example.com_ecc directory.

All the certificates will be automatically renewed every 60 days.

After obtaining certs, exit from root user and return back to normal sudo user:


Step 4 - Install and configure NGINX

Wiki.js (or any HTTP Node.js app) can run without any actual web server (such as NGINX or Apache). However, it is highly recommended to put a standard web server in front of Wiki.js. This ensures you can use features like SSL, multiple websites, caching, etc. We will use NGINX in this tutorial, but any other server will do, you just need to configure it properly.

Download and install NGINX from the official NGINX repo by issuing the following commands:

sudo apt-key add nginx_signing.key
rm nginx_signing.key
sudo -s
printf "deb $(lsb_release -sc) nginx\ndeb-src $(lsb_release -sc) nginx\n" >> /etc/apt/sources.list.d/nginx_mainline.list
sudo apt update
sudo apt install -y nginx

Check the NGINX version:

sudo nginx -v
# nginx version: nginx/1.15.8

Enable and start NGINX service:

sudo systemctl enable nginx.service
sudo systemctl start nginx.service

Run sudo vim /etc/nginx/conf.d/wiki.js.conf 

sudo vim /etc/nginx/conf.d/wiki.js.conf

and configure NGINX as an HTTPS reverse proxy.

server {
listen [::]:443 ssl http2;
listen 443 ssl http2; listen [::]:80; listen 80; server_name; charset utf-8; client_max_body_size 50M;

ssl_certificate /etc/letsencrypt/;
ssl_certificate_key /etc/letsencrypt/;
ssl_certificate /etc/letsencrypt/example.com_ecc/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/example.com_ecc/private.key; location / { proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_pass; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_next_upstream error timeout http_502 http_503 http_504; } }

The only thing you need to change in the above config is server_name directive, the domain name in the ssl file paths, and potentially proxy_pass directive if you decide to configure some other than 3000 port. Wiki.js uses port 3000 by default.

Check the NGINX configuration:

sudo nginx -t

Finally, for changes to take effect, we need to reload NGINX:

sudo systemctl reload nginx.service

Step 5 - Install and setup Wiki.js

Create a document root directory where Wiki.js should reside in:

sudo mkdir -p /var/www/wiki.js

Navigate to the document root directory:

cd /var/www/wiki.js

Create a user for wikijs

sudo useradd -d /var/www/wiki.js wikijs

Change ownership of the /var/www/wiki.js directory to wikijs user:

sudo chown -R wikijs:wikijs /var/www/wiki.js

From /var/www/wiki.js directory, run the following command to fetch and install the latest Wiki.js application:

cd /var/www/wiki.js
sudo su wikijs
curl -sSo- | bash

Once the installation is completed, you can run the following command in order to view the currently installed version of Wiki.js:

node wiki --version
# 1.0.117

Once the installation is completed, you'll be prompted to launch the configuration wizard.

So, start the configuration wizard by running:

node wiki configure

Using your web browser, navigate to and follow the on-screen instructions. All settings entered during the configuration wizard are saved in the config.yml file. The configuration wizard will automatically start Wiki.js for you.

First, you will see a welcome message. Click on the "Start" button:

Wiki.js installer

Next "System Check" page will appear. If all requirements are met, click on the "Continue" button.

System Check

Enter general information about your wiki and click the "Continue" button:

General information

Read the "Important Consideration" notice and click "Continue" for the next step: 

Important to consider

Next, connect to the database and continue: 

Database connection

You should see a message that Wiki.js has been successfully connected to the database. Click the "Continue" button:

Database connection successful

Set paths and continue:

Set the path

Set up remote Git repo if you want or skip this step. This step is optional but highly recommended:

Setup remote GIT repo

Next, click the "Continue" button:

Continue with the installation

Create an admin account and click the "Continue" button:

Create an admin account

And finally, start the Wiki.js:

Start Wiki.js

Wait around 30 seconds and you should be redirected to Wiki.js homepage:

Wiki.js homepage

The installation is completed. You should wiki welcome page:

Welcome to Wiki.js

Step 6 - Setup PM2 Process Manager

By default, Wiki.js will not start automatically after a system reboot. In order to make it start on boot, we need to setup PM2 process manager. PM2 comes bundled with Wiki.js as a local npm module, so we don't need to install PM2 globally.

Tell PM2 to configure itself as a startup service by running:

/var/www/wiki.js/node_modules/pm2/bin/pm2 startup

Finally, save the current PM2 configuration by running the command:

/var/www/wiki.js/node_modules/pm2/bin/pm2 save

Your Wiki.js now runs as a background process, using PM2 as its process manager.

Share this page:

Suggested articles

9 Comment(s)

Add comment


By: SionSavior

Thank you nice work. 

I tried this Tutorial 4x but i have only: 

502 Bad Gateway



By: till

I've tested it today and it works fine here. I made some minor adjustments to the guide though to clarify a few things.

By: Paragrimm

And what exactly?!

I run into the same error and I can 'fix' it via changing the wikiJS Port to 3001 or the NGINX reverse proxy proxy_pass value to 80 (if the port matches, it 'works'). My current poblem is, that the website isn't rendered properly and I get "connection refused" for the vendor.js and app.js which is obviously the heart of the wiki.js App. I don't really know what to do and I've read the official documentation over and over again... meanwhile I've noticed that the official docs use the 3001 port instead of the 3000 port. But it doesn't help actually.

So which of the "some minor adjustments to the guide" I have to do, to get this working?

By: till

All changes were incorporated into the tutorial text above on 2019-02-28.

By: ProfComete

Thanks a lot for the tutorial! If any others run into issues for the last step, setting wiki.js to start on boot with pm2, you might want to install pm2 globally.

To do this, run as root:

npm i -g pm2

and then, back as the wikijs user:

pm2 start server.js

By: Jim

When I performed Step 4, I received the following error when running `sudo apt update`:

N: Skipping acquire of configured file 'nginx/binary-i386/Packages' as repository ' bionic InRelease' doesn't support architecture 'i386'

I was able to resolve this by editing the `/etc/apt/sources.list.d/nginx_mainline.list` and adding `[arch=amd64]` after deb and deb-src then trying again.

Great tutorial. Thank you!

By: Jake Hubner

This has been really helpful, so thank you for making this. I have run into an issue with the nginx config for wiki.js. I was running into issues with certting certs so I skipped it and was going to get them through my hosting site instead. Your config file seems to require them to set up the nginx server (I tried deleting that section, didn't work). Do I need the certs first to set up the server or is there a way around that? Thanks

By: rezabojnordi

change port 80 to 3000 in website configuration 

error for using 80 in panel change to 3000

By: Al

To clarify for anyone with the 502 Bad Gateway error:

The default port for wiki.js is port 80. When you reach the step to configure wiki.js from the web page, make sure to change port 80 to port 3000.

That will allow nginx to connect to it.