How to Install Wekan on Debian 9

 

In this tutorial, we will cover the steps needed for installing Wekan on a Debian 9 VPS.

Wekan is a free, flexible, and open-source Kanban Board. With Wekan, we can create boards and cards which can be moved between a number of columns. Wekan allows you to invite members to the board and assign tasks to a specific member. This maximizes productivity in a team because each member can see exactly how far along all tasks are, and focus on tasks based on their priority. The install process won’t take long, so let’s begin with the installation.

Table of Contents

Prerequisites

  • For the purposes of this tutorial, we will use a Debian 9 VPS.
  • At least 1 GB of free RAM for Wekan. A production server should have a minimum total of 4 GB of RAM.
  • Full SSH access using the root account, or a user with sudo privileges is also required.

Step 1: Getting Started

Connect to your server via SSH as the root user using the following command:

ssh [email protected]_ADDRESS -p PORT_NUMBER

and replace “IP_ADDRESS” and “PORT_NUMBER” with your actual server IP address and SSH port number. Replace ‘root’ to a different account’s username if necessary.

Before starting with the installation, you will need to update your system packages to their latest versions.

You can do this by running the following command:

apt-get update 
apt-get upgrade

Step 2: Install Node.js

On Debian systems, you can install Node.js from the NodeSource repository:

$ apt-get update
$ apt install curl git gcc g++ make

After that, install the Node.js repository with the following command

$ curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -

After that, run the commands below to install Node.js:

$ apt-get install nodejs

Step 3: Check the Node.js Version

After completing the installation, check and verify the installed version of Node.js and NPM. You can find more details about the current version on the Node.js official website.

$ node -v 

v12.2.0

Also, check the version of NPM.

$ npm -v 

6.9.0

If they are the versions shown above or newer, you can proceed with the next step.

Step 4: Install the MongoDB Database Server

MongoDB is the default database server for Wekan. Start the installation by importing the public key used by the package management system.

$ apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 9DA31620334BD75D9DCB49F368818C72E52529D4

Add the MongoDB repository:

echo "deb http://repo.mongodb.org/apt/debian stretch/mongodb-org/4.0 main" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.0.list

Update the apt package index and install the MongoDB server:

$ apt-get update
$ apt-get install -y mongodb-org

Start the MongoDB service:

$ systemctl start mongod.service
$ systemctl enable mongod.service

Verify installation of MongoDB. You should have version 4.0 or later:

$ mongod --version
db version v4.0.9
git version: fc525e2d9b0e4bceff5c2201457e564362909765
OpenSSL version: OpenSSL 1.1.0j  20 Nov 2018
allocator: tcmalloc
modules: none
build environment:
    distmod: debian92
    distarch: x86_64
    target_arch: x86_64

Step 5: Configure MongoDB

We need to configure the MongoDB authentication. We will log in to the mongo shell and create a new ‘admin’ superuser. Log in to MongoDB by running the following command:

mongo

Then switch to the DB admin and create a new admin user:

use admin

We will run the Mongo query below to create a new admin user with password and set the role as root.

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

Make sure to replace ‘MyAdminPassword‘ with a strong password.

The Admin user has now been created.

Restart the MongoDB service and the MongoDB authentication should be enabled.

systemctl restart mongod

We need to create a new database named ‘wekan’ with user ‘wekan’ with password ‘StrongPassword’. Change the password accordingly.

Login to the mongo shell as the admin user.

mongo -u admin -p

In the Mongo shell we will run the following queries:

use wekan
db.createUser(
{
user: "wekan",
pwd: "StrongPassword",
roles: ["readWrite"]
}
)

We successfully created a database and user for Wekan installation.

Step 6: Install Wekan

First, let’s create a wekan user so that root does not run your Wekan application.

$ adduser wekan --disabled-login --no-create-home

We will log in as the ‘wekan’ user.

$ su - wekan

We will 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

We also will make our new user own all of the Wekan install directories so that it can run them without any problems:

$ chown -R wekan:wekan /opt/bundle

We will go to that directory and install the Wekan dependencies using the ‘npm’ command.

$ cd /opt/bundle/programs/server
$ npm install

Now we will run the following commands to create the environment variables for the Wekan application.

$ export MONGO_URL='mongodb://wekan:[email protected]:27017/wekan?authSource=wekan'
$ export ROOT_URL='http://your_ip_address/'
$ export MAIL_URL='smtp://user:[email protected]_domain.com:25/'
$ export MAIL_FROM='[email protected]_domain.com'
$ export PORT=8000

We will go to the ‘bundle’ directory and run the Wekan Node.js application.

$ cd /opt/bundle
$ node main.js

Wekan has been successfully installed and it is listening on port 8000.

Step 7: Configure Wekan SystemD Service

You now have Wekan up and running, but it will stop running once you close the terminal session. To prevent this, we need to create a SystemD service so that it’s run by the system instead of the user.

Create a file named wekan.service in /etc/systemd/system/, using your preferred text editor:

$ cd /etc/systemd/system/
$ nano wekan.service

Paste the following content:

[Unit]
Description=Wekan Server
After=syslog.target
After=network.target

[Service]
Type=simple
Restart=always
StandardOutput=syslog
SyslogIdentifier=Wekan
User=wekan
Group=wekan
Environment=MONGO_URL=mongodb://127.0.0.1:27017/wekan
Environment=ROOT_URL=https://example.com
Environment=PORT=8000
Environment=MAIL_URL=smtp://user:[email protected]example.com:25/
WorkingDirectory=/opt/bundle
ExecStart=/usr/bin/node /opt/bundle/main.js

[Install]
WantedBy=multi-user.target

Make sure to replace ‘example.com‘ with your registered domain name. Save and close the file.
To make the SystemD aware of this new file, run the following command:

$ systemctl daemon-reload

Start the Wekan service and enable it.

$ systemctl start wekan
$ systemctl enable wekan

Step 8: Access Wekan

Open your favorite web browser and type the URL http://your_ip_address:8000. We will be redirected to the Wekan log in page.

How to install Wekan on Debian 9

How to install Wekan on Debian 9

That’s it. If you followed all of the instructions properly, you should now be able to access your Wekan installation on your Debian 9 server.