How to install Nodejs on CentOS 7 without Internet connection with root permission?

I’ve recently migrated to Linux CentOS7 from windows and I need to install Nodejs to my target, but in target system there is no Internet connection. How can I install Nodejs with all dependencies in offline mode? Thanks in advance for your answers.

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

you can download node.js binary from its website and you can copy that file using ssh to your target machine.
extract it and add its path to your environment variables.
for more details you can visit here

here is my procedure

To install NodeJS we need an online server to download requirements.

  1. You can download it from Node’s official website. Make sure you download Linux binary version of it.
    Or you can use this link:
    https://nodejs.org/dist/v16.14.0/node-v16.14.0-linux-x64.tar.xz
  2. After downloading Linux Binary, copy it to your offline machine.
  3. Then go to the directory you copied and unzip your downloaded file by using tar command.
  4. Next step we are going to define the unzipped directory to our environment variables.to do this first go to /etc/profile.d and create a file. its name should be nodejs.sh
  5. Copy commands below to nodejs.sh file and save it.

#!/bin/sh
EXPORT PATH=/home/node-v16.14.0-linux-x64/bin:$PATH

Note : /home/node-v16.14.0-linux-x64/bin (file address) may differ from yours

Restart your session and then enjoy NodeJS on your offline Linux machine.

Method 2

You can download the package, then SFTP the package to the target and then install it.


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x