<\/span><\/h2>\nBefore installing Node.js, we will add a new system user ‘wekan’. We need to install Node.js because Wekan is a Node.js-based application.<\/p>\n
useradd -m -s \/bin\/bash wekan\r\npasswd wekan<\/pre>\nWe need to log in as the ‘wekan’ user and install Node.js.<\/p>\n
su - wekan\r\ncurl -o- https:\/\/raw.githubusercontent.com\/creationix\/nvm\/v0.33.8\/install.sh | bash<\/pre>\nNow we will install nvm<\/code> as the wekan user, after which we will add a new configuration in the .bashrc<\/code> configuration file.<\/p>\nsource ~\/.bashrc<\/pre>\nWe will test the nvm installation using the following commands:<\/p>\n
command -v nvm\r\nnvm --version<\/pre>\nTo install Node.js, we have to run the commands shown below:<\/p>\n
nvm install v4.8\r\nnvm use node<\/pre>\nThe Node.js installation has been completed. To test and check the version, run the following command:<\/p>\n
node -v<\/code><\/pre>\n<\/span>Step 2: Installing and Configuring MongoDB<\/span><\/h2>\nIn this step, we need to configure and install the MongoDB NoSQL database server. We need to add the MongoDB key and the repository to the system. This lets us install MongoDB through the package manager. Start by running the following commands:<\/p>\n
sudo apt-key adv --keyserver hkp:\/\/keyserver.ubuntu.com:80 --recv EA312927\r\necho \"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<\/pre>\nNow, we will update the repository and install MongoDB using the apt command.<\/p>\n
sudo apt update\r\nsudo apt install mongodb-org mongodb-org-server mongodb-org-shell mongodb-org-mongos mongodb-org-tools<\/pre>\nMongoDB installation has been completed. We will start the MongoDB service and enable it.<\/p>\n
sudo systemctl start mongod\r\nsudo systemctl enable mongod<\/pre>\nWe need to configure the MongoDB authentication. We will log in to the mongo shell and create a new ‘admin’ superuser.<\/p>\n
mongo<\/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. The admin user has now been created.<\/p>\nNow we will enable the authentication by editing the MongoDB configuration file, we’ll use nano, but you can use any text editor that you prefer.<\/p>\n
nano \/etc\/mongod.conf<\/pre>\nFind the ‘security’ line and edit the configuration:<\/p>\n
security:\r\nauthorization: enabled<\/pre>\nSave and close.<\/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 ‘wekan’ with user ‘wekan’ with password ‘StrongPassword<\/span>‘ Again, replace it to something stronger when you do this.<\/p>\nLog in 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 3: Install Wekan<\/span><\/h2>\nFirst, we will log in as the ‘wekan’ user.<\/p>\n
su - wekan<\/pre>\nWe will download the latest version of the wekan source code using the wget command before extracting it.<\/p>\n
wget https:\/\/github.com\/wekan\/wekan\/releases\/download\/v0.63\/wekan-0.63.tar.gz\r\ntar xf wekan-0.63.tar.gz<\/pre>\nIt will download a new directory named ‘bundle’. We will go to that directory and install the Wekan dependencies using the npm<\/code> command.<\/p>\ncd bundle\/programs\/server\r\nnpm install<\/pre>\nNow, we will run the following commands to create the environment variables for Wekan application.<\/p>\n
export MONGO_URL='mongodb:\/\/wekan:StrongPassword<\/span>@127.0.0.1:27017\/wekan?authSource=wekan'\r\nexport ROOT_URL='http:\/\/your_ip_address<\/span>\/'\r\nexport MAIL_URL='smtp:\/\/user:pass@your_domain.com<\/span>:25\/'\r\nexport MAIL_FROM='wekan@your_domain.com<\/span>'\r\nexport PORT=8000<\/pre>\nMake sure you replace all values in red with their respective values for your server.<\/p>\n
We will go to the ‘bundle’ directory and run the Wekan Node.js application.<\/p>\n
cd ~\/bundle\r\nnode main.js<\/pre>\nWekan has been successfully installed and it is listening on port 8000.<\/p>\n