Install Node.js

Node.js on CentOs 7


In order to install Node.js on CentOS 7 , execute the following commands as root in the same order they are mentioned.

1. Go to the official site : and goto the latest version directory.

At the time of installation, Node version 12.16.1 is the latest.

2) Open termional and download the latest Node.js(node-v12.16.1-linux-x64.tar.gz) executable to /tmp

# cd /tmp

# wget

3) Extarct the conents of the archiove file with below command.

# tar xvfz node-v8.11.2-linux-x64.tar.gz

4) create a directory for Node.js compiled and executable files.

# mkdir -p /usr/local/nodejs

5) add this path to the System path so that your shell can find/lookup the executable in this directory.

# cat /etc/profile.d/
export M2_HOME=/opt/maven
export JAVA_HOME=$(readlink -f /usr/bin/java | sed “s:/bin/java::”)
export NODE_HOME=/usr/local/nodejs
export PATH=${M2_HOME}/bin:${JAVA_HOME}/bin:${NODE_HOME}/bin:${PATH}

#source /etc/profile.d/

6) verify the installation by checking the version of both Node and Npm executables.

# node -v && npm -v

Written by Ramesh Metta