How to Install Wekan Trello-like Kanban on Ubuntu 16.04

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 your 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, and then assign it to your member.

In this tutorial, we will show you how to step-by-step install and configure Wekan Trello-like Kanban on Ubuntu 16.04. We will be using MongoDB as the 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 and configuring Nginx as a Reverse Proxy.

Prerequisites

  • Ubuntu 16.04 server
  • Root privileges

What we will do

  1. Update Repository and Upgrade System
  2. Install Nodejs
  3. Install and Configure MongoDB
  4. Install Wekan
  5. Running Wekan as a Service on Ubuntu 16.04
  6. Install and Configure Nginx as a Reverse Proxy for Wekan
  7. Testing

Step 1 – Update and Upgrade System

Connect to the server using your ssh login.

ssh [email protected]

Now update all repositories on the system, and then upgrade all packages using the apt commands below.

sudo apt update
sudo apt upgrade

Step 2 – Install Nodejs

Wekan is a nodejs based application, and it requires nodejs version 4.8. In this tutorial, we will not install nodejs from the Ubuntu repository, rather we’ll 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 as the ‘wekan’ user, and then download and run the nvm installer script.

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

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

source ~/.bashrc

Now test using the nvm command as below.

command -v nvm
nvm –version

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

Next, install nodejs 4.8 using nvm Node Version Manager.

Run the nvm install commands shown below.

nvm install v4.8
nvm use node

After the installation is complete, check the node version.

node -v

And you should get nodejs 4.8 as installed on the Ubuntu 16.04, under the ‘wekan’ user.

Install Node.js

Step 3 – Install and Configure MongoDB

In this step, we will install and configure MongoDB NoSQL database. Wekan requires MongoDB 3.2.x for its installation.

Add the MongoDB key as well as the repository to the system by running the command below.

sudo apt-key adv –keyserver hkp://keyserver.ubuntu.com:80 –recv EA312927
echo “deb http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.2 multiverse” | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.list

Install and Configure MongoDB

Now update the repository and install MongoDB using the apt command.

sudo apt update
sudo apt install -y 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 every time at system boot.

sudo systemctl start mongod
sudo systemctl enable mongod

MongoDB 3.2 has been installed on the Ubuntu 16.04 system.

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

Login to the mongo shell.

mongo

Create a new ‘admin’ user with password ‘MyAdminPassword’ and set the 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.

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.

MongoDB authentication

Next, we need to create new database and user for Wekan. We will create a new database named ‘wekan’ with user ‘wekan’ with 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.

database and user for wekan installation

Step 4 – Install Wekan

Login as the ‘wekan’ user.

su – wekan

Download the latest version 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 the installation is complete, you will get the result as shown below.

Install Wekan

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

Run the following commands to set up the environment variables for 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 Node.js application.

cd ~/bundle
node main.js

wekan nodejs application

Wekan server is now running under port 8000. Open your web browser and type your server address with port 8000. Mine is http://192.168.33.10:8000/

And you will get the Wekan login page as shown below.

Wekan Login

Wekan is now successfully installed on the Ubuntu 16.04.

Step 5 – Configure Wekan as a Service

We will be running the Wekan application as a service on Ubuntu system. So we need to create new service file under the systemd 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.

Now back to your root terminal and go to the ‘/etc/systemd/system’ directory, then create a 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 to launch every time at system boot.

systemctl start wekan
systemctl enable wekan

Wekan Service

Now check the Wekan service using commands below.

netstat -plntu
systemctl status wekan

And following are the results.

Wekan started

Wekan is now running under port 8000, running as a service on Ubuntu 16.04 system.

Step 6 – Install Nginx as a Reverse proxy for Wekan

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

Install Nginx web server from the Ubuntu repository using the apt command below.

sudo apt install nginx -y

After the installation is complete, go to the ‘/etc/nginx/sites-available’ directory and create a new virtual host file ‘wekan’.

cd /etc/nginx/sites-available
vim wekan

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.

Now activate the virtual host and run test nginx configuration, and make sure there is no error.

ln -s /etc/nginx/sites-available/wekan /etc/nginx/sites-enabled/
nginx -t

Assuming everything went fine, now restart the Nginx service and enable it to launch every time at system boot.

systemctl restart nginx
systemctl enable nginx

Configure and start Nginx

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

netstat -plntu

Nginx started

Configuration of Nginx virtual host for the Wekan Node.js application has been completed.

Step 7 – Testing

Open your web browser and type the Wekan installation URL on the address bar, mine is http://wekan.hakase-labs.co/

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

Wekan - Sign in

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

Username and password

Click the blue ‘Register’ button.

And you will likely get the ‘Internal Server Error’ message – leave it and 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 ‘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.

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.

Sign in

And now you should get the Wekan user dashboard.

Wekan Dashboard

Below is the wekan sample project.

wekan sample project

Wekan installation on Ubuntu 16.04 with MongoDB and Nginx web server has been completed successfully.

Reference

Share this page:

نوشته های مشابه