-->

DEVOPSZONES

  • Recent blogs

    How To Install or Upgrade Node.js on Amazon Linux 2

     How To Install or Upgrade Node.js  on Amazon Linux 2


    Node.js is a popular programming language powering many platforms serving millions of customers with billions of transactions per second around the globe. In this  article we will cover the steps that you’ll need to install or Upgrade Node.js  on Amazon Linux 2.


    Install Nodejs

    Step 1 : Run the below commands  to setup repository for Node.js on Amazon Linux 2 according to your requirement.

    --- Install Node.js 14 ---

    curl -sL https://rpm.nodesource.com/setup_14.x | sudo bash -


    --- Install Node.js 12 ---

    curl -sL https://rpm.nodesource.com/setup_12.x | sudo bash -


    --- Install Node.js 10 ---

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

    How To Install or Upgrade Node.js  on Amazon Linux 2


    Step 2 : After the repository has been setup  then install Node.js and npm with yum command.

    sudo yum install -y nodejs

    How To Install or Upgrade Node.js  on Amazon Linux 2


    If you need Node Development tools insntall them by running the following commands in your terminal.

    sudo yum -y install gcc-c++ make

    To install the Yarn package manager, run:


    curl -sL https://dl.yarnpkg.com/rpm/yarn.repo | sudo tee /etc/yum.repos.d/yarn.repo

    sudo yum -y install yarn


    Confirm Node.js installation on Amazon Linux 2


    We need to confirm our installation of Node.js was successful on Amazon Linux 2. The first thing to check is the version.

    [root@node-server]# node -v

    v14.15.5

    [root@node-server]#


    Upgrade Nodejs

    Step 1 : Remove the Current Nodejs

    [root@node-server ~]# yum remove nodejs

    nodejs remove


    Step 2 : Make sure there are no existing Node installation

    rpm -qa 'node|npm' | grep -v nodesource

    Step 3:  Follow the Step 1 from Install Nodejs Section.



    No comments