How To Install Wiki.js on Ubuntu 22.04 LTS

Install Wiki.js on Ubuntu 22.04

In this tutorial, we will show you how to install Wiki.js on Ubuntu 22.04 LTS. For those of you who didn’t know, Wiki.js is open-source wiki software that is robust and adaptable, written in javascript, and powered by a Node.js engine. Wiki.js offers support for various databases such as MySQL, MariaDB, and MSSQL with the primary support for PostgreSQL.

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 the Wiki.js on Ubuntu 22.04 (Jammy Jellyfish). You can follow the same instructions for Ubuntu 22.04 and any other Debian-based distribution like Linux Mint, Elementary OS, Pop!_OS, and more as well.

Prerequisites

  • A server running one of the following operating systems: Ubuntu 22.04, 20.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 useror 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 22.04 LTS Jammy Jellyfish

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 apt install build-essential curl file git

Step 2. Installing Docker on Ubuntu 22.04.

By default, the Docker is not available on Ubuntu 22.04 base repository. Now run the following command below to add the Docker repository to the system:

echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list

Next, import the GPG key to your system:

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

After the repository is enabled, now install the latest version of the Docker package using the below command:

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

You can verify that Docker is installed and about the current version:

docker -v

Once successfully installed, enable Docker (to start automatically upon system boot), start, and verify the status using the commands below:

sudo systemctl enable docker
sudo systemctl start docker
sudo systemctl status docker

Step 3. Setup Wiki.js Containers.

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

mkdir -p /etc/wiki

Then, generate a database secret:

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

After that, we create docker internal networks for Wiki.js to us:

docker network create wikinet
docker volume create pgdata

Finally, create the actual containers:

### For database container ###

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:14

### For wiki container ###

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

### For wiki update companion ###

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

Once done, start the docker containers we have created:

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

Step 4. Installing Nginx on Ubuntu 22.04.

By default, the Nginx is available on Ubuntu 22.04 base repository. Now run the following command below to install the latest version of Nginx to your Ubuntu system:

sudo apt install nginx

After successfully installation, enable Nginx (to start automatically upon system boot), start, and verify the status using the commands below:

sudo systemctl enable nginx
sudo systemctl start nginx
sudo systemctl status nginx

Step 5. Configure Firewall.

Ubuntu 22.04 has ufw a firewall running by default. Now we enable connection through ports HTTP and HTTPS:

sudo ufw allow 'Nginx HTTP'
sudo ufw enable
sudo ufw status

Step 6. Accessing Wiki.js Web Interface.

Once successfully installed, 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 22.04 LTS Jammy Jellyfish

Congratulations! You have successfully installed Wiki.js. Thanks for using this tutorial for installing the Wiki.js on Ubuntu 22.04 LTS Jammy Jellyfish 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!