AWS Topics
- AWS Intro
- AWS Launch EC2 Instance
- AWS Elastic IP
- AWS Target Group
- AWS Application Load Balancer
- AWS Route53
- AWS Amazon Certificate Manager
- AWS Redirect HTTP to HTTPs
- AWS Redirect WWW to Non WWW
- AWS Cloudfront
- AWS Download S3 to Local
- AWS Install Node.js & NPM in EC2
- AWS EC2 Connect PuTTY
- AWS EC2 Connect FileZilla
- AWS All-in-One WP Migration
- AWS Deploy Node.js
- AWS Deploy Express.js
- AWS Deploy ReactJS
- AWS Deploy NextJS
- AWS Deploy NextJS with Express.js
- AWS Deploy Wordpress
Setting Up Node.js and NPM on AWS Ubuntu EC2
Photo Credit to CodeToFun
🙋 Introduction
When working with Amazon Elastic Compute Cloud (EC2) instances, configuring Node.js and NPM (Node Package Manager) is a common initial step for hosting web applications.
In this tutorial, we'll guide you through the process of setting up Node.js and NPM on an AWS Ubuntu EC2 instance.
📚 Prerequisites
Before you begin, make sure you have the following:
- An AWS account with access to EC2.
- An Ubuntu EC2 instance launched and accessible.
- Configure PuTTY to establish a secure shell connection to your EC2 instance.
⚙️ Configure Ubuntu Server
Update the package list to ensure you get the latest version of available packages:
sudo apt update
🛠️ Install Node.js and NPM
To install node.js, run the following command:
sudo apt install nodejs
To install npm, run the following command:
sudo apt install npm
The popup may display a message indicating that Daemons using outdated libraries; simply press the enter key or click on OK button.
Photo Credit to CodeToFun
Run the following command to check the installed version of node.js and npm.
sudo node -v sudo npm -v
It should be highlighted that the current version of Node.js is v20.10.0, whereas the installed version, v12.22.9, is considerably outdated.
To upgrade the Node.js version, execute the subsequent commands individually and accurately.
sudo npm install -g n sudo n 20.10.0
Ensure you review the most recent version of Node.js on the official website.
🎉 Conclusion
Congratulations! You've successfully set up Node.js and NPM on your AWS Ubuntu EC2 instance.
You can now proceed to deploy and host your Node.js applications. Remember to configure security groups and take necessary precautions for production deployments.
👨💻 Join our Community:
Author
For over eight years, I worked as a full-stack web developer. Now, I have chosen my profession as a full-time blogger at codetofun.com.
Buy me a coffee to make codetofun.com free for everyone.
Buy me a Coffee
If you have any doubts regarding this article (Setting Up Node.js and NPM on AWS Ubuntu EC2), please comment here. I will help you immediately.