Welcome to ciysys blog

Install Node.js and PM2

Published on: 5th Dec 2020

Updated on: 30th Jan 2022

What is Node.js

Node.js is a virtual machine for hosting JavaScript programs. It is powerful such that you can write a simple website in a few lines of code.

Why we need it

You may develop your website using Node.js or develop a script to analyze the web access log, etc.

Here's how you install Node.js

Maintaining Node.js app dependencies

First, you have to set the current location to the same as the package.json of your app.

cd /var/www/app1

Install PM2

The website hosted in Node.js will not be back online after server reboot. In this case, we need a program to start the website. There are many options to achieve this. For us, we choose pm2 due to its flexibility and easy to configure.

Adding Node.js app to pm2 using ecosystem.config.js file


Related posts

Jump to #UBUNTU blog


Lau Hon Wan, software developer.