Install Node.js 5.x on Ubuntu and Debian using PPA

Node.js is a Javascript platform for server-side programming. It allows users to easily create networked applications that require backend functionality. It is used to develop I/O intensive web applications like video streaming sites, single-page applications, and other web applications. Node.js is open source, completely free, and used by thousands of developers around the world.
Install NodeJS

See Also:

  • Install Node.js on CentOS/RHEL 6/7
  • This tutorial will help you to install node.js on Ubuntu and Debain systems with an example application.

    Step #1 Install Optional Packages

    Run the following command to install all optional packages If required:

    # apt-get install -y build-essential
    

    Now install screen package in your system using following commands.

    # yum install screen
    

    Step #2 Add Node.js PPA

    Run the following command to add Node.js repository in Ubuntu and Debain system.

    # curl -sL https://deb.nodesource.com/setup_5.x | sudo -E bash -
    

    Step #3 Install Node.js

    After adding Node.js repository, run the below command to install node.js

    # sudo apt-get install -y nodejs
    

    Step #4 Check Node.js Version

    Run following command to check the node.js version.

    # node --version
    
    v5.8.0
    

    Step #5 Configure Example Application using Express

    First we required to install npm modules using following commands.

    # npm -g install express supervisor express-generator
    

    This time is to create application using express and npm using below set of commands.

    # express technical
    # cd technical
    # npm install 
    # screen
    

    The above commands will create a directory myapp and npm will install all the required modules to run your application from its software repository.

    Now edit views/index.jade and add following content to show on default page.

    # vim views/index.jade
    
    extends layout
    
    block content
      h1= title
      p Welcome to Technical World (Ubuntu)
    

    Finally start your application using supervisor.

    # supervisor ./bin/www
    

    This application by default start on port 3000. Access your application by connecting your server on port 3000 in your browser.

    http://Server_IP:3000/
    

    Nodejs_Ubuntu

    Reference:
    https://nodejs.org/en/download/package-manager/

    Enjoy it!

    Leave a Reply

    Your email address will not be published. Required fields are marked *

    This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

    The reCAPTCHA verification period has expired. Please reload the page.