在红帽上安装nodejs

问题描述 投票:0回答:8

我尝试使用以下命令在 Red Hat Enterprise Linux Server 版本 6.1 上安装 node.js:

sudo yum install nodejs npm

我收到以下错误:

Error: Package: nodejs-0.10.24-1.el6.x86_64 (epel)
           Requires: libssl.so.10(libssl.so.10)(64bit)
Error: Package: nodejs-devel-0.10.24-1.el6.x86_64 (epel)
           Requires: libcrypto.so.10(libcrypto.so.10)(64bit)
Error: Package: nodejs-0.10.24-1.el6.x86_64 (epel)
           Requires: libcrypto.so.10(libcrypto.so.10)(64bit)
Error: Package: nodejs-devel-0.10.24-1.el6.x86_64 (epel)
           Requires: libssl.so.10(libssl.so.10)(64bit)
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest

我也尝试了以下命令:

sudo yum install -y nodejs

我收到以下错误:

Error: Package: nodejs-0.10.24-1.el6.x86_64 (epel)
           Requires: libssl.so.10(libssl.so.10)(64bit)
Error: Package: nodejs-0.10.24-1.el6.x86_64 (epel)
           Requires: libcrypto.so.10(libcrypto.so.10)(64bit)

我该如何安装?我想安装最新版本。

node.js redhat yum
8个回答
33
投票

NodeJS 提供了一个安装脚本,在使用 yum 安装之前必须运行该脚本

curl -sL https://rpm.nodesource.com/setup | bash -

然后 yum 命令应该可以工作了

yum install -y nodejs

https://github.com/joyent/node/wiki/installing-node.js-via-package-manager#enterprise-linux-and-fedora


13
投票

我没有代表对 jfredys 的答案发表评论,但想添加一个附录。他的答案对于我假设的某些环境是正确的,但对我来说失败了,因为我遇到了错误:

您的发行版(标识为“redhat-release-server-6Server-6.6.0.2.el6.x86_64”)当前不受支持,请通过 https://github.com/nodesource/distributions/issues 联系 NodeSource,如果您认为这是不正确的或者希望考虑支持您的发行版

我最近在尝试在另一台服务器上安装meteor软件包时遇到了奇怪的情况,结果发现这是curl尝试访问SSL站点的代理/防火墙问题。我必须更改所有curl 命令以使用-k 来绕过错误的SSL 警告。首先我将安装脚本复制到本地:

curl -kL https://rpm.nodesource.com/setup > ~/nodeInstall.sh

当我这样做时,我删除了 s(静音)选项,以深入了解任何问题(幸运的是没有问题)。在脚本中,我将所有curl命令更改为使用-k(还删除了静默选项,以防万一)。我将其设置为可执行文件,并且运行干净(在 sudo 下),然后我终于能够使用

安装 npm
sudo yum install -y nodejs

一切都很高兴:

$npm -version
1.4.28

8
投票

您需要将 CentOS 6 版本更新到 6.5+ 或至少更新 OpenSSL 副本,因为为 CentOS 6 提供的 node.js 软件包是在具有较新版本 OpenSSL 的系统上编译的,该版本可在 6.5+ 中使用. 另一种方法是从源代码手动编译和安装节点或使用来自nodejs.org的预编译二进制文件。


6
投票
https://nodejs.org/en/download/package-manager/

一样,你必须启动: curl --silent --location https://rpm.nodesource.com/setup_4.x | bash -

curl --silent --location https://rpm.nodesource.com/setup_6.x | bash -

取决于您需要的 NodeJS 版本。然后只需运行

yum -y install nodejs



3
投票

https://rpm.nodesource.com/setup

在您的浏览器中。

它给出了如何使用 wget 的说明:

wget -qO- https://rpm.nodesource.com/setup | bash -



1
投票

命令序列(至少对于 root 用户)是这样的:

curl -kL https://rpm.nodesource.com/setup > ~/nodeInstall.sh # or for v4 / v6: # curl -kL https://rpm.nodesource.com/setup_4.x > ~/nodeInstall.sh # curl -kL https://rpm.nodesource.com/setup_6.x > ~/nodeInstall.sh sed -i -e 's_curl _curl -k _g' nodeInstall.sh chmod u+x nodeInstall.sh ./nodeInstall.sh yum -y install nodejs rm nodeInstall.sh



1
投票
dnf

安装您需要的 NodeJS 版本,因为

yum
可能会拉取错误的版本。正如所见
这里
列出可用版本;

sudo dnf module list nodejs

安装你想要的:

sudo dnf module install nodejs:14



0
投票

sudo curl --silent --location https://rpm.nodesource.com/setup_8.x | bash - sudo yum install -y nodejs

© www.soinside.com 2019 - 2024. All rights reserved.