Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Install nodejs 4 on redhat

Nodejs version 4 has been released and installed on my windows machine. I'm trying to install the package trough yum on redhat but i'm not getting the latest version.

i tried: sudo yum install -y nodejs but the lastest 4.0 version is not installed.

How do i install nodejs 4.0 on a redhat machine?

like image 232
E. Fortes Avatar asked Sep 14 '15 09:09

E. Fortes


Video Answer


3 Answers

NodeJS 4.X for EL7 repos located at https://rpm.nodesource.com/pub_4.x/el/7/

To install with yum change baseurl in nodesource-el.repo file to:

baseurl=https://rpm.nodesource.com/pub_4.x/el/7/$basearch

/etc/yum.repos.d/nodesource-el.repo content:

[nodesource]
name=Node.js Packages for Enterprise Linux 7 - $basearch
baseurl=https://rpm.nodesource.com/pub_4.x/el/7/$basearch
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/NODESOURCE-GPG-SIGNING-KEY-EL

[nodesource-source]
name=Node.js for Enterprise Linux 7 - $basearch - Source
baseurl=https://rpm.nodesource.com/pub_4.x/el/7/SRPMS
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/NODESOURCE-GPG-SIGNING-KEY-EL
gpgcheck=1
like image 126
Cirych Avatar answered Sep 25 '22 04:09

Cirych


You can compile and install from its source.

ver=4.0.0
wget -c https://nodejs.org/dist/v$ver/node-v$ver.tar.gz #This is to download the source code.
tar -xzf node-v$ver.tar.gz
cd node-v$ver
./configure && make && sudo make install

https://github.com/nodejs/node-v0.x-archive/wiki/Installation

like image 28
Hiren S. Avatar answered Sep 24 '22 04:09

Hiren S.


Try npm install n -g and then n latest for downloading it with this version manager.

Edit: The official distributions are managed by Nodesource. For RHEL the setup is supposed to be (take from the repo):

Current instructions for installing, as listed on the Node.js Wiki:

Note that the Node.js packages for EL 5 (RHEL5 and CentOS 5) depend on the EPEL repository being available. The setup script will check and provide instructions if it is not installed.

Run as root on RHEL, CentOS, CloudLinux or Fedora:

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

Then install, as root:

yum install -y nodejs

But be aware that 4.0 is currently not in their rpm distribution

like image 45
eljefedelrodeodeljefe Avatar answered Sep 24 '22 04:09

eljefedelrodeodeljefe