Step-by-Step Guide: Installing and Configuring Wiki.js with Docker on Rocky Linux 8

Wiki.js is a powerful and modern wiki application that runs on Node.js. It has an easy-to-use interface for creating and managing content. It supports various login methods, offers version control, Markdown editing, allowing you to write content with a live preview, and many plugins for added functionality. Additionally, Wiki.js offers full-text search capabilities and customizable themes and branding to tailor the wiki to your specific needs.

Wiki.js can be used for various purposes, including internal documentation, creating a knowledge base, managing personal knowledge, hosting educational resources, developing a community wiki, documenting projects, and planning events.

In this guide, we will install and configure Wiki.js on Rocky Linux 8 using Docker.

The setup includes Docker, PostgreSQL 15 (dockerized), Wiki.js 2.x (dockerized and accessible via port 80), Wiki.js Update Companion (dockerized), and OpenSSH with UFW firewall preconfigured for SSH, HTTP, and HTTPS.

Update the system:

Before we begin installing Wiki.js and Docker, it's important to ensure that your system is up-to-date. Use the following commands to update your system.

dnf -y update
dnf -y upgrade
Install Docker:

Docker is essential for containerizing Wiki.js and PostgreSQL. First, install the necessary dependencies to install Docker using the following command.

dnf install -y yum-utils

Next, register the Docker package registry to your system.

mkdir -p /etc/pki/rpm-gpg
curl -fsSL https://download.docker.com/linux/centos/gpg -o /etc/pki/rpm-gpg/docker.asc
chmod a+r /etc/pki/rpm-gpg/docker.asc

dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo

Finally, refresh the package updates and install Docker.

dnf makecache

dnf install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

Start and enable the Docker service:

systemctl start docker
systemctl enable docker

By following these steps, you will have Docker installed and ready to use for containerizing your applications.

Setup Containers

You can use the directory name as you wish, but remember to change the commands accordingly if you choose a different directory name.

First, create installation directory for Wiki.js.

mkdir -p /etc/wiki

Next, generate a database secret and save it in the created directory.

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

Create an internal Docker network for the containers to communicate.

docker network create wikinet

Create a data volume for PostgreSQL.

docker volume create pgdata

Now, create the containers for PostgreSQL, Wiki.js, and the Wiki.js Update Companion:

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:15
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 ghcr.io/requarks/wiki-update-companion:latest

By following these steps, you will have set up the necessary containers for Wiki.js, PostgreSQL, and the update companion, ready to be started and used.

If your server has a firewall enabled, you'll need to allow specific ports to ensure proper access.

firewall-cmd --permanent --add-service=ssh
firewall-cmd --permanent --add-service=http
firewall-cmd --permanent --add-service=https
firewall-cmd --reload
Start the containers

To start the Docker containers for PostgreSQL, Wiki.js, and the Wiki.js Update Companion, execute the following commands:

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

These commands will initiate the containers, allowing Wiki.js to be accessible and ensuring that the update companion is running to manage updates seamlessly.

Access the setup wizard

To complete the installation of Wiki.js, simply open your web browser and enter the following URL in the address bar:

http://your-server-ip/

Replace your-server-ip with the actual IP address or domain name of your server where Wiki.js is installed.

Now you will see the setup wizard for Wiki.js, where you can follow the on-screen instructions to finalize the installation according to your preferences.



You've successfully installed and configured Wiki.js, which is a powerful and flexible open-source wiki software. With Wiki.js, you can create and manage your wiki with ease.


CrownCloud - Get a SSD powered KVM VPS at $4.5/month!
Use the code WELCOME for 10% off!

1 GB RAM / 25 GB SSD / 1 CPU Core / 1 TB Bandwidth per month

Available Locations: LAX | MIA | ATL | FRA | AMS