TutorialsUbuntuUbuntu Based

How To Install Wiki.js on Ubuntu 20.04 LTS

Install Wiki.js on Ubuntu 20.04

In this tutorial, we will show you how to install Wiki.js on Ubuntu 20.04 LTS. For those of you who didn’t know, Wiki.js is an open-source, modern, and powerful wiki application based on Node.js, Git, and Markdown (.md). Wiki.js also provides a variety of modules that can be easily integrated from the Analytical, Authentication, Databases, Editors, and many more modules.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of Wiki.js on Ubuntu 20.04 (Focal Fossa). You can follow the same instructions for Ubuntu 18.04, 16.04, and any other Debian-based distribution like Linux Mint.


  • A server running one of the following operating systems: Ubuntu 20.04, 18.04, 16.04, and any other Debian-based distribution like Linux Mint.
  • It’s recommended that you use a fresh OS install to prevent any potential issues.
  • SSH access to the server (or just open Terminal if you’re on a desktop).
  • A non-root sudo user or access to the root user. We recommend acting as a non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.

Install Wiki.js on Ubuntu 20.04 LTS Focal Fossa

Step 1. First, make sure that all your system packages are up-to-date by running the following apt commands in the terminal.

sudo apt update
sudo apt upgrade
sudo install apt-transport-https ca-certificates curl gnupg-agent software-properties-common openssl
sudo DEBIAN_FRONTEND=noninteractive apt-get -qqy -o Dpkg::Options::='--force-confdef' -o Dpkg::Options::='--force-confold' dist-upgrade

Step 2. Installing Docker.

It’s recommended to uninstall any old Docker software before proceeding:

sudo apt remove docker docker-engine docker.io

Now we enable the Docker repository, import the repository GPG key, and install the package:

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

Next, add the Docker APT repository to your system:

sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"

Once, that’s imported, update apt again and install it:

sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.io

For additional resources on installing and managing Docker, read the post below:

Step 3. Set up Wiki.js Containers.

Now we create a Wiki.js installation directory with the following command below:

mkdir -p /etc/wiki

Next, generate a database secret like this:

openssl rand -base64 32 > /etc/wiki/.db-secret

Then, we create Docker internal networks for Wiki.js to use:

docker network create wikinet

Also, create a data volume for PostgreSQL:

docker volume create pgdata

Finally, create the containers:

docker create --name=db -e POSTGRES_DB=wiki -e POSTGRES_USER=wiki -e POSTGRES_PASSWORD_FILE=/etc/wiki/.db-secret -v /etc/wiki/.db-secret:/etc/wiki/.db-secret:ro -v pgdata:/var/lib/postgresql/data --restart=unless-stopped -h db --network=wikinet postgres:11
docker create --name=wiki -e DB_TYPE=postgres -e DB_HOST=db -e DB_PORT=5432 -e DB_PASS_FILE=/etc/wiki/.db-secret -v /etc/wiki/.db-secret:/etc/wiki/.db-secret:ro -e DB_USER=wiki -e DB_NAME=wiki -e UPGRADE_COMPANION=1 --restart=unless-stopped -h wiki --network=wikinet -p 80:3000 -p 443:3443 ghcr.io/requarks/wiki:2
docker create --name=wiki-update-companion -v /var/run/docker.sock:/var/run/docker.sock:ro --restart=unless-stopped -h wiki-update-companion --network=wikinet requarks/wiki-update-companion:latest

Step 4. Configure Firewall Rules.

If any firewall is installed and configured on your server, then you will need to allow both ports via UFW. You can allow them with the following command:

sudo ufw allow ssh 
sudo allow http 
sudo allow https
sudo ufw --force enable

Step 5. Start the Wiki.js containers.

Once successfully installed and set up, now start the docker containers using the following command below:

docker start db
docker start wiki
docker start wiki-update-companion

Finally, open your web browser and access the Wiki.js page using the URL http://your-server-ip-address. You should see the Wiki.js default page on the following screen:

Install Wiki.js on Ubuntu 20.04 LTS Focal Fossa

Congratulations! You have successfully installed Wiki.js. Thanks for using this tutorial for installing the Wiki.js on Ubuntu 20.04 LTS Focal Fossa system. For additional help or useful information, we recommend you check the official Wiki.js website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!


r00t is a seasoned Linux system administrator with a wealth of experience in the field. Known for his contributions to idroot.us, r00t has authored numerous tutorials and guides, helping users navigate the complexities of Linux systems. His expertise spans across various Linux distributions, including Ubuntu, CentOS, and Debian. r00t's work is characterized by his ability to simplify complex concepts, making Linux more accessible to users of all skill levels. His dedication to the Linux community and his commitment to sharing knowledge makes him a respected figure in the field.
Back to top button