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.
1. Connect to your Ubuntu instance
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 – 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