BILLYSOFTACADEMY

HOW TO INSTALL THE WIKI.JS OPEN SOURCE WIKI SOFTWARE ON LINUX UBUNTU 20.04 LTS IN THE CLOUD ON AWS

WIKI.JS is a powerful open source wiki software that allows you to create a website such as wikipedia with absolute ease. It is a free WIKI content management system that makes the process of documentation a joy as you can use it for system / application documentation. WIKI.JS can essentially be installed anywhere and works on virtually any platform and is compatible with either PostgreSQL, MySQL, MariaDB, MS SQL Server or SQLite! It is a highly customizable and scalable WIKI system that has to date been deployed by many individuals and organisations around the world! It also comes with built in integration for authentication, logging, rendering, search and storage from services such as AMAZON AWS, GIT, FACEBOOK, AZURE, DROPBOX, GOOGLE DRIVE and so much more! Watch this video right up to the end to learn how to INSTALL THE WIKI.JS SERVER ON LINUX UBUNTU 20.04 LTS IN THE CLOUD ON AWS. Click on the button below to watch the video tutorial on YOUTUBE.

REQUIREMENTS

In order to complete this tutorial, the following is a list of items that are needed. Please ensure to have these items available before taking implementation action on this tutorial to ensure success:
1) An AWS free tier account or an AWS IAM user account
2) An AWS public static IP address
3) A Linux Ubuntu AWS LIGHTSAIL instance
4) The LAMP Stack for ubuntu and WIKI,JS installation files
5) An SSH client such as the TERMINAL app on MAC and LINUX or the PUTTY app for WINDOWS. 

OVERVIEW

1) Open AWS LIGHTSAIL and create a LINUX UBUNTU instance. Set a static IP address, change the hostname and install system & package updates.
2) Open AWS ROUTE53 and point your domain name to the public IP address of the UBUNTU instance and start the WIKI.JS installation process.
3) Create the WIKI.JS database
4) Create a WIKI.JS system service file and configure it to start automatically at system startup
5) Install NGINX and configure it to work as a reverse proxy and access the WIKI.JS dashboard

STEP 1: Open AWS LIGHTSAIL and create a LINUX UBUNTU instance. Set a static IP address, change the hostname and install system & package updates.

1) Go to aws.amazon.com and click on the SIGN INTO THE CONSOLE button. Enter your IAM or root user accound credentials on the login in form and click on SIGN IN. Use the search bar at the top of the console to search for LIGHTSAIL. Click on the LIGHTSAIL search result to open the AWS LIGHTSAIL web app.

2) In the AWS LIGHTSAIL web app, click on the CREATE INSTANCE button and on the SELECT A PLATFORM section, choose LINUX / UNIX and on the SELECT A BLUEPRINT SECTION, click on the OS ONLY button and click on UBUNTU 20.04 LTS

3) Next, scroll down to the CHOOSE YOUR INSTANCE PLAN section and select the $10 USD plan that allows you to create an instance with 2GB of memory and storage space of 60GB. On the IDENTIFY YOUR INSTANCE section, type in a descriptive name and click on the CREATE INSTANCE button.

4) Click on the NETWORKING tab and click on the CREATE STATIC IP button. Select the WIKI.JS-SERVER instance on the ATTACH TO AN INSTANCE drop down menu, type in a descriptive name for the instance and click on CREATE

5) Click on HOME > INSTANCES and click on the WIKI.JSERVER instance. On the CONNECT tab scroll down and click on DOWNLOAD DEFAULT KEY. Open the TERMINAL application if you are using a MAC or LINUX and run the following commands to change the permissions on the key pair file to read only:

cd Downloads

chmod 400 key-pair-file-name

6) Next, run the following commands to connect to the WIKI.JS-SERVER instance using the key pair file and install system and package updates by running the following commands:

ssh -i ‘key-pair-file-name’ ubuntu@ip-address-of-instance

sudo su

apt-get update && apt-get upgrade

7) Once the update process is complete, run the following command to check the LAN IP ADDRESS of the WIKI.JS-SERVER instance and to edit the hosts file:

ip add list – copy the ip address that is returned by this command

nano /etc/hosts

Add the following entry into the file:

ip-address wikijs-server.yourdomain.com wikijs-server

Press CONTROL + O and CONTROL + X to save and exit out of the hosts file and run the following command to set a new hostname

hostnamectl set-hostname wikijs-server

STEP 2: Open AWS ROUTE53 and point your domain name to the public IP address of the UBUNTU instance and start the WIKI.JS installation process.

