Programster's Blog

Tutorials focusing on Linux, programming, and open-source

Install NodeJS

Below are the instructions to install nodejs on a debian based distribution such as Ubuntu.

Ubuntu 18.04 - Native Packages

sudo apt update && \
sudo apt install npm node-gyp nodejs-dev libssl1.0-dev -y

10.x LTS

The relevant docs can be found here.

curl -sL | sudo -E bash - \
  && sudo apt-get install -y nodejs -y

12.x Latest

curl -sL | sudo -E bash - \
  && sudo apt-get install -y nodejs -y

Running the webserver

Add the bin folder to your path, then simply execute:

node [serverFile.js]

This will run node on a single thread. If you have multiple vCPUs then you may wish to run Nginx or Apache as the HTTP handler which calls node.


Last updated: 30th August 2019
First published: 16th August 2018