Install node on different OS
1. How to install the node in the Ezeelogin gateway server using the rpm package?
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
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
2. How to install the node in the Ezeelogin gateway server using the NVM?
2.1: Install NVM using below command.
root@gateway:# curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
2.2: 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
2.3: Run below command to source the file.
root@gateway:# source ~/.bashrc # or ~/.zshrc or ~/.profile
2.4: Install latest node using below command
root@gateway:# nvm install node
2.5: Install n using NVM
root@gateway:# npm install -g n
2.6: 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
2.7: 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