Table of Contents
This tip is about the how to install Node.js & Npm on Amazon ec2 Ubuntu Linux. So read this free guide, How to install Node.js & Npm on Amazon ec2 Ubuntu Linux step by step. If you have query related to same article you may contact us.
How to install Node.js & Npm on Amazon ec2 Ubuntu Linux – Guide
Node.js is a V8 JavaScript runtime user interface and agile JavaScript interpreter. in few words -Node.js is a method of running JavaScript on the web server; but it is also much, much more. JavaScript is an event-based language, so anything that happens on the web server triggers a non-blocking opportunity. Here we learn how to install Node.js and NPM on Amazon Ec2 running the Ubuntu 20.04 Linux cloud server instance.
Even Node.js can take over the web server role – Apache – and translate the application code running on it. Similar to Apache, there are several components (collections) that can be configured up include features as well as performance – like information storage, zip data support, Facebook login or payment gateways.
In a normal LAMP server stack, you have an Apache or NGINX web server running PHP. Each new link to the server creates a new string and it’s extremely easy to quickly lose efficiency – the only way to support even more users is to add more web server features. It just doesn’t fit well. In the case of Node, this is not the instance. There’s no Apache paying attention to incoming links and returning HTTP status codes either – you have to deal with this style of core server yourself. The good news is that there are components that make this easier, but it can still be a little frustrating when you get started. However, the result is a powerful internet application.
Install node js on Amazon Ec2 Ubuntu Linux
1. Connect to your Ubuntu instance
First, you must have an Ubuntu running an Ec2 instance on your Amazon Cloud infrastructure. If you already have an instance running, go to the next step. otherwise, check how to create instance Ec2.
After that, connect your Ubuntu instance using SSH or via a web terminal directly from the AWS Ec2 Dashboard.
2. Run system update
Once you have access to the Ec2 Ubuntu command line, run the system update command to ensure all existing packages are up Until the present date.
sudo apt update
Also, install curl:
sudo apt install curl -y
3. Check the available Node.js version
Node.js and NPM can be installed using Ubuntu’s default stable system repository, however the version will be old. To check this, you can run:
sudo apt policy nodejs
Exit:
nodejs:
Installed: (none)
Candidate: 10.19.0 ~ dfsg-3ubuntu1
Version table:
10.19.0 ~ dfsg-3ubuntu1 500
500 http://ap-south-1.ec2.archive.ubuntu.com/ubuntu focal / universe amd64 Packages
4. Add current Nodejs or LTS repository in Ec2 Ubuntu
Now, as we already know, the version already available for installation from the Ubuntu base repository is not the latest. So to get one, we need to add the official Node.JS repository manually to our system.
As per your requirement, add one of the following repositories using the commands provided below:
For LTS version
curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -And bash –
For current version
curl -fsSL https://deb.nodesource.com/setup_current.x | sudo -And bash –
5. Command to install Nodejs and NPM on Amazon ec2 Ubuntu Linux
We have everything ready, now we just need to download and install the current or LTS version of this Javascript platform.
Just run:
sudo apt-get install nodejs
6. View the installed version
Once the installation is complete, you can check which versions of Node and NPM – (Nodejs package manager) are installed on your system.
node -v
npm -v
That way we can easily get the Nodejs on an Ubuntu instance running on Amazon Ec2. However, if you’re having any problems following the steps above, let’s know that the commands section is all yours…
Final note
I hope you like the guide How to install Node.js & Npm on Amazon ec2 Ubuntu Linux. In case if you have any query regards this article you may ask us. Also, please share your love by sharing this article with your friends.