Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing nodejs on Red Hat

I am trying to install node.js on Red Hat Enterprise Linux Server release 6.1 using the following command:

sudo yum install nodejs npm

I got the following error:

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

I tried the following command as well:

sudo yum install -y nodejs

I am getting the following error:

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)

How should I install it? I want to install the latest version.

like image 853
Prachi g Avatar asked Jan 05 '15 11:01

Prachi g


4 Answers

NodeJS provides a setup script that must run before you install it with yum

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

Then the yum command should work

yum install -y nodejs

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

like image 79
jfredys Avatar answered Nov 02 '22 09:11

jfredys


I don't have the rep to comment on jfredys' answer, but wanted to add an addendum. His answer is correct for certain environments I assume, but it failed for me as I was running into the error:

Your distribution, identified as "redhat-release-server-6Server-6.6.0.2.el6.x86_64", is not currently supported, please contact NodeSource at https://github.com/nodesource/distributions/issues if you think this is incorrect or would like your distribution to be considered for support

I had run into weirdness trying to install meteor packages on another server recently and it turned out to be a proxy/firewall issue with curl trying to hit SSL sites. I had to alter all curl commands to use -k to bypass false SSL warnings. First I copied the install script locally:

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

While I was at it I removed the s (silent) option to give some insight into any problems (fortunately there were none). In the script I changed all the curl commands to use -k (also removed the silent option just in case). I set it executable and this ran cleanly (under sudo), I was then finally able to install npm with

sudo yum install -y nodejs

And all was happy:

$npm -version
1.4.28
like image 37
Eric Soyke Avatar answered Nov 02 '22 09:11

Eric Soyke


You need to update your version of CentOS 6 to 6.5+ or at least your copy of OpenSSL because the node.js package provided for CentOS 6 was compiled on a system that had a newer version of OpenSSL which is available in 6.5+.

The alternative is to compile and install node manually from source or use the precompiled binaries from nodejs.org.

like image 8
mscdex Avatar answered Nov 02 '22 10:11

mscdex


Just as per https://nodejs.org/en/download/package-manager/ you have to launch:

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

or

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

depending on NodeJS version you need. Then simply run

yum -y install nodejs
like image 6
Tomas P. R. Avatar answered Nov 02 '22 09:11

Tomas P. R.