By Arslan Ud Din Shafiq, Alibaba Cloud Community Blog author.
Built on Git, Node.js, and Markdown, Wiki.js is an open-source powerful wiki application that allows you to easily write and manage your content in Markdown format. It uses caching to serve content to its users immediately and allows you to insert images, documents, schemas, links, and videos. Wiki.js provides you a built-in search engine to quickly find your wiki entry and also offers suggestions during the search.
In this tutorial, we will install and set up a Wiki.js on Alibaba Cloud Elastic Compute Service (ECS) with Ubuntu 16.04 installed.
Before proceeding with the installation of any kind of package, use the following command to update your Ubuntu system. To execute this command, remember to login from non-root user with Sudo privileges.
sudo apt update && sudo apt upgrade
Also, you need to install build-essential by running the command below.
sudo apt-get install build-essential -y
Install Apt-Transport-HTTPS by executing the following command.
sudo apt-get install apt-transport-https -y
To install software-properties-common, execute the command below.
sudo apt-get install software-properties-common
Follow the steps below to install the latest version of Git.
Step 1: Add the repository by executing the command below.
sudo add-apt-repository -y ppa:git-core/ppa
Step 2: Update the system to load the added repository by executing the command below.
sudo apt update
Step 3: Execute the following command to begin the installation.
sudo apt install git -y
Step 4: To verify the installation of Git, execute the following command and check the current version of Git.
git --version
Next, we need Node.js for the purpose of this tutorial. To install Node.js execute the steps listed below.
Step 1: Download the setup files by using the following command.
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
Step 2: Now, install Node.js by executing command below.
sudo apt install -y nodejs
For Wiki.js, it is imperative to install MongoDB. In this tutorial, we will install the MongoDB community edition by executing the following command.
sudo apt install -y mongodb
To confirm whether the installation of MongoDB is correctly executed, check the installed version of MongoDB by executing the following command.
mongo --version | head -n 1 && mongod --version | head -n 1
Nginx server is required to set up the reverse proxy and SSL certificate. Follow the steps listed below to install Nginx.
Step 1: Get the Nginx signing key by executing the command below.
wget https://nginx.org/keys/nginx_signing.key
Step 2: Add the downloaded Nginx signing key using the following command.
sudo apt-key add nginx_signing.key
Step 3: Add the repository to sources.list by executing the command below.
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
Step 4: Now, update your system by running the following command.
sudo apt update
Step 5: Execute the command below to start the installation of Nginx.
sudo apt install nginx -y
Step 6: To check whether the installation is correctly implemented, execute the following command and confirm the Nginx version.
sudo nginx -v
Step 7: Now, enable Nginx to ensure that it starts automatically when the system reboots.
sudo systemctl enable nginx.service
Step 8: Now, execute the following command to start Nginx server.
sudo systemctl start nginx.service
Wiki.js works on port 3000. Hence, you need to set up a reverse proxy. To implement this, create an Nginx configuration file for Wiki.js by using the following command.
sudo nano /etc/nginx/conf.d/wiki.conf
A text file will open. Copy and paste the below text in the file and save it.
server {
listen [::]:80;
listen 80;
server_name softpedia.xyz;
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;
}
}
Remember to change softpedia.xyz with your domain name or IP address. Execute the following command to check whether the syntax is correct and the Nginx configuration file is right.
sudo nginx -t
Now, reload the Nginx server to load the newly saved configured file by executing the command below.
sudo systemctl reload nginx.service
Follow the steps listed below to install Wiki.js.
Step 1: Navigate to /var/www/html using the command below. If the following command results in any error, you must be missing /var/www/html folder. You can rectify it by creating a www and html folder.
cd /var/www/html
Step 2: Now, change ownership of /var/www/html directory as shown below.
sudo chown -R aareez:aareez /var/www/html
Step 3: Remove index.html file using the command below.
sudo rm index.html
Also, download the latest stable release of Wiki.js using the command below.
curl -sSo- https://wiki.js.org/install.sh | bash
Step 4: To configure Wiki.js, execute the command below.
node wiki configure
As reverse proxy is already set up, there is no need to concatenate port 3000 at the end of the URL. You can simply access the configuration page from your browser by accessing your domain or IP address to navigate to the following page.
Click the Start button, to check if the system meets the requirements or not. You will be redirected to the following screen.
Click the Continue button to resume the configuration process. Once, you are redirected to the following page, add your site title, hostname, and default port on which you want to access the same. Next, select your desired language and give it public access if you want it to be accessed without a login. If you plan to use SSL, remember to use HTTPS in host instead of HTTP.
Once you click Continue, you will be redirected to the following screen.
On the following screen, you need to select the database and click Connect to continue.
Next, you will see the screen indicating Connected successfully! status. Click the Continue button to move to the next step.
Now, set up paths for data and local repository and click Continue.
If you have any Git repository, you can set it up in the following section otherwise you can skip this step.
Now, you need to set up an Admin account to access the Admin panel by filling in the following form.
Once the configuration is completed, you will see the following screen. Click the Start button to start Wiki.js.
If you have activated firewalls, you need to define a rule in Alibaba Cloud security group for your cloud server to add an exception for port 80/TCP, 443/TCP, and 3000/TCP. You can enable these ports while creating ECS instance, but in case if you have forgotten to unblock these ports, you can follow the procedure in this guide: https://www.alibabacloud.com/help/doc-detail/25471.htm
You need to use Certbot for installing the SSL certificate using Let's Encrypt. To do so, execute the following steps.
Step 1: Update the package using the following command
sudo apt-get update
Step 2: Install software-properties-common by executing the command below.
sudo apt-get install software-properties-common
Step 3: Add the Certbot repository by using the following command.
sudo add-apt-repository ppa:certbot/certbot
Step 4: Use the command below to update the package for loading the added Certbot repository.
sudo apt-get update
Step 5: Now, install python-certbot-nginx using the command below.
sudo apt-get install python-certbot-nginx
Step 6: Execute the following command to get Let's Encrypt SSL issued.
sudo certbot --nginx -d softpedia.xyz
Select Option 2 to redirect the link to https and update virtual host settings for SSL.
After a successful issuance of the SSL certificate, you will be navigated to the following screen.
Now, run the following command to restart the Nginx server.
sudo systemctl restart nginx
Now you can access your Wiki.js by hitting your URL.
There you go! You have successfully installed and configured Wiki.js on your server.
Quick Guide to Install and Configure Thelia on Alibaba Cloud
Alibaba Cloud Database Unlocks a New Achievement in the 2019 Gartner Magic Quadrant
2,599 posts | 762 followers
FollowAlibaba Cloud Community - December 4, 2023
Alibaba Clouder - November 27, 2018
Alibaba Cloud Community - July 3, 2024
Alibaba Clouder - January 17, 2019
Alibaba Clouder - July 23, 2018
Alibaba Clouder - December 4, 2018
2,599 posts | 762 followers
FollowElastic and secure virtual cloud servers to cater all your cloud hosting needs.
Learn MoreLearn More
An encrypted and secure cloud storage service which stores, processes and accesses massive amounts of data from anywhere in the world
Learn MoreMore Posts by Alibaba Clouder