How to install Nodejs 20.x on Amazon Linux 2023

This guide focuses on the steps required to install the Long-term supported version Nodejs 20.x on Amazon Linux 2023 along with NPM – Node package manager.

Node.js along with NPM offers a powerful development environment to Javascript developers. It is built on the same V8 JavaScript engine used for the Chrome browser and allows developers to run Javascript code on the server side as well client side. Node.js is based on an event-driven architecture and uses non-blocking I/O operations. It offers a wide range of libraries and frameworks available for building various types of applications apart from that it is known for its performance and scalability.

1. Connect and Update AL2023

First of all connect to your Amazon Linux 2023 terminal, for that, we can directly use the AWS browser-based SSH client available right on the AWS Dashboard or use the local PC terminal with private and SSH. Once you have established the connection and have the terminal access, run the system update command.

sudo dnf update

2: Add NodeJs 20.x version repository

The default version of NodeJs while doing this article available through the Amazon Linux 2023 repository was 18.x LTS, hence we need to add a Nodejs repository manually that offers version 20.x to install. Here are the commands to follow:

sudo su
curl -fsSL https://rpm.nodesource.com/setup_20.x | sudo bash -
dnf update

 

3. Install Node.js 20 and npm on Amazon Linux 2023

The NPM is a package manager that gets automatically installed with Nodejs, therefore, carry out the given command in your Amazon Linux 2023 terminal to install the Nodejs version 20.x from the node source.

sudo dnf install nodejs
Add NodeJs repostiory on Amazon Linux 2023

4. Check Node and NPM versions

After completing the Node installation, check its version to confirm it is on the system along with the package manager.

node --version

npm --version
Check version

Uninstallation

To remove the NodeJs, NPM, and its added repository in the future from Amazon Linux, here are the commands to follow:

sudo dnf remove nodejs
sudo rm /etc/yum.repos.d/nodesource-nodejs.repo

Conclusion

The way to install Nodejs 20 version on Amazon Linux 2023 is not a difficult task as you have seen in this tutorial. The only thing we have to do is add the Node repository manually after that the rest of the process is similar to any other package installation. Nevertheless, if you are facing any problems while performing the steps given in this tutorial, let us know the same using the comment section.

Other Articles:

 

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.