Installing nodejs on Red Hat

67,779

Solution 1

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.

Solution 2

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

Solution 3

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

Solution 4

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

Solution 5

if this command is not working then visit ...

https://rpm.nodesource.com/setup

in your browser

It gives instructions on how to use wget instead.

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

maybe that will help someone!

Share:
67,779
Prachi g
Author by

Prachi g

Updated on May 11, 2021

Comments

  • Prachi g
    Prachi g about 3 years

    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.

  • liam xu
    liam xu over 8 years
    Hi, I used this way, but the 'No package nodejs available.' still happends? What could I do? thanks
  • Frank
    Frank almost 8 years
    The script above will soon be deprecated in favour of version specific scripts: curl -sL rpm.nodesource.com/setup_4.x | bash -
  • Björn
    Björn almost 7 years
    @liamxu I had the same problem. Solution was I forgot -Ein sudo. If you do not run as root and for example use a https_proxy you have to use sudo -E bash - after the pipe. As written in the scripts intro itself but overlooked by me for quite some time
  • Lightbeard
    Lightbeard almost 6 years
    sudo su root - and curl --silent --location https://rpm.nodesource.com/setup_9.x | bash - worked for me