Installing node.js, npm on Linux machine without internet

Installation node npm can be done using the pre-build binaries and creating a symlink.

Installation of a node without internet is helpful in cases where the server is restricted from any public network for security reasons.

Download Pre-Build Binaries:
Download the tar file for node.js https://nodejs.org/en/download/prebuilt-binaries select the version you want to install on the machine select version v16.20.2

Unpack the tar file and move it to the appropriate location:
tar -xvf  node-v16.20.2-linux-x64.tar.xz
mv  node-v16.20.2-linux-x64.tar.xz  /opt/node-v16.20.2

Create a symlink for node, npm, and npx:
sudo ln -s /opt/node-v16.20.2/bin/node /usr/bin/node
sudo ln -s /opt/node-v16.20.2/bin/npm /usr/bin/npm
sudo ln -s /opt/node-v16.20.2/bin/npx /usr/bin/npx

Check the node, npm version:
node --version
npm --version

You have completed the installation of the node npm without using an internet connection successfully.

Upgrading of the already installed can be done in the same manner removing the older symlink and creating the new symlink with the new version.

One thought on “Installing node.js, npm on Linux machine without internet

Leave a Reply

Your email address will not be published. Required fields are marked *