MongoDB is the default database server for Wekan. Start the installation by importing the public key used by the package management system.<\/p>\n
$ apt-key adv --keyserver hkp:\/\/keyserver.ubuntu.com:80 --recv 9DA31620334BD75D9DCB49F368818C72E52529D4<\/pre>\nAdd the MongoDB repository:<\/p>\n
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<\/pre>\nUpdate the apt package index and install the MongoDB server:<\/p>\n
$ apt-get update\r\n$ apt-get install -y mongodb-org<\/pre>\nStart the MongoDB service:<\/p>\n
$ systemctl start mongod.service\r\n$ systemctl enable mongod.service<\/pre>\nVerify installation of MongoDB. You should have version 4.0 or later:<\/strong><\/p>\n$ mongod --version<\/strong>\r\ndb version v4.0.9\r\ngit version: fc525e2d9b0e4bceff5c2201457e564362909765\r\nOpenSSL version: OpenSSL 1.1.0j 20 Nov 2018\r\nallocator: tcmalloc\r\nmodules: none\r\nbuild environment:\r\n distmod: debian92\r\n distarch: x86_64\r\n target_arch: x86_64\r\n<\/pre>\n<\/span>Step 5: Configure MongoDB<\/span><\/h2>\nWe need to configure the MongoDB authentication. We will log in to the mongo shell and create a new \u2018admin\u2019 superuser.\u00a0Log in to MongoDB by running the following command:<\/p>\n
mongo<\/pre>\nThen switch to the DB admin and create a new admin user:<\/p>\n
use admin<\/pre>\nWe will run the Mongo query below to create a new admin user with password and set the role as root.<\/p>\n
db.createUser(\r\n{\r\nuser: \"admin\",\r\npwd: \"MyAdminPassword<\/span>\",\r\nroles: [ { role: \"root\", db: \"admin\" } ]\r\n}\r\n)<\/pre>\nMake sure to replace ‘MyAdminPassword<\/span>‘ with a strong password.<\/p>\nThe Admin user has now been created.<\/p>\n
Restart the MongoDB service and the MongoDB authentication should be enabled.<\/p>\n
systemctl restart mongod<\/pre>\nWe need to create a new database named \u2018wekan\u2019 with user \u2018wekan\u2019 with password \u2018StrongPassword<\/span>\u2019. Change the password accordingly.<\/p>\nLogin to the mongo shell as the admin user.<\/p>\n
mongo -u admin -p<\/pre>\nIn the Mongo shell we will run the following queries:<\/p>\n
use wekan\r\ndb.createUser(\r\n{\r\nuser: \"wekan\",\r\npwd: \"StrongPassword<\/span>\",\r\nroles: [\"readWrite\"]\r\n}\r\n)<\/pre>\nWe successfully created a database and user for Wekan installation.<\/p>\n
<\/span>Step 6: Install Wekan<\/span><\/h2>\nFirst, let’s create a wekan<\/code> user so that root does not run your Wekan application.<\/p>\n$ adduser wekan --disabled-login --no-create-home<\/pre>\nWe will log in as the \u2018wekan\u2019 user.<\/p>\n
$ su - wekan<\/pre>\nWe will download the latest version wekan source code using the wget command and extract it.<\/p>\n
$ wget https:\/\/github.com\/wekan\/wekan\/releases\/download\/v0.63\/wekan-0.63.tar.gz\r\n$ tar xf wekan-0.63.tar.gz<\/pre>\nWe also will make our new user own all of the Wekan install directories so that it can run them without any problems:<\/p>\n
$ chown -R wekan:wekan \/opt\/bundle<\/pre>\nWe will go to that directory and install the Wekan dependencies using the ‘npm’ command.<\/p>\n
$ cd \/opt\/bundle\/programs\/server\r\n$ npm install<\/pre>\nNow we will run the following commands to create the environment variables for the Wekan application.<\/p>\n
$ export MONGO_URL='mongodb:\/\/wekan:StrongPassword@127.0.0.1:27017\/wekan?authSource=wekan'\r\n$ export ROOT_URL='http:\/\/your_ip_address\/'\r\n$ export MAIL_URL='smtp:\/\/user:pass@your_domain.com:25\/'\r\n$ export MAIL_FROM='wekan@your_domain.com'\r\n$ export PORT=8000<\/pre>\nWe will go to the \u2018bundle\u2019 directory and run the Wekan Node.js application.<\/p>\n
$ cd \/opt\/bundle\r\n$ node main.js<\/pre>\nWekan has been successfully installed and it is listening on port 8000.<\/p>\n