Install node on different OS
Installing node on ezeelogin gateway server: RPM and NVM methods
Overview: This article explains how to install Node.js on an Ezeelogin gateway server using both RPM packages and NVM. It includes instructions for installing Node.js on CentOS and Ubuntu via RPM packages and details the steps for installing and managing Node.js versions using NVM. The article also covers how to verify the installation and switch between Node.js versions.
How to install the node in the Ezeelogin gateway server using the rpm package?
Step 1.a. Install nodejs in Centos - 6,7,8
root@gateway:# curl -sL https://rpm.nodesource.com/setup_14.x |bash -
root@gateway:# yum install -y nodejs
root@gateway:# node -v
v14.8.0
Step 1.b. Install nodejs in Ubuntu - 16, 18, 20, 22
root@gateway:# curl -sL https://deb.nodesource.com/setup_20.x |bash -
root@gateway:# apt-get install nodejs -y
root@gateway:# node -v
v20.0.0
How to install the node in the Ezeelogin gateway server using the NVM?
Step 2.a. Install NVM using below command.
root@gateway:# curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
Step 2.b. Run below command to load NVM
root@gateway:# export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
Step 2.c. Run below command to source the file.
root@gateway:# source ~/.bashrc # or ~/.zshrc or ~/.profile
Step 2.d. Install latest node using below command
root@gateway:# nvm install node
Step 2.c. Install n using NVM
root@gateway:# npm install -g n
Step 2.d. To install the latest node version, run the command below. If want to install a specific version, replace latest with the desired version number.
root@gateway:# n latest
or
root@gateway:# n 20
Step 2.c. Run the n command to switch between node versions and can find the node path in the output. Use the following path (/usr/local/bin/node) to save it in the Ezeelogin GUI.
root@gateway:# n
eg:
n 20
copying : node/20.13.1
installed : v20.13.1 to /usr/local/bin/node
active : v22.1.0 at /root/.nvm/versions/node/v22.1.0/bin/node
Related Articles
How to install node using npm and n module?
Node process fails to start with Error: Cannot find module ’express’