How To Install Wiki.js on Ubuntu 24.04 LTS
Wiki.js has emerged as one of the most powerful and flexible open-source wiki applications available today. Built on Node.js, this modern wiki platform offers an intuitive interface for creating and managing documentation, knowledge bases, and collaborative content. Whether you’re a developer looking to document your projects, a company seeking to create internal documentation, or an educational institution building learning resources, Wiki.js provides the tools you need.
This comprehensive guide will walk you through the complete installation process of Wiki.js on Ubuntu 24.04 LTS. You’ll learn both Docker-based and native installation methods, ensuring you can choose the approach that best fits your infrastructure needs. By the end of this tutorial, you’ll have a fully functional, production-ready Wiki.js installation with proper security configurations and performance optimizations.
Ubuntu 24.04 LTS provides the perfect foundation for hosting Wiki.js, offering long-term support, enhanced security features, and excellent package availability. The stability and reliability of this LTS release make it an ideal choice for production deployments where uptime and consistency are crucial.
Prerequisites and System Requirements
Before diving into the installation process, it’s essential to ensure your system meets the necessary requirements for running Wiki.js effectively.
Hardware Requirements
Wiki.js runs efficiently on modest hardware configurations, making it accessible for various deployment scenarios. The minimum hardware specifications include at least 1GB of RAM for Linux systems, though Windows and macOS typically require additional memory. While Wiki.js operates perfectly on a single CPU core, 2 cores or more are recommended to fully utilize the background workers and ensure optimal performance.
Storage requirements depend heavily on your content strategy. Text-only wikis rarely exceed a few megabytes, but once you begin uploading images, videos, and other media files, storage needs increase significantly. A minimum of 1GB dedicated storage for Wiki.js is recommended as a starting point.
Software Dependencies
The software stack for Wiki.js requires several key components. Node.js serves as the primary runtime environment, with version compatibility ranging from 6.11.1 to modern releases. Database support includes PostgreSQL, MongoDB, and MariaDB, providing flexibility in choosing your preferred data storage solution.
Git version 2.7.4 or later is required for version control functionality, while web server software like Nginx or Apache handles reverse proxy configurations. These dependencies work together to create a robust, scalable wiki platform.
Network and Security Considerations
Network configuration involves opening specific ports for web traffic. Standard HTTP (port 80) and HTTPS (port 443) connections are required for web access, while the default Wiki.js service runs on port 3000. Proper firewall configuration ensures security while maintaining accessibility.
Domain name setup should be completed before installation, as Wiki.js requires a proper domain configuration for optimal functionality. SSL certificate planning, preferably through Let’s Encrypt, should also be considered during the initial setup phase.
Initial System Setup and Preparation
Updating Ubuntu 24.04 System
Begin by ensuring your Ubuntu 24.04 system is completely up-to-date. This step is crucial for security and compatibility reasons. Execute the following commands to refresh package repositories and install all available updates:
sudo apt -qqy update
sudo DEBIAN_FRONTEND=noninteractive apt-get -qqy -o Dpkg::Options::='--force-confdef' -o Dpkg::Options::='--force-confold' dist-upgrade
The DEBIAN_FRONTEND=noninteractive
parameter ensures automated installation without manual intervention, while the Dpkg options handle configuration file conflicts gracefully.
Installing Essential Packages
Several essential packages are required for the Wiki.js installation process. Install the necessary development tools and utilities:
sudo apt-get install -y ca-certificates curl gnupg lsb-release wget git build-essential
These packages provide SSL certificate handling, secure downloading capabilities, GPG key management, and compilation tools necessary for Node.js modules and other dependencies.
User Account and Security Setup
Create a dedicated user account for running Wiki.js services. This approach follows security best practices by isolating the application from system-level privileges:
sudo adduser wikijs
sudo usermod -aG sudo wikijs
Set appropriate directory permissions and ownership to ensure the Wiki.js user can access necessary files while maintaining security boundaries.
Firewall Configuration
Configure UFW (Uncomplicated Firewall) to secure your system while allowing necessary traffic:
sudo ufw enable
sudo ufw allow ssh
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
This configuration opens SSH for remote administration, HTTP for initial setup, and HTTPS for secure production access.
Database Installation and Configuration
Installing PostgreSQL
PostgreSQL serves as the recommended database backend for Wiki.js due to its reliability and performance characteristics. Install PostgreSQL on Ubuntu 24.04:
sudo apt-get update
sudo apt-get install postgresql postgresql-contrib
Start and enable the PostgreSQL service to ensure it runs automatically on system boot:
sudo systemctl start postgresql
sudo systemctl enable postgresql
Verify the installation by checking the service status and version information.
Database Setup for Wiki.js
Create a dedicated database and user for Wiki.js. Switch to the PostgreSQL user and access the database console:
sudo su - postgres
psql
Execute the following SQL commands to set up the database environment:
CREATE DATABASE wikijs;
CREATE USER wikijs_user WITH ENCRYPTED PASSWORD 'secure_password_here';
GRANT ALL PRIVILEGES ON DATABASE wikijs TO wikijs_user;
\q
Replace secure_password_here
with a strong, unique password. Document these credentials securely as they’ll be needed during Wiki.js configuration.
Alternative: Docker PostgreSQL Setup
For containerized deployments, PostgreSQL can be deployed using Docker. Create a Docker Compose configuration for the database:
version: '3.8'
services:
postgres:
image: postgres:15
environment:
POSTGRES_DB: wikijs
POSTGRES_USER: wikijs_user
POSTGRES_PASSWORD: secure_password_here
volumes:
- postgres_data:/var/lib/postgresql/data
ports:
- "5432:5432"
volumes:
postgres_data:
This configuration provides persistent data storage and proper networking for the Wiki.js application.
Node.js Installation and Environment Setup
Installing Node.js via NodeSource Repository
Wiki.js requires a compatible Node.js version. Install Node.js using the official NodeSource repository for the latest stable release:
sudo apt-get install -y ca-certificates curl gnupg
mkdir -p /etc/apt/keyrings
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_22.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list
Update the package repository and install Node.js:
sudo apt update
sudo apt-get install -y nodejs
Environment Verification
Verify the Node.js installation by checking version information:
node -v
npm -v
Ensure the PATH environment variable includes Node.js binaries and that the installation completed successfully. Proper version output confirms a functional Node.js environment.
Alternative: Node Version Manager (NVM)
For development environments or situations requiring multiple Node.js versions, consider using Node Version Manager (NVM). This tool allows easy switching between Node.js versions and provides greater flexibility for testing and development scenarios.
Wiki.js Download and Installation
Downloading Wiki.js
Create the installation directory and switch to the Wiki.js user account:
sudo mkdir -p /var/www/wikijs
sudo chown wikijs:wikijs /var/www/wikijs
sudo su - wikijs
cd /var/www/wikijs
Download the latest Wiki.js release from GitHub:
wget https://github.com/requarks/wiki/releases/download/v2.5.307/wiki-js.tar.gz
Directory Structure Setup
Extract the downloaded archive and organize the file structure:
tar xzf wikijs.tar.gz
rm wikijs.tar.gz
ls -la
The extraction creates the necessary directory structure with all required Wiki.js files. Verify that extraction completed successfully by listing the directory contents.
Configuration File Setup
Copy the sample configuration file and customize it for your environment:
cp config.sample.yml config.yml
nano config.yml
Configure the database connection parameters:
db:
type: postgres
host: localhost
port: 5432
user: wikijs_user
pass: secure_password_here
db: wikijs
ssl: false
bindIP: 127.0.0.1
port: 3000
The bindIP
setting of 127.0.0.1 ensures Wiki.js only accepts local connections, which is appropriate when using a reverse proxy configuration.
Initial Installation Process
Run the initial installation to install dependencies and initialize the application:
node server
This command starts the Wiki.js server and performs initial setup tasks. Monitor the output for any error messages or configuration issues. Stop the server with Ctrl+C once initialization completes successfully.
Docker-Based Installation (Alternative Method)
Docker and Docker Compose Setup
For users preferring containerized deployments, Docker provides an excellent alternative installation method. Install Docker and Docker Compose on Ubuntu 24.04:
sudo apt-get install -y ca-certificates curl gnupg lsb-release
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
sudo apt update
sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin
Wiki.js Docker Deployment
Create a comprehensive Docker Compose configuration:
version: '3.8'
services:
wikijs:
image: requarks/wiki:latest
depends_on:
- postgres
environment:
DB_TYPE: postgres
DB_HOST: postgres
DB_PORT: 5432
DB_USER: wikijs_user
DB_PASS: secure_password_here
DB_NAME: wikijs
ports:
- "3000:3000"
restart: unless-stopped
postgres:
image: postgres:15
environment:
POSTGRES_DB: wikijs
POSTGRES_USER: wikijs_user
POSTGRES_PASSWORD: secure_password_here
volumes:
- postgres_data:/var/lib/postgresql/data
restart: unless-stopped
wikijs-update:
image: requarks/wiki-update-companion:latest
volumes:
- /var/run/docker.sock:/var/run/docker.sock
environment:
WIKI_UPDATE_COMPANION_AUTH: your_auth_token_here
restart: unless-stopped
volumes:
postgres_data:
Deploy the stack using Docker Compose:
docker-compose up -d
This configuration includes the Wiki.js application, PostgreSQL database, and update companion service for automated updates.
Web Server Configuration (Nginx)
Nginx Installation and Basic Setup
Install Nginx as a reverse proxy to handle web traffic and SSL termination:
sudo apt-get update
sudo apt-get install nginx
sudo systemctl start nginx
sudo systemctl enable nginx
Basic security hardening involves removing server version information and configuring appropriate headers.
Reverse Proxy Configuration
Create a virtual host configuration for Wiki.js:
sudo nano /etc/nginx/sites-available/wikijs
Add the following configuration:
server {
listen 80;
server_name wiki.example.com;
location / {
proxy_pass http://127.0.0.1:3000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Port $server_port;
}
}
Enable the site:
sudo ln -s /etc/nginx/sites-available/wikijs /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl reload nginx
SSL/TLS Certificate Setup
Install Certbot for Let’s Encrypt SSL certificates:
sudo apt-get install certbot python3-certbot-nginx
sudo certbot --nginx -d wiki.example.com
This automatically configures SSL and sets up certificate renewal. The configuration updates include HTTPS redirects and security headers.
Systemd Service Configuration
Creating Systemd Service File
Create a systemd service file for automatic Wiki.js startup:
sudo nano /etc/systemd/system/wikijs.service
Add the service configuration:
[Unit]
Description=Wiki.js
After=network.target postgresql.service
[Service]
Type=simple
ExecStart=/usr/bin/node server
Restart=always
User=wikijs
Environment=NODE_ENV=production
WorkingDirectory=/var/www/wikijs
[Install]
WantedBy=multi-user.target
Service Management
Enable and start the Wiki.js service:
sudo systemctl daemon-reload
sudo systemctl enable wikijs
sudo systemctl start wikijs
sudo systemctl status wikijs
Monitor logs using journalctl:
sudo journalctl -u wikijs -f
This provides real-time log monitoring for troubleshooting and maintenance purposes.
Initial Wiki.js Configuration
Web-Based Setup Wizard
Access the Wiki.js installation through your web browser at https://wiki.example.com
. The setup wizard guides you through initial configuration steps.
Create an administrator account with a strong password and configure basic site information. Disable telemetry if privacy is a concern, though this information helps improve the software.
Essential Configuration Options
Configure authentication methods based on your organization’s requirements. Wiki.js supports local authentication, LDAP, OAuth providers, and various other authentication systems.
Set up storage options for uploaded files, backups, and content synchronization. Configure search engines, analytics integration, and other optional features based on your specific needs.
Security Hardening and Best Practices
System-Level Security
Implement proper file permissions and access controls. Regularly update system packages and Wiki.js itself to maintain security. Configure log rotation to prevent disk space issues.
Wiki.js Specific Security
Enable two-factor authentication for administrator accounts. Configure user roles and permissions carefully to maintain content integrity. Regular backups ensure data protection and recovery capabilities.
Consider implementing rate limiting and DDoS protection at the network level for production deployments.
Troubleshooting Common Issues
Installation Problems
Common installation issues include dependency conflicts, permission errors, and database connection problems. Verify Node.js version compatibility and ensure all prerequisites are properly installed.
Port binding issues may occur if other services use the same ports. Use the netstat
command to identify port conflicts and adjust configurations accordingly.
Runtime Issues
Memory management becomes important for high-traffic installations. Monitor system resources and adjust configurations as needed. Performance optimization may require database tuning and caching configurations.
Configuration Problems
SSL certificate issues often relate to domain configuration or DNS problems. Verify domain resolution and certificate validity using online tools.
If the setup page doesn’t load properly, ensure the domain is set correctly in the configuration file rather than using localhost.
Maintenance and Updates
Updating Wiki.js
Regular updates ensure security and feature improvements. For Docker installations, update container images regularly. Native installations require downloading new releases and following upgrade procedures.
Always backup your database and configuration files before performing updates. Test updates in a staging environment when possible.
System Maintenance
Implement regular maintenance schedules including system updates, log rotation, and performance monitoring. Database maintenance involves optimizing tables and monitoring query performance.
Congratulations! You have successfully installed Wiki.js. Thanks for using this tutorial for installing Wiki.js on Ubuntu 24.04 LTS system. For additional help or useful information, we recommend you check the official Wiki.js website.