How to Install and Configure Wekan Trello-like Kanban on CentOS 7

 

Wekan is an open source Trello-like kanban board based on the Meteor Javascript framework. It’s a web-based management tool that allows you to create a board for your project collaboration. With the wekan board, you just need to invite a member to the board and you’re good to go. On the wekan board, you can create a card-based task and to-do management, then assign it to the member.

In this tutorial, I will show you step-by-step how to install and configure Wekan Trello-like Kanban on a CentOS 7 server. We will be using the MongoDB as a database and the Nginx web server as a reverse Proxy for the Wekan application. This tutorial will cover some topics in detail including securing the MongoDB database server and configuring Nginx as a Reverse Proxy.

Prerequisites

  • CentOS 7 server
  • Root privileges

What we will do

  1. Install Nodejs
  2. Install and Configure MongoDB
  3. Install Wekan
  4. Run Wekan as a Service on CentOS 7
  5. Install and Configure Nginx as a Reverse Proxy for Wekan
  6. Testing

Step 1 – Install NodeJS using NVM Node Version Manager

Wekan is a nodejs-based application, and it requires the nodejs version 4.8. In this tutorial, we will not install nodejs from the CentOS repository, rather we will install nodejs 4.8 using the nvm Node Version Manager.

Before installing nodejs, add new system user ‘wekan’ using the command below.

useradd -m -s /bin/bash wekan
passwd wekan

Login to the ‘wekan’ user, then download and run the nvm installer script.

su – wekan
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash

Install NodeJS

The command will install nvm under ‘wekan’ user and add new configuration to the ‘.bashrc’ configuration file. Now reload the ‘.bashrc’ file.

source ~/.bashrc

Test using the nvm command as below.

command -v nvm
nvm –version

Now you can see nvm ‘0.33.8’ installed on the system.

Next, install nodejs 4.8 using the nvm command below.

nvm install v4.8
nvm use node

After the installation is complete, check the node version.

node -v

And you will see the nodejs 4.8 is installed on the CentOS 7 server, under the ‘wekan’ user.

nodejs 4.8 is installed

Step 2 – Install and configure MongoDB

In this step, we will install MongoDB 3.2.x using the official repository, and then configure the basic security for MongoDB NoSQL database server.

Go to the ‘/etc/yum.repos.d./ directory and create a new .repo file using the vim editor.

cd /etc/yum.repos.d/
vim mongodb-org-3.2.repo

Paste the following MongoDB repository there.

[mongodb-org-3.2]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.2/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-3.2.asc

Save and exit.

Now install MongoDB using the yum command below.

yum -y install mongodb-org mongodb-org-server mongodb-org-shell mongodb-org-mongos mongodb-org-tools

After the installation is complete, start the MongoDB service and enable it to launch at system boot.

systemctl start mongod
systemctl enable mongod

MongoDB 3.2 has been installed on the CentOS 7 system.

Install and configure MongoDB

Next, we need to configure the MongoDB authentication. Login to the mongo shell and create a new user named ‘admin’ for the superuser access.

Login to the mongo shell.

mongo

Now create new ‘admin’ user with password ‘MyAdminPassword’ with role as ‘root’. Run the MongoDB queries below.

db.createUser(
{
user: “admin”,
pwd: “MyAdminPassword”,
roles: [ { role: “root”, db: “admin” } ]
}
)

The MongoDB admin user has been created.

Configure MongoDB user

Now we need to edit the configuration file ‘/etc/mongod.conf’ to enable the authentication.

Edit the configuration file ‘mongod.conf’ using vim.

vim /etc/mongod.conf

Uncomment the ‘security’ line and add the configuration as shown below.

security:
authorization: enabled

Save and exit.

Now restart the MongoDB service.

systemctl restart mongod

The MongoDB authentication has been enabled.

Next, we need to create a new database and user for Wekan. We will create a new database named ‘wekan’ with user ‘wekan’ and password ‘WekanPassword’.

Login to the mongo shell as the admin user.

mongo -u admin -p

Type the admin password ‘MyAdminPassword’.

And when you get the mongo shell, run the MongoDB queries below.

use wekan
db.createUser(
{
user: “wekan”,
pwd: “WekanPassword”,
roles: [“readWrite”]
}
)

The database and user for wekan installation have been created.

User has been added successfully

Step 3 – Install Wekan

Login as the wekan user.

su – wekan

Download wekan source code using the wget command and extract it.

wget https://github.com/wekan/wekan/releases/download/v0.63/wekan-0.63.tar.gz
tar xf wekan-0.63.tar.gz

And you will get a new directory named ‘bundle’ – go to that directory and install the wekan dependencies using the npm command as shown below.

cd bundle/programs/server
npm install

After all dependencies installation is complete, you will get the result as below.

Install Wekan dependencies

Next, we will try to run Wekan on the system.

Run the following commands to set up the environment variable for the Wekan application.

export MONGO_URL=’mongodb://wekan:[email protected]:27017/wekan?authSource=wekan’
export ROOT_URL=’http://192.168.33.10′
export MAIL_URL=’smtp://user:[email protected]:25/’
export MAIL_FROM='[email protected]’
export PORT=8000

