Guide for Setting Up Wiki.js on Ubuntu 24.04 Operating System
Setting up Wiki.js, a modern, open-source wiki platform, on Ubuntu 24.04 offers a robust and future-proof solution for knowledge management and documentation systems. This step-by-step guide aims to help you create a performant Wiki.js setup on this Long-Term Support (LTS) version of Ubuntu.
**Preparing Your Server**
1. Ensure you have a fresh Ubuntu 24.04 server with root or sudo access. 2. Open ports 80 (HTTP) and 443 (HTTPS) in the firewall. 3. Point a domain name to your server if you wish to use HTTPS.
**Updating System Packages**
Update your system packages by running the command:
```bash sudo apt update && sudo apt upgrade -y ```
**Installing Node.js**
Wiki.js requires Node.js 16 or later. Install Node.js 18:
```bash curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash - sudo apt install -y nodejs ```
Validate Node.js installation:
```bash node -v ```
**Installing and Configuring PostgreSQL**
Wiki.js works best with PostgreSQL. Install PostgreSQL and its contrib package:
```bash sudo apt install -y postgresql postgresql-contrib ```
Connect to the PostgreSQL server as the postgres user and create a database and user for Wiki.js:
```bash sudo -u postgres psql ```
In the PostgreSQL shell, create a database and user:
```sql CREATE DATABASE wikijs; CREATE USER wikijsuser WITH ENCRYPTED PASSWORD 'strongpassword'; GRANT ALL PRIVILEGES ON DATABASE wikijs TO wikijsuser; \q ```
**Creating a System User for Wiki.js**
For security, run Wiki.js under its own user:
```bash sudo adduser --system --group wikijs ```
**Downloading and Installing Wiki.js**
Use the official Wiki.js binary or clone the repo and install:
```bash sudo mkdir -p /var/www/wikijs sudo chown wikijs:wikijs /var/www/wikijs cd /var/www/wikijs sudo -u wikijs wget https://wiki.js.org/downloads/wikijs.tar.gz sudo -u wikijs tar -xvzf wikijs.tar.gz sudo -u wikijs npm install ```
**Configuring Wiki.js**
Generate the config file or initialize Wiki.js to create one. Set database credentials matching your PostgreSQL setup.
**Setting Up Systemd Service to Run Wiki.js Automatically**
Create `/etc/systemd/system/wikijs.service` with content:
```ini [Unit] Description=Wiki.js After=network.target
[Service] Type=simple User=wikijs WorkingDirectory=/var/www/wikijs ExecStart=/usr/bin/node server Restart=always
[Install] WantedBy=multi-user.target ```
Then enable and start Wiki.js:
```bash sudo systemctl daemon-reload sudo systemctl enable wikijs sudo systemctl start wikijs ```
**Configuring Nginx as a Reverse Proxy**
Install Nginx:
```bash sudo apt install -y nginx ```
Create an Nginx site configuration for Wiki.js on your domain:
```nginx 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; } } ```
Test and enable the config:
```bash sudo nginx -t sudo systemctl reload nginx ```
**Enabling HTTPS with Let's Encrypt**
Use Certbot to secure your site:
```bash sudo apt install -y certbot python3-certbot-nginx sudo certbot --nginx -d wiki.example.com ```
Follow prompts to obtain and install SSL certificates.
**Completion and Access**
Open your browser and navigate to `https://wiki.example.com`. The Wiki.js setup wizard will guide you through the final configuration steps.
This process is adapted from detailed Wiki.js installation tutorials targeting Ubuntu 24.04, ensuring you leverage Node.js 18, PostgreSQL, and secure Nginx reverse proxy with SSL for a robust and future-proof Wiki.js deployment.
A User can create a comprehensive home-and-garden lifestyle blog by picking a domain name and integrating Wiki.js with their Ubuntu 24.04 server, leveraging the out-of-the-box performance of PostgreSQL. Beyond the knowledge management capabilities of Wiki.js, this setup offers a cutting-edge data-and-cloud-computing platform for the storage and management of various digital content, making it a versatile tool for users seeking to integrate technology into their home and personal affairs.