CentOS 7
Ads

Install Node.js 4
2016/07/03
 
Install ServerSide JavaScript Environment Node.js 4 (LTS).
[1] It's possible to install from CentOS SCLo Software Collections.
It's OK to install it even if 0.1.x (possible to install from EPEL Repository) is already installed because 4.x is located on another PATH.
# install from SCLo

[root@dlp ~]#
yum --enablerepo=centos-sclo-rh -y install rh-nodejs4
[2] Packages from Software Collections are installed uder the /opt directory.
To use it, Load environment variables like follows.
# load environment variables

[root@dlp ~]#
scl enable rh-nodejs4 bash
[root@dlp ~]#
node -v

v4.4.2
[root@dlp ~]#
which node

/opt/rh/rh-nodejs4/root/usr/bin/node
[3] If you'd like to enable Node.js 4 automatically at login time, configure like follows.
[root@dlp ~]#
vi /etc/profile.d/rh-nodejs4.sh
# create new

#!/bin/bash

source /opt/rh/rh-nodejs4/enable
export X_SCLS="`scl enable rh-nodejs4 'echo $X_SCLS'`"
 
Tweet