Node.js doesn’t exist in the default Amazon Linux 2 yum packages. So we should add the Node.js official repo and use it for the installation. Let’s see how to install Node.js on Amazon Linux 2.
Prerequisites
- Amazon Linux 2
- sudo privileges
Install Node.js on Amazon Linux 2
Step 1. First, install some Node.js dependencies.
sudo yum install gcc-c++ make
Step 2. Download the Node.js source repo for the installation.
curl -sL https://rpm.nodesource.com/setup_16.x | sudo -E bash -
Step 3. Install Node.js.
sudo yum install nodejs
Step 4. Verify installation.
node -v
Output:
v16.14.2
Conclusion
Feel free to leave a comment below and if you find this tutorial useful, follow our official channel on Telegram.