8) Go back to the AWS console and use the search bar at the top to search for ROUTE53. Click on the ROUTE53 search result and click on HOSTED ZONES. Click on CREATE RECORD AND and set the RECORD NAME to wiki.js-server. On the VALUE field copy and paste the public IP address of the UBUNTU instance and click on CREATE RECORD.

9) Next, run the following commands to install GIT and NODEJS:

sudo apt install git

curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash –

sudo apt-get install -y nodejs

10) WIKI.JS needs a database to store articles, posts and user data. Run the following commands to install the MARIADB database engine and to create a new database for WIKI.JS:

sudo apt install software-properties-common -y

curl -LsS -O
https://downloads.mariadb.com/MariaDB/mariadb_r
epo_setup

sudo apt-get update

sudo bash mariadb_repo_setup

sudo apt install mariadb-server mariadb-client

sudo systemctl start mariadb

sudo systemctl enable mariadb

11) After installing the MARIADB database engine, it is important to secure the installation to prevent and avoid basic threats especially of you are deploying to a production environment. Run the following command to secure MARIADB:

sudo mysql_secure_installation

When prompted to enter the current password for root, simply press ENTER on your keyboard. Below are prompts and responses that you need to enter:

SWITCH TO UNIX_SOCKET AUTHENTICATION [Y/n]: n

CHANGE THE ROOT PASSWORD [Y/n]: y – enter your custom password

REMOVE ANONYMOUS USERS ? [Y/n]: y

DISALLOW ROOT LOGIN REMOTELY ? [Y/n]: y

REMOVE TEST DATABASE AND ACCESS TO IT [Y/n]: y

RELOAD PRIVILEGE TABLES NOW? [Y/n] y

STEP 3: CREATE THE WIKI.JS DATABASE

12) The next thing to do is to actually create the database for WIKI.JS. To do this run the commands shown below, one command at a time:

mysql -u root -p

CREATE DATABASE wikidb;

CREATE USER ‘wiki_user’@’localhost’ IDENTIFIED BY ‘wiki_password’;

GRANT ALL ON wikidb.* TO ‘wiki_user’@’localhost’ WITH GRANT OPTION;

FLUSH privileges;

EXIT;

13) Once the WIKI.JS database creation process is complete, create a wikijs user, a wikijs folder in the /var/www/html directory and download the wikijs files using wget by running the following commands:

sudo adduser wikijs

sudo mkdir -p /var/www/wikijs

sudo chown wikijs:wikijs /var/www/wikijs

sudo su – wikijs

cd /var/www/wikijs

wget https://github.com/Requarks/wiki/releases/latest/download/wiki-js.tar.gz

14) Next, extract the WIKI.JS archive file and edit the config.yaml file by running the following commands:

tar zxzf wiki-js.tar.gz

cp config.sample.yml config.yml 

nano config.yml

add the following config to the file:

db:
type: mariadb
port: 3306
user: wiki_user
pass: wiki_password db: wikidb
ssl: false
bindIP: 127.0.0.1

15) Once you have applied the above changes, run the following command to test if the server is configured properly:

node server

You should see results as shown  in the image below

STEP 4: Create a WIKI.JS system service file and configure it to start automatically at system startup

16) The next step is to create a system service that will allow WIKI.JS to run constantly as a system service. Run the following command to create the file:

nano /etc/systemd/system/wikijs.service

Add the following config as shown in the image below.

17) Start and enable the WIKI.JS system service by running the following command:

sudo systemctl daemon-reload

sudo systemctl start wikijs

sudo systemctl enable wikijs

The next step is to create a NGINX reverse proxy for the WIKI.JS web application. To do this run the following commands to install NGINX and to create a reverse proxy configuration file:

sudo apt install nginx

nano /etc/nginx/conf.d/wikijs.conf

Add the configuration shown in the image below

18) Run the commands below to test the NGIX configuration, restart the NGINX service and set NGINX to start at system startup:

sudo nginx -t
sudo systemctl restart nginx
sudo systemctl enable nginx

19) Open up a new web browser tab and go to wiki.js-server.yourdomain-name.com. You should now see an Administrator account creation page. Enter your administrator email address, password and site URL on the spaces provided and click on INSTALL

STEP 5: access the WIKI.JS dashboard

20) Enter your credentials on the LOG IN page and click on the ADMINISTRATION button to gain access to the WIKI.JS dashboard

21) From HERE you can start to public articles on your WIKI.JS wiki system