Search for: Search

Home

Ubuntu 18.04

Whats New?

Upgrade Ubuntu

Install Java

Install Node.js

Install Docker

Install Git

Install LAMP Stack

Tutorials

AWS

Shell Scripting

Docker

Git

MongoDB

Funny Tools

FeedBack

Submit Article

About Us

Menu

Home

Ubuntu 18.04

Whats New?

Upgrade Ubuntu

Install Java

Install Node.js

Install Docker

Install Git

Install LAMP Stack

Tutorials

AWS

Shell Scripting

Docker

Git

MongoDB

Funny Tools

FeedBack

Submit Article

About Us

How to Install Latest Nodejs & NPM on Debian 9/8/7
Written by Rahul, Updated on December 10, 2018

Nodejs node, nodejs, nodejs debian, npm

Node.js is a platform built on Chrome’s V8 JavaScript engine.Nodejs can used for easily building fast, scalable network applications. Latest version node.js ppa is maintaining by its official website. We can add this PPA to Debian 9 (Stretch) Debian 8 (Jessie) and Debian 7 (Wheezy) systems. Use this tutorial to install latest Nodejs & NPM on Debian 9/8/7 systems.

To install specific nodejs version, Visit our tutorial Install Specific Nodejs Version with NVM.

Step 1 – Add Node.js PPA

You are required to add Node.js PPA to your system provided by the Nodejs official website. We also need to install the software-properties-common package if not installed already. You can choose either to install Latest Node.js version or LTS version.

For Latest Release

sudo apt-get install curl software-properties-common
curl -sL https://deb.nodesource.com/setup_11.x | sudo bash -

For LTS Release

curl -sL https://deb.nodesource.com/setup_10.x | sudo bash -

Step 2 – Install Node.js and NPM

After adding required PPA file lets install Nodejs package. NPM will also be installed with node.js. This command will also install many other dependent packages on your system.

sudo apt-get install nodejs

Don’t Miss => Yarn Installation ( A Node Modules Manager)

Step 3 – Test Node.js and NPM Version

After completeing the installation, check and verify the installed version of Node.js and NPM. You can find more details about current version on node.js official website.

node -v

v11.4.0

Also, check the version of NPM.

npm -v

6.4.1

Step 4 – Create Demo Web Server (Optional)

This is an optional step. If you want to test your node.js install. Let’s create a web server with “Hello World!” text. Create a file http_server.js

vim http_server.js

and add the following content

var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World\n');
}).listen(3000, "127.0.0.1");
console.log('Server running at http://127.0.0.1:3000/');

Now start the web server using the command.

node http_server.js

Server running at http://127.0.0.1:3000/

Web server has been started on port 3000. Now access http://127.0.0.1:3000/ url in browser.

Share it!

Share on Facebook

Share on Twitter

Share on Google+

Share on Reddit

Share on Tumblr

Rahul

Connect on Facebook Connect on Twitter Connect on Google+

I, Rahul Kumar am the founder and chief editor of TecAdmin.net. I am a Red Hat Certified Engineer (RHCE) and working as an IT professional since 2009..

Related Posts

How to Install Gulp.js on Fedora 28/27/26

November 9, 2018

How to Install Gulp.js on Linux Mint 19/18

November 8, 2018

How to Install Gulp.js on CentOS/RHEL 7/6

November 7, 2018

How To Install Gulp.js on Debian 9/8

October 27, 2018

How to Install Gulp.js on Ubuntu 18.04 & 16.04 LTS

October 18, 2018

7 Comments

Tomas Reply to Tomas

August 31, 2018 at 5:52 am

Thanks for your article, great info!

Ryan Reply to Ryan

July 10, 2018 at 10:42 pm

Hey is there any way to update? My system downloaded v3.5.2

Reginaldo Barreto Reply to Reginaldo

March 18, 2018 at 2:23 am

Thanks for sharing this information.

Josef Reply to Josef

January 18, 2018 at 3:44 am

V. Nice Tutorial. Thanks

Eugene Reply to Eugene

January 17, 2018 at 11:18 pm

Worked like a charm, thanks! Is there an easy way to update?

Dan Reply to Dan

October 24, 2017 at 5:43 am

On Raspbian (Debian Stretch) :
sudo apt-get install curl python-software-properties

doesn’t work, should be :
sudo apt-get install curl software-properties-common

Vishnu Reply to Vishnu

January 22, 2018 at 6:34 am

software-properties-common
is an alternate for
python-software-properties

some systems have it.. some don’t

Leave a Reply
Cancel reply

Comments *

Name *

Email *

Website

Search for: Search

Popular Posts

How to Install Oracle Java 11 on Ubuntu 18.04 LTS (Bionic)

How to Install Java 11 on CentOS 7/6 & Fedora 28-25

How to Install Oracle Java 11 on Ubuntu 16.04 LTS (Xenial)

How to Install Oracle Java 11 on Debian 9 (Stretch)

How to Install Django on Ubuntu 18.04 & 16.04 LTS

All rights reserved. © 2013-2018 TecAdmin.net. This site uses cookies. By using this website you agree our term and services

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish.Accept Reject Read More

Privacy & Cookies Policy