This guide is a fully detailed guide to install everything necessary to run Wiki.js on a brand new Ubuntu 18.04 / 20.04 / 22.04 LTS machine.
At the end of the guide, you'll have a fully working Wiki.js instance with the following components:
First, let's make sure the machine is up to date.
# Fetch latest updates
sudo apt -qqy update
# Install all updates automatically
sudo DEBIAN_FRONTEND=noninteractive apt-get -qqy -o Dpkg::Options::='--force-confdef' -o Dpkg::Options::='--force-confold' dist-upgrade
# Install dependencies to install Docker
sudo apt -qqy -o Dpkg::Options::='--force-confdef' -o Dpkg::Options::='--force-confold' install ca-certificates curl gnupg lsb-release
# Register Docker package registry
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
# Refresh package udpates and install Docker
sudo apt -qqy update
sudo apt -qqy -o Dpkg::Options::='--force-confdef' -o Dpkg::Options::='--force-confold' install docker-ce docker-ce-cli containerd.io docker-compose-plugin
# Create installation directory for Wiki.js
mkdir -p /etc/wiki
# Generate DB secret
openssl rand -base64 32 > /etc/wiki/.db-secret
# Create internal docker network
docker network create wikinet
# Create data volume for PostgreSQL
docker volume create pgdata
# 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: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
sudo ufw allow ssh
sudo ufw allow http
sudo ufw allow https
sudo ufw --force enable
docker start db
docker start wiki
docker start wiki-update-companion
On your browser, navigate to your server IP / domain name (e.g. http://your-server-ip/ ).
If you can't load the page, wait 5 minutes and try again. It may take a few minutes for the containers to initialize on some systems.
Complete the on-screen setup to finish your installation.
You must complete the setup wizard (see Getting Started) BEFORE enabling Let's Encrypt!
docker stop wiki
docker rm wiki
wiki.example.com
and [email protected]
values with your own domain / sub-domain and the email address of your wiki administrator:docker create --name=wiki -e LETSENCRYPT_DOMAIN=wiki.example.com -e [email protected] -e SSL_ACTIVE=1 -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 start wiki
docker logs wiki
The process will be completed once you see the following lines in the logs:
(LETSENCRYPT) New certifiate received successfully: [ COMPLETED ]
HTTPS Server on port: [ 3443 ]
HTTPS Server: [ RUNNING ]
By default, requests made to the HTTP port will not be redirect to HTTPS. You can enable this option using these instructions:
Redirect HTTP requests to HTTPS
section, click on TURN ON to enable HTTP to HTTPS redirection.You can renew the certificate at any time from the Administration Area > SSL.
If your certificate has expired and you cannot load the wiki UI to renew it, simply restart the container:
docker restart wiki
The renewal process will run automatically during initialization.
During the installation guide, you installed the Wiki.js Update Companion. This feature automates the upgrade process when a new version is available.
When a new version is available, you'll be notified in the Administration Area. To perform the upgrade, follow these simple instructions: