How to Install Wiki.js on Ubuntu 18.04

Wiki.js is a free and open source, modern wiki app built on Node.js, Git and Markdown. Wiki.js source code is publicly hosted on Github. This guide will show you how to install Wiki.js on a fresh Ubuntu 18.04 LTS Vultr instance using Node.js, MongoDB, PM2, Nginx, Git and Acme.sh.

Requirements

Requirements to run Wiki.js and finish this guide are as follows:

  • Node.js version 6.9.0 or later
  • MongoDB version 3.2 or later
  • Nginx
  • Git version 2.7.4 or later
  • Minimum of 768MB RAM
  • Domain name with A/AAAA records set up

Check the Ubuntu version.

lsb_release -ds
# Ubuntu 18.04.4 LTS

Create a new non-root user account with sudo access and switch to it.

adduser johndoe --gecos "John Doe"
usermod -aG sudo johndoe
su - johndoe

NOTE: Replace johndoe with your username.

Set up the timezone.

sudo dpkg-reconfigure tzdata

Ensure that your system is up to date.

sudo apt update && sudo apt upgrade -y

Install necessary packages.

sudo apt install -y build-essential apt-transport-https

Install Git

Git 2.7.4 comes preinstalled on Ubuntu server edition, so we don't need to install it. If you want to install a newer version, you can use third-party PPAs or compile the latest release of Git from source.

You can verify the currently installed version of Git by running:

git --version
# git version 2.7.4

If you want to install a newer version of Git software, you can use the following.

# Remove existing git package
sudo apt remove -y git
sudo apt-get install software-properties-common
sudo add-apt-repository -y ppa:git-core/ppa
sudo apt update && sudo apt upgrade -y
sudo apt install -y git

Verify Git version.

git --version
# git version 2.17.0

Install Node.js

Install Node.js by utilizing the NodeSource APT repository for Node.js.

curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt install -y nodejs

Check the Node.js and NPM versions.

node -v && npm -v
# v8.11.2
# 5.6.0

Install MongoDB

We will use the official MongoDB repositories, which are kept up-to-date with the most recent major and minor MongoDB releases.

Install MongoDB Community Edition.

sudo apt install -y mongodb

Check the version.

mongo --version | head -n 1 && mongod --version | head -n 1
# MongoDB shell version v3.6.3
# db version v3.6.3

Install and configure Nginx

Install Nginx.

wget https://nginx.org/keys/nginx_signing.key
sudo apt-key add nginx_signing.key
rm nginx_signing.key
sudo -s
printf "deb https://nginx.org/packages/mainline/ubuntu/ $(lsb_release -sc) nginx\ndeb-src https://nginx.org/packages/mainline/ubuntu/ $(lsb_release -sc) nginx\n" >> /etc/apt/sources.list.d/nginx_mainline.list
exit
sudo apt update
sudo apt install -y nginx

Check the version.

sudo nginx -v
# nginx version: nginx/1.15.0

Enable and start Nginx.

sudo systemctl enable nginx.service
sudo systemctl start nginx.service

Configure Nginx as a reverse proxy for the Wiki.js application.

Run sudo vim /etc/nginx/conf.d/wiki.js.conf and populate it with the basic reverse proxy configuration below.

server {

    listen [::]:80;
    listen 80;

    server_name wiki.example.com;

    root /usr/share/nginx/html;

    charset utf-8;
    client_max_body_size 50M;

    location /.well-known/acme-challenge/ {
        allow all;
    }

    location / {
        proxy_set_header Host $http_host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_pass http://127.0.0.1:3000;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_next_upstream error timeout http_502 http_503 http_504;
    }

}

The only thing you need to change in the above config is the server_name directive and potentially the proxy_pass directive if you decide to configure any other port besides 3000. Wiki.js uses port 3000 by default.

Check the configuration.

sudo nginx -t

Reload Nginx.

sudo systemctl reload nginx.service

Install Acme.sh client and obtain a Let's Encrypt certificate (optional)

Securing your wiki with HTTPS is not necessary, but it will secure your site's traffic. Acme.sh is a pure unix shell software for obtaining SSL certificates from Let's Encrypt with zero dependencies.

Download and install Acme.sh.

sudo mkdir /etc/letsencrypt
git clone https://github.com/Neilpang/acme.sh.git
cd acme.sh
sudo ./acme.sh --install --home /etc/letsencrypt --accountemail your_email@example.com
cd ~

Check the version.

/etc/letsencrypt/acme.sh --version

Obtain RSA and ECDSA certificates for wiki.example.com domain/hostname.

# RSA 2048
sudo /etc/letsencrypt/acme.sh --issue --home /etc/letsencrypt -d wiki.example.com --webroot /usr/share/nginx/html --reloadcmd "sudo systemctl reload nginx.service" --accountemail your_email@example.com --ocsp-must-staple --keylength 2048
# ECDSA/ECC P-256
sudo /etc/letsencrypt/acme.sh --issue --home /etc/letsencrypt -d wiki.example.com --webroot /usr/share/nginx/html --reloadcmd "sudo systemctl reload nginx.service" --accountemail your_email@example.com --ocsp-must-staple --keylength ec-256 

After running the above commands, your certificates and keys will be in:

  • For RSA: the /etc/letsencrypt/wiki.example.com directory.
  • For ECC/ECDSA: the /etc/letsencrypt/wiki.example.com_ecc directory.

After obtaining certificates from Let's Encrypt, we need to configure Nginx to use them.

Run sudo vim /etc/nginx/conf.d/wiki.js.conf again and configure Nginx as an HTTPS reverse proxy.

server {

    listen [::]:443 ssl http2;
    listen 443 ssl http2;
    listen [::]:80;
    listen 80;

    server_name wiki.example.com;

    root /usr/share/nginx/html;

    charset utf-8;
    client_max_body_size 50M;

    location /.well-known/acme-challenge/ {
        allow all;
    }

    # RSA
    ssl_certificate /etc/letsencrypt/wiki.example.com/fullchain.cer;
    ssl_certificate_key /etc/letsencrypt/wiki.example.com/wiki.example.com.key;
    # ECDSA
    ssl_certificate /etc/letsencrypt/wiki.example.com_ecc/fullchain.cer;
    ssl_certificate_key /etc/letsencrypt/wiki.example.com_ecc/wiki.example.com.key;

    location / {
        proxy_set_header Host $http_host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_pass http://127.0.0.1:3000;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_next_upstream error timeout http_502 http_503 http_504;
    }

}

Check the configuration.

sudo nginx -t

Reload Nginx.

sudo systemctl reload nginx.service

Install Wiki.js

Create an empty document root folder where Wiki.js should be installed.

sudo mkdir -p /var/www/wiki.example.com

Navigate to the document root folder.

cd /var/www/wiki.example.com

Change ownership of the /var/www/wiki.example.com folder to the user johndoe.

sudo chown -R johndoe:johndoe /var/www/wiki.example.com

From the /var/www/wiki.example.com folder, run the following command to download and install Wiki.js.

curl -sSo- https://wiki.js.org/install.sh | bash

To view the currently installed version of Wiki.js, you can run the following command.

node wiki --version
# 1.0.78

Once the installation is completed, you'll be prompted to run the configuration wizard.

Start the configuration wizard.

node wiki configure

This will notify you to browse to http://localhost:3000 to configure Wiki.js. If you have Nginx in front of Wiki.js, you can open your domain name (e.g. http://wiki.example.com) instead of going to localhost.

Using your web browser, navigate to http://wiki.example.com and follow the on-screen instructions. All settings entered during the configuration wizard are saved in the config.yml file. The configuration wizard will automatically start Wiki.js for you.

Install PM2

By default, Wiki.js will not start automatically after a system reboot. In order to make it start on boot, we need to setup PM2. PM2 comes bundled with Wiki.js as a local NPM module, so we don't need to install PM2 globally.

Tell PM2 to configure itself as a startup service.

/var/www/wiki.example.com/node_modules/pm2/bin/pm2 startup

Finally, save the current PM2 configuration.

/var/www/wiki.example.com/node_modules/pm2/bin/pm2 save

Wiki.js runs as a background process, using PM2 as its process manager.



Leave a Comment

Cómo instalar Vtiger CRM Open Source Edition en CentOS 7

Cómo instalar Vtiger CRM Open Source Edition en CentOS 7

Aprende cómo instalar Vtiger CRM, una aplicación de gestión de relaciones con el cliente, en CentOS 7 para aumentar tus ventas y mejorar el servicio al cliente.

Cómo instalar el servidor Counter-Strike 1.6 en Linux

Cómo instalar el servidor Counter-Strike 1.6 en Linux

Esta guía completa le mostrará cómo configurar un servidor Counter-Strike 1.6 en Linux, optimizando el rendimiento y la seguridad para el mejor juego. Aprende los pasos más recientes aquí.

Cómo instalar LiteCart Shopping Cart Platform en Ubuntu 16.04

Cómo instalar LiteCart Shopping Cart Platform en Ubuntu 16.04

LiteCart es una plataforma de carrito de compras gratuita y de código abierto escrita en PHP, jQuery y HTML 5. Es un software de comercio electrónico simple, liviano y fácil de usar.

Cómo instalar MODX Revolution en un CentOS 7 LAMP VPS

Cómo instalar MODX Revolution en un CentOS 7 LAMP VPS

¿Usando un sistema diferente? MODX Revolution es un sistema de gestión de contenido (CMS) de nivel empresarial rápido, flexible, escalable, gratuito y de código abierto escrito i

Instalación de McMyAdmin en Ubuntu 14.10

Instalación de McMyAdmin en Ubuntu 14.10

McMyAdmin es un panel de control del servidor de Minecraft utilizado para administrar su servidor. Aunque McMyAdmin es gratuito, hay varias ediciones, algunas de las cuales son pai

Configurar un servidor TeamTalk en Linux

Configurar un servidor TeamTalk en Linux

TeamTalk es un sistema de conferencia que permite a los usuarios tener conversaciones de audio / video de alta calidad, chat de texto, transferir archivos y compartir pantallas. Es yo

How to Install and Configure CyberPanel on Your CentOS 7 Server

How to Install and Configure CyberPanel on Your CentOS 7 Server

Using a Different System? Introduction CyberPanel is one of the first control panels on the market that is both open source and uses OpenLiteSpeed. What thi

Instalar Grafana en Ubuntu 16.04 LTS

Instalar Grafana en Ubuntu 16.04 LTS

¿Usando un sistema diferente? Introducción Grafana es un software de código abierto que transforma múltiples feeds de sistemas como Graphite, Telegraf, an

Instalar phpBB con Apache en Ubuntu 16.04

Instalar phpBB con Apache en Ubuntu 16.04

PhpBB es un programa de tablón de anuncios de código abierto. Este artículo le mostrará cómo instalar phpBB en la parte superior de un servidor web Apache en Ubuntu 16.04. Fue escrito

Cómo instalar Foreman en Ubuntu 16.04 LTS

Cómo instalar Foreman en Ubuntu 16.04 LTS

¿Usando un sistema diferente? Foreman es una herramienta gratuita y de código abierto que lo ayuda con la configuración y administración de servidores físicos y virtuales. Forema

Configurar un usuario no root con acceso a Sudo en Ubuntu

Configurar un usuario no root con acceso a Sudo en Ubuntu

Tener un solo usuario, que es root, puede ser peligroso. Así que arreglemos eso. Vultr nos brinda la libertad de hacer lo que queramos con nuestros usuarios y nuestros servidores.

Install eSpeak on CentOS 7

Install eSpeak on CentOS 7

Using a Different System? ESpeak can generate text-to-speech (TTS) audio files. These can be useful for many reasons, such as creating your own Turin

Cómo instalar Thelia 2.3 en CentOS 7

Cómo instalar Thelia 2.3 en CentOS 7

¿Usando un sistema diferente? Thelia es una herramienta de código abierto para crear sitios web de comercio electrónico y administrar contenido en línea, escrito en PHP. Código fuente de Thelia i

Instalación de Fuel CMS en Ubuntu 16.04 LTS

Instalación de Fuel CMS en Ubuntu 16.04 LTS

¿Usando un sistema diferente? Fuel CMS es un sistema de gestión de contenido basado en CodeIgniter. Su código fuente está alojado en GitHub. Esta guía le mostrará cómo t

Cómo instalar Couch CMS 2.0 en un VPS LAMP Debian 9

Cómo instalar Couch CMS 2.0 en un VPS LAMP Debian 9

¿Usando un sistema diferente? Couch CMS es un sistema de gestión de contenido (CMS) simple y flexible, gratuito y de código abierto que permite a los diseñadores web diseñar

Monitoree sus dispositivos usando LibreNMS en CentOS 7

Monitoree sus dispositivos usando LibreNMS en CentOS 7

¿Usando un sistema diferente? LibreNMS es un completo sistema de monitoreo de red de código abierto. Utiliza SNMP para obtener los datos de diferentes dispositivos. Una variedad

Cómo configurar la optimización TCP en Linux

Cómo configurar la optimización TCP en Linux

