Thursday, February 22, 2018

NodeJS - server installation

Download the LTS version of NodeJS from the website: https://nodejs.org/en/

Step 1: Download using wget :
ubuntu@ip-172-31-58-211:~$ wget https://nodejs.org/dist/v8.9.4/node-v8.9.4-linux-x64.tar.xz
--2018-02-22 10:03:43--  https://nodejs.org/dist/v8.9.4/node-v8.9.4-linux-x64.tar.xz
Resolving nodejs.org (nodejs.org)... 104.20.22.46, 104.20.23.46, 2400:cb00:2048:1::6814:172e, ...
Connecting to nodejs.org (nodejs.org)|104.20.22.46|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 11410120 (11M) [application/x-xz]
Saving to: node-v8.9.4-linux-x64.tar.xz

node-v8.9.4-linux-x64.tar.xz              100%[=====================================================================================>]  10.88M  45.0MB/s    in 0.2s    

2018-02-22 10:03:43 (45.0 MB/s) - node-v8.9.4-linux-x64.tar.xz saved [11410120/11410120]

ubuntu@ip-172-31-58-211:~$ which npm

Step 2: Uncompress the downloaded file
ubuntu@ip-172-31-58-211:~$ tar -xJvf node-v8.9.4-linux-x64.tar.xz 

Step 3: Perform the necessary movements of folders as shown below:
ubuntu@ip-172-31-58-211:~$ sudo mkdir /usr/lib/nodejs
ubuntu@ip-172-31-58-211:~$ sudo mv node-v8.9.4-linux-x64 /usr/lib/nodejs/
ubuntu@ip-172-31-58-211:~$ cd /usr/lib/nodejs
ubuntu@ip-172-31-58-211:/usr/lib/nodejs$ ls
node-v8.9.4-linux-x64
ubuntu@ip-172-31-58-211:/usr/lib/nodejs$ 
ubuntu@ip-172-31-58-211:/usr/lib/nodejs$ sudo mv node-v8.9.4-linux-x64 node-v8.9.4
ubuntu@ip-172-31-58-211:/usr/lib/nodejs$ ls
node-v8.9.4
ubuntu@ip-172-31-58-211:/usr/lib/nodejs$ 

Step 4: Refresh Profile:

ubuntu@ip-172-31-58-211:~$ . ~/.profile
ubuntu@ip-172-31-58-211:~$ which node
/usr/lib/nodejs/node-v8.9.4/bin/node
ubuntu@ip-172-31-58-211:~$ npm -v
5.6.0
ubuntu@ip-172-31-58-211:~$ 

Step 5: Testing our installation:

ubuntu@ip-172-31-58-211:~$ node -v
v8.9.4
ubuntu@ip-172-31-58-211:~$ 


ubuntu@ip-172-31-58-211:~$ npm version
{ npm: '5.6.0',
  ares: '1.10.1-DEV',
  cldr: '31.0.1',
  http_parser: '2.7.0',
  icu: '59.1',
  modules: '57',
  nghttp2: '1.25.0',
  node: '8.9.4',
  openssl: '1.0.2n',
  tz: '2017b',
  unicode: '9.0',
  uv: '1.15.0',
  v8: '6.1.534.50',
  zlib: '1.2.11' }
ubuntu@ip-172-31-58-211:~$ 


reference: https://github.com/nodejs/help/wiki/Installation

No comments:

Post a Comment