Skip to content

Instructions for Setting up Wiki.js on Debian 12

Guide on Installing Wiki.js on Debian 12 for a Potent, Contemporary Wiki Platform

Installing Wiki.js on Debian 12: A Guide
Installing Wiki.js on Debian 12: A Guide

Instructions for Setting up Wiki.js on Debian 12

### Installing Wiki.js on a Debian 12 Server: A Step-by-Step Guide

Wiki.js, a modern, open-source wiki software built on Node.js and backed by a PostgreSQL database, offers a sleek, intuitive interface combined with extensive customization capabilities. This article will guide you through the process of installing and configuring Wiki.js on a Debian 12 server.

#### Preparing the System

Before you begin, ensure you have a Debian 12 server with a non-root user having sudo privileges. Additionally, have a domain name pointed to your server IP (e.g., `wiki.example.com`).

#### Installing System Dependencies

Start by updating packages and installing essential packages:

```bash sudo apt update sudo apt upgrade -y sudo apt install curl gnupg2 ca-certificates lsb-release apt-transport-https -y ```

Install Node.js (LTS version) and the required build tools:

```bash curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash - sudo apt install nodejs -y ```

Install PostgreSQL server:

```bash sudo apt install postgresql postgresql-contrib -y ```

#### Setting Up PostgreSQL Database for Wiki.js

To set up the PostgreSQL database, switch to the PostgreSQL account and create a new database and user:

```bash sudo -i -u postgres psql CREATE DATABASE wikidb; CREATE USER wikijsuser WITH ENCRYPTED PASSWORD 'your_password'; GRANT ALL PRIVILEGES ON DATABASE wikidb TO wikijsuser; \q exit ```

#### Installing Wiki.js

Create a directory for Wiki.js and switch to it:

```bash sudo mkdir -p /var/www/wikijs sudo chown $(whoami):$(whoami) /var/www/wikijs cd /var/www/wikijs ```

Download the latest Wiki.js release and extract it:

```bash curl -s https://api.github.com/repos/Requarks/wiki/releases/latest | grep "browser_download_url.*wiki-js.tar.gz" | cut -d '"' -f 4 | wget -i - tar -xzf wiki-js.tar.gz ```

Install dependencies:

```bash npm install ```

Configure Wiki.js by setting environment variables or editing the `config.yml` to connect to PostgreSQL, e.g.:

```yaml db: type: postgres host: localhost port: 5432 user: wikijsuser pass: your_password db: wikidb ```

Start Wiki.js:

```bash node server ```

For production, it’s recommended to use a process manager like **PM2**:

```bash sudo npm install pm2@latest -g pm2 start server --name wikijs pm2 startup pm2 save ```

#### Configuring Nginx as a Reverse Proxy

Install Nginx:

```bash sudo apt install nginx -y ```

Create an Nginx site configuration `/etc/nginx/sites-available/wikijs` with content similar to:

```nginx server { listen 80; server_name wiki.example.com;

location / { proxy_pass http://localhost:3000; # Wiki.js default port 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 site:

```bash sudo ln -s /etc/nginx/sites-available/wikijs /etc/nginx/sites-enabled/ sudo nginx -t sudo systemctl restart nginx ```

#### Enabling SSL/TLS with Let’s Encrypt

Install Certbot:

```bash sudo apt install certbot python3-certbot-nginx -y ```

Obtain and install SSL certificate:

```bash sudo certbot --nginx -d wiki.example.com ```

Follow prompts to configure automatic HTTPS redirection.

With these steps, you now have a fully functional Wiki.js installation on your Debian 12 server. Access your Wiki.js instance by opening a browser and visiting the server's IP address. Choose a VPS plan with at least 2 CPUs, 2 GB RAM, and 20 GB SSD to ensure optimal performance. Enjoy exploring the features of Wiki.js, such as its responsive Markdown-first editor, modular architecture, and extensive customization capabilities.

Data-and-cloud-computing allows users to host applications like Wiki.js in cloud environments, ensuring smooth operation and easy scalability. Starting and managing Wiki.js on a Debian 12 server involves leveraging technology, such as Node.js and PostgreSQL, as demonstrated in the guide.

Read also:

    Latest