Introducción ¿Tiene problemas con la conectividad cuando los visitantes de otros países acceden a su sitio web? Preguntándose por qué la velocidad de descarga de su extranjero

Cómo implementar Ghost v0.11 LTS en Ubuntu 16.04

Cómo implementar Ghost v0.11 LTS en Ubuntu 16.04

¿Usando un sistema diferente? Ghost es una plataforma de blogs de código abierto que ha estado ganando popularidad entre los desarrolladores y usuarios comunes desde su 201

Cómo instalar Pip en Linux

Cómo instalar Pip en Linux

Pip es una herramienta para administrar paquetes de Python. El uso de un administrador de paquetes permite una gestión eficiente de su servidor. En este tutorial, explicaré cómo t

Cómo instalar Cacti 1.1 en CentOS 7

Cómo instalar Cacti 1.1 en CentOS 7

Cacti es una herramienta de gráficos y monitoreo de red de código abierto y libre escrita en PHP. Con la ayuda de RRDtool (herramienta de base de datos Round-Robin), Cacti se puede usar t

ZPanel y Sentora en CentOS 6 x64

ZPanel y Sentora en CentOS 6 x64

ZPanel, un panel de control de alojamiento web popular, se bifurcó en 2014 a un nuevo proyecto llamado Sentora. Aprende a instalar Sentora en tu servidor con este tutorial.

Cómo instalar Vtiger CRM Open Source Edition en CentOS 7

Cómo instalar Vtiger CRM Open Source Edition en CentOS 7

Aprende cómo instalar Vtiger CRM, una aplicación de gestión de relaciones con el cliente, en CentOS 7 para aumentar tus ventas y mejorar el servicio al cliente.

Cómo instalar el servidor Counter-Strike 1.6 en Linux

Cómo instalar el servidor Counter-Strike 1.6 en Linux

Esta guía completa le mostrará cómo configurar un servidor Counter-Strike 1.6 en Linux, optimizando el rendimiento y la seguridad para el mejor juego. Aprende los pasos más recientes aquí.

¿Puede la IA luchar con un número cada vez mayor de ataques de ransomware?

¿Puede la IA luchar con un número cada vez mayor de ataques de ransomware?

Los ataques de ransomware van en aumento, pero ¿puede la IA ayudar a lidiar con el último virus informático? ¿Es la IA la respuesta? Lea aquí, sepa que la IA es una bendición o una perdición

ReactOS: ¿Es este el futuro de Windows?

ReactOS: ¿Es este el futuro de Windows?

ReactOS, un sistema operativo de código abierto y gratuito, está aquí con la última versión. ¿Puede satisfacer las necesidades de los usuarios de Windows de hoy en día y acabar con Microsoft? Averigüemos más sobre este estilo antiguo, pero una experiencia de sistema operativo más nueva.

Manténgase conectado a través de la aplicación de escritorio WhatsApp 24 * 7

Manténgase conectado a través de la aplicación de escritorio WhatsApp 24 * 7

Whatsapp finalmente lanzó la aplicación de escritorio para usuarios de Mac y Windows. Ahora puede acceder a Whatsapp desde Windows o Mac fácilmente. Disponible para Windows 8+ y Mac OS 10.9+

¿Cómo puede la IA llevar la automatización de procesos al siguiente nivel?

¿Cómo puede la IA llevar la automatización de procesos al siguiente nivel?

Lea esto para saber cómo la Inteligencia Artificial se está volviendo popular entre las empresas de pequeña escala y cómo está aumentando las probabilidades de hacerlas crecer y dar ventaja a sus competidores.

La actualización complementaria de macOS Catalina 10.15.4 está causando más problemas que resolver

La actualización complementaria de macOS Catalina 10.15.4 está causando más problemas que resolver

Recientemente, Apple lanzó macOS Catalina 10.15.4, una actualización complementaria para solucionar problemas, pero parece que la actualización está causando más problemas que conducen al bloqueo de las máquinas Mac. Lee este artículo para obtener más información

13 Herramientas comerciales de extracción de datos de Big Data

13 Herramientas comerciales de extracción de datos de Big Data

13 Herramientas comerciales de extracción de datos de Big Data

¿Qué es un sistema de archivos de diario y cómo funciona?

¿Qué es un sistema de archivos de diario y cómo funciona?

Nuestra computadora almacena todos los datos de una manera organizada conocida como sistema de archivos de diario. Es un método eficiente que permite a la computadora buscar y mostrar archivos tan pronto como presiona buscar.