Now go to the ‘bundle’ directory and run the wekan application.

cd ~/bundle
node main.js

Run Wekan

Wekan server is now running under port 8000. Open your web browser and type your server address with port 8000.

http://192.168.33.10:8000/

And you will get the Wekan login page as below.

Wekan login

Wekan is now successfully installed on the CentOS 7 server.

Step 4 – Running Wekan as a Service on CentOS 7

We will be running the wekan application as a service on Ubuntu system. So we need to create new service file under the systemd system directory.

Before creating the wekan service file, we need to create the environment variable file.

Login as the wekan user.

su – wekan

Go to the ‘bundle/’ directory and create new environment variable file ‘.env’ using vim.

cd bundle/
vim .env

Paste the following configuration there.

MONGO_URL='mongodb://wekan:[email protected]:27017/wekan?authSource=wekan'
ROOT_URL='http://wekan.hakase-labs.co'
MAIL_URL='smtp://user:[email protected]:25/'
MAIL_FROM='[email protected]'
PORT=8000
HTTP_FORWARDED_COUNT=1

Save and exit.

Next, come back to your root terminal.

Go to the ‘/etc/systemd/system’ directory and create new service file ‘wekan.service’.

cd /etc/systemd/system
vim wekan.service

Paste the following configuration there.

[Unit]
Description=Wekan Server
After=syslog.target
After=network.target
[Service]
Type=simple
Restart=on-failure
StartLimitInterval=86400
StartLimitBurst=5
RestartSec=10
ExecStart=/home/wekan/.nvm/versions/node/v4.8.7/bin/node bundle/main.js
EnvironmentFile=/home/wekan/bundle/.env
ExecReload=/bin/kill -USR1 $MAINPID
RestartSec=10
User=wekan
Group=wekan
WorkingDirectory=/home/wekan
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=Wekan
[Install]
WantedBy=multi-user.target

Save and exit.

Reload the systemd system using the systemctl command.

systemctl daemon-reload

Start the wekan service and enable it launch everytime at system boot.

systemctl start wekan
systemctl enable wekan

Now check the wekan service using commands below.

netstat -plntu
systemctl status wekan

And following is the result in our case.

Run Wekan as service

Wekan is now running as a service under port 8000 on a CentOS 7 system.

Step 5 – Install and Configure Nginx as a Reverse Proxy for Wekan

In this step, we will install Nginx web server and configure it as a reverse proxy for the wekan service that’s running under port 8000.

Before installing the Nginx web server, add new EPEL (Extra Package for Enterprise Linux) repository.

yum -y install epel-release

Now install nginx from the epel repository using the yum command below.

yum -y install nginx

After the installation is complete, go to the ‘/etc/nginx/’ configuration directory and create new virtual host file ‘wekan.conf’ under the ‘conf.d’ directory.

cd /etc/nginx
vim conf.d/wekan.conf

Paste the following virtual host configuration there.

server {
server_name wekan.hakase-labs.co;
listen 80;
access_log /var/log/nginx/wekan-access.log;
error_log /var/log/nginx/wekan-error.log;
location / {
proxy_set_header   X-Real-IP $remote_addr;
proxy_set_header   Host      $host;
proxy_http_version 1.1;
proxy_set_header   Upgrade $http_upgrade;
proxy_set_header   Connection 'upgrade';
proxy_cache_bypass $http_upgrade;
proxy_pass         http://127.0.0.1:8000;
}
}

Save and exit.

Test nginx configuration and make sure there is no error.

nginx -t

If there is no error, start the Nginx service and enable it to launch at system boot.

systemctl start nginx
systemctl enable nginx

Now check the HTTP port using the netstat command, and make sure it is on the ‘LISTEN’ state.

netstat -plntu

The Nginx virtual host configuration for Wekan has been completed.

Nginx as reverse proxy

Step 6 – Testing

Open your web browser and type the wekan url installation in the address bar.

http://wekan.hakase-labs.co/

And you will be redirected to the login page – click on the ‘Register’ link.

Login to Wekan

Now type your username, email, password, and leave Invitation Code blank.

Create an account

Click the blue ‘Register’ button.

And you will get the ‘Internal Server Error’ message. Leave it and come back to your terminal. Because we will activate the first user from the terminal.

Open your terminal and log in to the mongo shell as a ‘wekan’ user.

mongo -u wekan -p –authenticationDatabase “wekan”

Now activate the user using queries below.

use wekan
db.users.update({username:’hakase’},{$set:{isAdmin:true}})

Exit from the mongo shell.

Exit from Mongo shell

Back to your browser and open again the Wekan url installation.

http://wekan.hakase-labs.co/

Type your username and password, then click the ‘Sign In’ button.

Wekan sign in

And you will get the Wekan user dashboard.

Wekan dashboard

Below is the wekan sample project.

Wekan sample project

Wekan installation on CentOS 7 system with MongoDB and Nginx web server has been completed successfully.

Reference

 

Source