Facebook Twitter Instagram
    TecAdmin
    • Home
    • Ubuntu 20.04
      • Upgrade Ubuntu
      • Install Java
      • Install Node.js
      • Install Docker
      • Install LAMP Stack
    • Tutorials
      • AWS
      • Shell Scripting
      • Docker
      • Git
      • MongoDB
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    Home»Programming»Nodejs»How To Install Latest Nodejs on Amazon Linux

    How To Install Latest Nodejs on Amazon Linux

    RahulBy RahulOctober 11, 20192 Mins ReadUpdated:May 29, 2021

    Node.js is a platform built on Chrome’s JavaScript runtime for easily building fast, scalable network applications. Latest version node.js yum repository is maintaining by its official website. Use this tutorial to add a yum repository and install Latest Nodejs to Amazon Linux systems.

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

    Install latest nodejs

    Step 1 – Configure Yum Repository

    First of all, You need to enable node.js yum repository in your system provided by the Node.js official website. You also need development tools to build native add-ons to be installed on your system.

    For Latest Release:-

    sudo yum install -y gcc-c++ make 
    curl -sL https://rpm.nodesource.com/setup_16.x | sudo -E bash - 
    

    For Stable Release:-

    sudo yum install -y gcc-c++ make 
    curl -sL https://rpm.nodesource.com/setup_14.x | sudo -E bash - 
    

    Step 2 – Install Node.js on Amazon Linux

    After adding a yum repository in your system let’s install the Node.js package. NPM will also be installed with node.js. This command will also install many other dependent packages on your system.

    sudo yum install -y nodejs 
    
    • Don’t Miss => Yarn Installation ( A Node Modules Manager)

    Step 3 – Check Version

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

    node -v  
    
    v16.2.0
    

    Also, check the version of npm.

    npm -v  
    
    7.13.0
    

    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 the “Welcome Node.js” text. Create a file demo_server.js

    vim demo_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('Welcome Node.js');
    }).listen(3000, "127.0.0.1");
    console.log('Server running at http://127.0.0.1:3000/');
    

    Now start the webserver using the command.

    node --inspect demo_server.js 
    
    Debugger listening on ws://127.0.0.1:9229/8136b052-2b35-402e-8c5c-1d15b027a970
    For help, see: https://nodejs.org/en/docs/inspector
    Server running at http://127.0.0.1:3000/
    

    Therefore the web server has been started on port 3000. Now access http://127.0.0.1:3000/ URL in browser.

    Amazon Linux install node.js node.js NodeJs
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp
    Previous ArticleHow to Increase Open Files Limit in Ubuntu & Debian
    Next Article How to Install Yarn on Amazon Linux

    Related Posts

    How to Install Bower on Ubuntu 22.04 & 20.04

    Updated:July 2, 20222 Mins Read

    How To Install Node.js on Ubuntu 22.04

    Updated:May 27, 20223 Mins Read

    How To Install NVM on Ubuntu 22.04

    Updated:April 16, 20223 Mins Read

    How To Install NVM on Windows

    Updated:April 16, 20223 Mins Read

    How To Install Node.Js on Debian 11

    Updated:February 11, 20226 Mins Read

    How To Install NVM on Debian 11

    Updated:August 31, 20213 Mins Read

    4 Comments

    1. Nikesh Singh on July 8, 2021 6:19 pm

      Thank you for quick steps! This is very helpful.

      Reply
    2. Harnish on December 23, 2020 12:07 am

      Thank you for this article. this really helped me install node on my Amazon linux 2

      Reply
    3. Rick on October 19, 2020 9:56 pm

      I’ve just tried this and it shows that the nodesource repository got added to my AWS instance, but it says “No package node.js is available.”

      Reply
    4. Anuj Joshi on February 19, 2020 4:53 am

      Rahul, you have written the required article. I want to tell you that I was searching for some solution for installing node.js on my amazon virtual machine. Fortunately, you helped me through this article.

      Now, I will perform the instructions mentioned here so that I could get my task done. Thank you.
      Please keep sharing and writing such small tutorials.

      Reply

    Leave A Reply Cancel Reply

    Recent Posts
    • How To Install Docker on Ubuntu 22.04
    • How to Install Bower on Ubuntu 22.04 & 20.04
    • How to run “npm start” through Docker
    • Filesystem Hierarchy Structure (FHS) in Linux
    • How to accept user input in Python
    Facebook Twitter Instagram Pinterest
    © 2022 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.