How to Install Wiki.js on Ubuntu 20.04

Install Wiki.js on Ubuntu 20.04 and access one of the most potent, open-source Wiki engines. Based on the working mechanisms of Node.js, Wiki.js is a great way to deal with collaborative writing and editing.

In the following write-up, you’ll learn how to install Wiki.js with no issues whatsoever. The process is pretty simple, and all you need to do is stick to the appropriate approach.

Step 1: Installing Git

The first thing to do is get Git installed on your system. Remember, Wiki.js demands the availability of Git 2.7.4 or above. One way of getting it done is by executing the following command:

$ sudo apt install git

Alternatively, you can install Git by adding a third-party repository simply by invoking the following sets of commands:

install git

Verify the Installation

Post-installation, verify if the process was successful or not by checking the version. You can do that by invoking the version command in the following manner:

$ git --version

Step 2: Install and Enable Node.js

For running Wiki.js on your system with no issues whatsoever, you’ll need your system to have an even-numbered Node.js installed (the version should be above 10. x). 

The easiest way is, of course, to install the utility from the NodeSource repositories. To do that, first, enable the NodeSource repository by running the following command:

install and enable node

As soon as the official repositories are enabled, head over and install Node.js by running the following command:

$ sudo apt-get install -y nodejs

Verifying the Installation

Similar to what we did for Git, run the --version (-v) command and check if the installation of Node.js was successful or not.

Input:

$ node -v && npm -v

Step 3: Installing and Configuring Maria DB

Next up is preparing Maria DB on your system. Make sure the latest supported version is installed by adding the corresponding repository.

Input for adding the repository:

adding repository for mariadb

Once you’ve got the repositories added, install the MariaDB Database server on your Ubuntu 20.04 system using the following set of commands:

$ sudo apt update
$ sudo apt install mariadb-server mariadb-client

Enabling Maria DB

Are you done with the installation? If that’s a yes, the utility is ready to operate. Run the following commands and enable Maria DB to proceed further with Wiki.js

$ sudo systemctl start mariadb
$ sudo systemctl enable mariadb 

From there, you’ll need to harden the instance in the following manner:

install wiki.js

You can now get yourself logged in to the MariaDB shell by employing the password you’ve created in the above step.

mysql -u root -p

Creating Database for Wiki.js

To create a database for Wiki.js, you need to use the following pieces of information inside your Terminal.

configure wiki.js

Step 4: Getting Wiki.js Ready

Start by creating a dedicated user for both the Wiki.js and Node.js processes. It will help enhance the overall security. To create a user, invoke the following command:

$ sudo adduser wikijs

After that, the next task is creating a folder for the concerned wiki.js source code. Here is what you’ll need to do.

Input:

$ sudo mkdir -p /var/www/wikijs

Remember that the created user will own the source code folder. Here, you’ll switch to the created user and then proceed with all the downloading and related pieces of stuff. For grabbing the latest version of Wiki.js source code, use the wget command with sudo privileges in the following manner.

sudo su - wikijs
cd /var/www/wikijs
wget [link]

Finally, get the archive extracted, and you’re good to go.

tar xzf wiki-js.tar.gz
rm wiki-js.tar.gz

Step 5: Configuring Wiki.js on Ubuntu 20.04

After the installation, the wiki.js configuration file will get created. It occurs from the sample config file in the following manner:

cp config.sample.yml config.yml

Here, you can bring desired alterations and adjustments to the created config file by employing a suitable editor, vim. For instance:

vim config.yml

Your task will be accommodating the MariaDB database you created earlier. Simply make the following listed changes:

  • Replace the present database credentials with the correct database credentials. 
  • Alter the Bind IP to something like 127.0.0.1 as it can serve security reasons pretty well.
install wiki.js

Verification

Run the node server command inside your Terminal and verify whether the server is running successfully or not.

Step 6: Create a Systemd Service Specifically for Wiki.js on Ubuntu 20.04

To manage the desired wiki.js services, creating a systemd service file for the same is crucial. While you’re inside the Terminal, simply invoke the following command:

$ sudo vim /etc/systemd/system/wikijs.service

A close look, and you’ll understand that the file contains the following lines.

systemd service

After that, you can save the file and start reloading the system daemon. The command required for that looks something like this:

$ sudo systemctl daemon-reload

Enable Wiki.js

Once done, invoke the following “start” and ” enable” commands and allow the wiki.js services to run.

$ sudo systemctl start wikijs
$ sudo systemctl enable wikijs

Status Checking

Before proceeding any further, make sure you check the status of the service. You can do that by running the following command:

$ systemctl status wikijs

Step 7: Accessing the Web UI of Wiki.js

Until this point, you know how to install Wiki.js on Ubuntu 20.04. Now once you’re done dealing with that, here is how you can seamlessly start accessing the corresponding Web UI.

Launch the browser and access the Wiki.js service using the URL http://IP_address or http://domain_name

After that, get yourself an admin account and install Wiki.js. 

wiki.js

Once redirected to the login page, input the admin credentials and get yourself logged in.

First-time access will come up with two options right from the login screen. While one asks you to create a home, the other will help you proceed to the administration panel.

Make sure you pick the option and start creating the first page. You can do that by clicking on the “+Create Home Page” option.

Provide the desired title, description, and content.

Click “Create”, and you’re done.

That wraps up today’s session. We hope our guide on “how to install Wiki.js on Ubuntu 20.04” has helped you serve your requirements.

If this guide helped you, please share it.

Leave a Reply
Related Posts