Friday, October 14, 2016

Install Node.js and NPM on Oracle Linux



Hi Folks

Stepping out from the Mobile Blog to do a short tech  blog.  We need node.js so in order to get it up and running while we blog the rest of the mobile set up on ICS we can be installing node.js in the background.

Node is not part of the standard YUM repos so we need another repo added ( there are lots of other ways  too ! ) .

Here's mine.

We need to get the EPEL Repo ( this has node in it ).
As root:

Need wget to get the first rpm
( we are using a very basic Oracle Install )
[root@mobdev1 ~]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.8 (Santiago)
[root@mobdev1 ~]#


[root@mobdev1 ~]# yum -y install wget
Loaded plugins: security, ulninfo
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package wget.x86_64 0:1.12-8.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package       Arch            Version                Repository           Size
================================================================================
Installing:
 wget          x86_64          1.12-8.el6             ol6_latest          483 k

Transaction Summary
================================================================================
Install       1 Package(s)

Total download size: 483 k
Installed size: 1.8 M
Downloading Packages:
wget-1.12-8.el6.x86_64.rpm                               | 483 kB     00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : wget-1.12-8.el6.x86_64                                       1/1
  Verifying  : wget-1.12-8.el6.x86_64                                       1/1

Installed:
  wget.x86_64 0:1.12-8.el6

Complete!
[root@mobdev1 ~]#


Now to get the EPEL RPM

[root@mobdev1 ~]# wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
--2016-10-14 07:09:55--  https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
Resolving dl.fedoraproject.org... 209.132.181.26, 209.132.181.24, 209.132.181.25, ...
Connecting to dl.fedoraproject.org|209.132.181.26|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 14540 (14K) [application/x-rpm]
Saving to: âepel-release-latest-6.noarch.rpmâ

100%[======================================>] 14,540      --.-K/s   in 0.1s

2016-10-14 07:09:56 (103 KB/s) - âepel-release-latest-6.noarch.rpmâ

[root@mobdev1 ~]#

Now to install it. 
[root@mobdev1 ~]# yum -y install epel-release-latest-6.noarch.rpm
Loaded plugins: security, ulninfo
Setting up Install Process
Examining epel-release-latest-6.noarch.rpm: epel-release-6-8.noarch
Marking epel-release-latest-6.noarch.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package epel-release.noarch 0:6-8 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package          Arch       Version    Repository                         Size
================================================================================
Installing:
 epel-release     noarch     6-8        /epel-release-latest-6.noarch      22 k

Transaction Summary
================================================================================
Install       1 Package(s)

Total size: 22 k
Installed size: 22 k
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : epel-release-6-8.noarch                                      1/1
  Verifying  : epel-release-6-8.noarch                                      1/1

Installed:
  epel-release.noarch 0:6-8

Complete!
[root@mobdev1 ~]#

Now to get node.js and npm
yum -y install nodejs npm 

( Lots and lots of getting files remotely and  installing .. 

here's a sample

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                         12 MB/s |  57 MB     00:04
warning: rpmts_HdrFromFdno: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
Importing GPG key 0x0608B895:
 Userid : EPEL (6)
 Package: epel-release-6-8.noarch (@/epel-release-latest-6.noarch)
 From   : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : 1:libuv-0.10.34-1.el6.x86_64                                                                                                                                            1/110
  Updating   : openssl-1.0.1e-48.el6_8.3.x86_64                                                                                                                                        2/110
  Installing : nodejs-0.10.46-1.el6.x86_64                                                                                                                                             3/110
  Installing : nodejs-inherits-2.0.0-4.el6.noarch                                                                                                                                      4/110
  Installing : nodejs-semver-2.1.0-1.el6.noarch                                                                                                                                        5/110
  Installing : nodejs-mkdirp-0.3.5-3.el6.noarch                                                                                                                                        6/110
  Installing : nodejs-graceful-fs-2.0.0-2.el6.noarch                                                                                                                                   7/110
  Installing : nodejs-rimraf-2.2.2-1.el6.noarch                                                                                                                                        8/110
  Installing : nodejs-fstream-0.1.24-1.el6.noarch                             

after about 3 or 4 mins 

 redhat-rpm-config.noarch 0:9.0.3-51.0.1.el6                  v8.x86_64 1:3.14.5.10-25.el6                                v8-devel.x86_64 1:3.14.5.10-25.el6
  zlib-devel.x86_64 0:1.2.3-29.el6

Dependency Updated:
  openssl.x86_64 0:1.0.1e-48.el6_8.3

Complete!
[root@mobdev1 ~]#


[root@mobdev1 ~]# node -v
v0.10.46
[root@mobdev1 ~]#


Finally you should update node and NPM to the latest versions :

sudo npm cache clean -f
sudo npm install -g n
sudo n stable


npm install npm@latest -g





                                                                             

1 comment:

Anonymous said...

thanks for documenting this!