如何在没有网络连接的CentOS 7上以root权限安装Nodejs?

发布于 2025-01-12 11:07:36 字数 108 浏览 4 评论 0原文

我最近从 Windows 迁移到 Linux CentOS7,我需要将 Nodejs 安装到我的目标,但在目标系统中没有互联网连接。如何在离线模式下安装包含所有依赖项的 Nodejs?预先感谢您的回答。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

姐不稀罕 2025-01-19 11:07:36

您可以从其网站下载 Node.js 二进制文件,然后使用 ssh 将该文件复制到目标计算机。
提取它并将其路径添加到环境变量中。
有关更多详细信息,您可以访问此处< /a>

这是我的过程

要安装 NodeJS,我们需要一个在线服务器来下载要求。

  1. 您可以从Node官方网站下载。确保下载了它的 Linux 二进制版本。
    或者您可以使用此链接:
    https://nodejs.org/dist/ v16.14.0/node-v16.14.0-linux-x64.tar.xz

  2. 下载Linux Binary后,将其复制到您的离线环境机器。

  3. 然后转到您复制的目录并使用 tar 命令解压缩下载的文件。

  4. 下一步我们将把解压缩的目录定义到环境变量中。为此,首先转到 /etc/profile.d 并创建一个文件。它的名字应该是nodejs.sh

  5. 将下面的命令复制到nodejs.sh文件并保存。

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

注意:/home/node-v16.14.0-linux-x64/bin(文件地址)可能与您的不同

重新启动您的会话,然后享受离线 Linux 机器上的 NodeJS。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文