Sunday, March 11, 2018

NodeJS - server installation - Ubuntu

Step 1: Get node setup file and rename as nodesource_step.sh

~$ wget https://deb.nodesource.com/setup_8.x -O nodesource_setup.sh
--2018-03-11 09:22:15--  https://deb.nodesource.com/setup_8.x
Resolving deb.nodesource.com (deb.nodesource.com)... 52.84.110.132, 52.84.110.18, 52.84.110.122, ...
Connecting to deb.nodesource.com (deb.nodesource.com)|52.84.110.132|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 12546 (12K) [text/plain]
Saving to: ‘nodesource_setup.sh’

nodesource_setup.sh                  100%[===================================================================>]  12.25K  --.-KB/s    in 0s      

2018-03-11 09:22:15 (85.2 MB/s) - ‘nodesource_setup.sh’ saved [12546/12546]

Step 2: Install the PPA to your configuration using the below command:
~$ sudo bash nodesource_setup.sh
[sudo] password for ubuntu: 

## Installing the NodeSource Node.js v8.x LTS Carbon repo...


## Populating apt-get cache...

+ apt-get update
Ign:1 http://dl.google.com/linux/chrome/deb stable InRelease
Hit:2 http://security.ubuntu.com/ubuntu xenial-security InRelease                                           
Hit:3 http://in.archive.ubuntu.com/ubuntu xenial InRelease                                                  
Hit:4 http://dl.google.com/linux/chrome/deb stable Release              
Hit:5 http://in.archive.ubuntu.com/ubuntu xenial-updates InRelease      
Hit:6 http://in.archive.ubuntu.com/ubuntu xenial-backports InRelease
Hit:8 https://packagecloud.io/slacktechnologies/slack/debian jessie InRelease
Reading package lists... Done

## Confirming "xenial" is supported...

+ wget -qO /dev/null -o /dev/null 'https://deb.nodesource.com/node_8.x/dists/xenial/Release'

## Adding the NodeSource signing key to your keyring...

+ wget -qO- https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add -
OK

## Creating apt sources list file for the NodeSource Node.js v8.x LTS Carbon repo...

+ echo 'deb https://deb.nodesource.com/node_8.x xenial main' > /etc/apt/sources.list.d/nodesource.list
+ echo 'deb-src https://deb.nodesource.com/node_8.x xenial main' >> /etc/apt/sources.list.d/nodesource.list

## Running `apt-get update` for you...

+ apt-get update
Ign:1 http://dl.google.com/linux/chrome/deb stable InRelease
Hit:2 http://dl.google.com/linux/chrome/deb stable Release                                                  
Get:3 https://deb.nodesource.com/node_8.x xenial InRelease [4,646 B]                                        
Hit:4 http://security.ubuntu.com/ubuntu xenial-security InRelease                                           
Hit:5 http://in.archive.ubuntu.com/ubuntu xenial InRelease               
Hit:7 http://in.archive.ubuntu.com/ubuntu xenial-updates InRelease
Get:8 https://deb.nodesource.com/node_8.x xenial/main Sources [761 B]
Get:9 https://deb.nodesource.com/node_8.x xenial/main amd64 Packages [1,003 B] 
Hit:10 http://in.archive.ubuntu.com/ubuntu xenial-backports InRelease               
Get:11 https://deb.nodesource.com/node_8.x xenial/main i386 Packages [1,005 B]
Hit:12 https://packagecloud.io/slacktechnologies/slack/debian jessie InRelease
Fetched 7,415 B in 3s (2,177 B/s)
Reading package lists... Done

## Run `apt-get install nodejs` (as root) to install Node.js v8.x LTS Carbon and npm

~$ 

Step 3: Install Node JS:

~$ sudo apt-get install nodejs
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libllvm4.0 linux-headers-4.10.0-28 linux-headers-4.10.0-28-generic linux-headers-4.13.0-26 linux-headers-4.13.0-26-generic
  linux-image-4.10.0-28-generic linux-image-4.13.0-26-generic linux-image-extra-4.10.0-28-generic linux-image-extra-4.13.0-26-generic
  linux-signed-image-4.10.0-28-generic linux-signed-image-4.13.0-26-generic
Use 'sudo apt autoremove' to remove them.
The following NEW packages will be installed:
  nodejs
0 upgraded, 1 newly installed, 0 to remove and 95 not upgraded.
Need to get 12.7 MB of archives.
After this operation, 61.3 MB of additional disk space will be used.
Get:1 https://deb.nodesource.com/node_8.x xenial/main amd64 nodejs amd64 8.10.0-1nodesource1 [12.7 MB]
Fetched 12.7 MB in 13s (928 kB/s)                                                                                                               
Selecting previously unselected package nodejs.
(Reading database ... 316819 files and directories currently installed.)
Preparing to unpack .../nodejs_8.10.0-1nodesource1_amd64.deb ...
Unpacking nodejs (8.10.0-1nodesource1) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up nodejs (8.10.0-1nodesource1) ...
~$ 

Step 4: Check the Node Versions installed :
~$ nodejs -v
v8.10.0
~$ npm -v
5.6.0

Step 5: Install Build Essential:

~$ sudo apt-get install build-essential
Reading package lists... Done
Building dependency tree       
Reading state information... Done
build-essential is already the newest version (12.1ubuntu2).
The following packages were automatically installed and are no longer required:
  libllvm4.0 linux-headers-4.10.0-28 linux-headers-4.10.0-28-generic linux-headers-4.13.0-26 linux-headers-4.13.0-26-generic
  linux-image-4.10.0-28-generic linux-image-4.13.0-26-generic linux-image-extra-4.10.0-28-generic linux-image-extra-4.13.0-26-generic
  linux-signed-image-4.10.0-28-generic linux-signed-image-4.13.0-26-generic
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 95 not upgraded.
~$ 


source: https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions

source: https://www.digitalocean.com/community/tutorials/how-to-install-node-js-on-ubuntu-16-04



1 comment:

  1. I wanted to thank you for this great article. Your blog is one of the finest blog.Thanks for posting this informative article
    Node JS Online training
    Node JS training in Hyderabad

    ReplyDelete