This article provides a detailed, step-by-step guide for How to Install and Run Wiki.js on Ubuntu VPS.
What is Wiki.js?
Wiki.js is an open-source, modern wiki software built on Node.js that lets individuals, teams, or organizations create and manage knowledge bases, documentation, and internal wikis in a fast, collaborative way.
🔹 Key Features
- Real-time collaboration – Multiple people can edit at the same time.
- Markdown & rich-text editing – Supports Markdown, WYSIWYG, and code highlighting.
- Multi-language support – Built-in interface translations and multilingual content.
- Role-based access control – Granular permissions for users and groups.
- Multiple authentication providers – Supports local logins, LDAP, SAML, OAuth (Google, GitHub, Microsoft, etc.).
- Version history – Tracks every change so you can roll back to previous versions.
- Media management – Upload and organize images, documents, and other assets.
- Integrated search – Full-text search across the entire wiki.
- Theme customization – Control branding, colors, and layout.
- Extensible – Supports modules for diagrams, math formulas, charts, and more.
🔹 Typical Use Cases
- Company internal documentation
- Public product or API documentation
- Project knowledge bases
- Educational resource hubs
- Personal wikis or research repositories
This guide walks you through installing Wiki.js on an Ubuntu VPS from scratch.
Prerequisites
Before you start, make sure you have:
- An Ubuntu 20.04/Ubuntu 22.04 VPS with sudo access
- A domain name (optional but recommended)
- A non-root user with administrative privileges
- PostgreSQL database credentials (we’ll set this up below)
Update your system first:
sudo apt update && sudo apt upgrade -y
📚 How to Install and Run Wiki.js on Ubuntu VPS
To install and run Wiki.js on Ubuntu VPS, follow the steps below:
-
Install Required Packages
Wiki.js requires Node.js, PostgreSQL, and some utilities.
# Install dependencies sudo apt install -y curl gnupg2 software-properties-common apt-transport-https
-
Install Node.js (LTS Version)
Wiki.js recommends Node.js 18 LTS.
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash - sudo apt install -y nodejs
Check the installation:
node -v npm -v
-
Install and Configure PostgreSQL
Wiki.js uses PostgreSQL for data storage.
sudo apt install -y postgresql postgresql-contrib
Create a database and user for Wiki.js:
sudo -u postgres psql
Inside the PostgreSQL shell:
CREATE DATABASE wikijs; CREATE USER wikiuser WITH PASSWORD 'StrongPasswordHere'; ALTER ROLE wikiuser SET client_encoding TO 'UTF8'; ALTER ROLE wikiuser SET default_transaction_isolation TO 'read committed'; ALTER ROLE wikiuser SET timezone TO 'UTC'; GRANT ALL PRIVILEGES ON DATABASE wikijs TO wikiuser; \q
-
Download Wiki.js
Create a directory and download the latest Wiki.js build:
mkdir -p /var/www/wikijs cd /var/www/wikijs curl -sSo- https://wiki.js.org/install.sh | bash
-
Configure Wiki.js
Edit the configuration file to connect to your PostgreSQL database:
nano /var/www/wikijs/config.yml
Find and modify the database section:
db: type: postgres host: localhost port: 5432 user: wikiuser pass: StrongPasswordHere db: wikijs
Save and exit (
CTRL+O
,CTRL+X
). -
Create a Systemd Service
This ensures Wiki.js runs automatically on boot.
sudo nano /etc/systemd/system/wikijs.service
Paste:
[Unit] Description=Wiki.js After=network.target [Service] Type=simple User=www-data WorkingDirectory=/var/www/wikijs ExecStart=/usr/bin/node server Restart=always Environment=NODE_ENV=production [Install] WantedBy=multi-user.target
Save and exit.
Enable and start the service:
sudo systemctl daemon-reload sudo systemctl enable wikijs sudo systemctl start wikijs
Check status:
sudo systemctl status wikijs
-
Configure Nginx Reverse Proxy (Optional but Recommended)
Install Nginx:
sudo apt install -y nginx
Create a server block:
sudo nano /etc/nginx/sites-available/wikijs
Example config:
server { listen 80; server_name wiki.example.com; location / { proxy_pass http://localhost:3000; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade'; proxy_set_header Host $host; proxy_cache_bypass $http_upgrade; } }
Enable the config:
sudo ln -s /etc/nginx/sites-available/wikijs /etc/nginx/sites-enabled/ sudo nginx -t sudo systemctl restart nginx
-
Secure with Let’s Encrypt SSL
sudo apt install -y certbot python3-certbot-nginx sudo certbot --nginx -d wiki.example.com
-
Access Wiki.js
Open your browser and visit:
https://wiki.example.com
(or your VPS IP if no domain is set) and complete the initial setup wizard.
✅ Conclusion
You now know how to install and run Wiki.js on Ubuntu VPS.
This setup ensures your wiki runs securely, starts automatically, and can handle production workloads.