1080*80 ad

Installing Wiki.js on Debian 12

Setting up a robust, modern wiki platform on Debian 12 requires careful steps to ensure stability and performance. This guide details the process for installing Wiki.js, a powerful and flexible wiki engine, using best practices.

Before you begin, ensure your Debian 12 system is up-to-date. Run the commands:
sudo apt update
sudo apt upgrade

Next, you’ll need to install several prerequisites. Wiki.js primarily runs on Node.js, and a database is essential for storing content. PostgreSQL is a recommended database for production environments due to its reliability. Install these along with necessary tools:
sudo apt install curl gnupg2 git build-essential
To get a recent version of Node.js, it’s best to use the official NodeSource repository. For Node.js 18 (or a later supported LTS version), you would typically run:
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
sudo apt install nodejs
Verify the installation:
node -v
npm -v

Now, install the PostgreSQL server and client:
sudo apt install postgresql postgresql-contrib
Secure your PostgreSQL installation. Log in as the postgres user to create a database and a user for Wiki.js:
sudo -i -u postgres
createuser --interactive (Follow prompts, make the user non-superuser)
createdb wikijs --owner=your_db_user (Replace your_db_user with the user you just created)
exit (To return to your regular user)

Download the latest stable release of Wiki.js. A common method is using Git:
Navigate to a suitable directory, like /opt: cd /opt
Clone the repository: sudo git clone https://github.com/Requarks/wiki.git wikijs
Change directory into the cloned folder: cd wikijs
Switch to the latest stable release tag. Check the Wiki.js website for the current stable version (e.g., 2.5.x): sudo git checkout 2.5.x (Replace 2.5.x with the actual version tag)

Configure Wiki.js. Copy the example configuration file:
sudo cp config.sample.yml config.yml
Edit the config.yml file:
sudo nano config.yml
Modify the database section to match your PostgreSQL setup:

db:
  type: postgres
  host: localhost
  port: 5432
  user: your_db_user
  pass: your_db_password
  db: wikijs

Ensure you set a strong password (your_db_password) in the file. Also, configure the host and port under the app section, often host: localhost and port: 3000 initially if running behind a reverse proxy.

Install Wiki.js dependencies using npm:
sudo npm install --production

To keep Wiki.js running reliably, especially after reboots, use a process manager like PM2 or set up a systemd service. Using systemd is recommended for integration with Debian.
Create a systemd service file:
sudo nano /etc/systemd/system/wikijs.service
Add the following content (adjust paths if needed):

[Unit]
Description=Wiki.js
After=network.target postgresql.service

[Service]
Type=simple
User=your_system_user  # User to run Wiki.js as (e.g., a dedicated 'wikijs' user, or your user if appropriate)
WorkingDirectory=/opt/wikijs
Environment="NODE_ENV=production"
ExecStart=/usr/bin/node server
Restart=always

[Install]
WantedBy=multi-user.target

Replace your_system_user with the user you want the service to run as. A dedicated user for security is a good practice.
Reload systemd, enable the service, and start it:
sudo systemctl daemon-reload
sudo systemctl enable wikijs
sudo systemctl start wikijs
Check the status: sudo systemctl status wikijs

For public access and SSL encryption, set up a reverse proxy like Nginx. Install Nginx:
sudo apt install nginx
Create an Nginx configuration file for your wiki (e.g., /etc/nginx/sites-available/wikijs.conf):
sudo nano /etc/nginx/sites-available/wikijs.conf
Add a server block configured as a reverse proxy:

server {
    listen 80;
    server_name your_domain_name; # Replace with your domain or IP

    client_max_body_size 50M;

    location / {
        proxy_pass http://localhost:3000; # Or the IP/port Wiki.js is listening on
        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 Host $http_host;
    }
}

Replace your_domain_name. Create a symbolic link to enable the site:
sudo ln -s /etc/nginx/sites-available/wikijs.conf /etc/nginx/sites-enabled/
Test the Nginx configuration and reload:
sudo nginx -t
sudo systemctl reload nginx

Finally, secure your site with SSL using Certbot and Let’s Encrypt:
sudo apt install certbot python3-certbot-nginx
Run Certbot:
sudo certbot --nginx -d your_domain_name
Follow the prompts to automatically configure SSL in your Nginx configuration.

With all steps completed, Wiki.js should be running and accessible via your domain name with HTTPS. Open your web browser and navigate to https://your_domain_name to complete the initial web-based setup and configure your administrator account. This robust installation on Debian 12 provides a solid foundation for your documentation needs.

Source: https://www.howtoforge.com/step-by-step-installing-wikijs-on-debian-12/

900*80 ad

      1080*80 ad