Cài đặt node JS trên AWS EC2 năm 2022

13th Mar 2022
Table of contents

To set up Node.js on your Linux instance

Connect to your Linux instance as ec2-user using SSH.

Install node version manager (nvm) by typing the following at the command line.

AWS does not control the following code. Before you run it, be sure to verify its authenticity and integrity. More information about this code can be found in the nvm GitHub repository.

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash

We will use nvm to install Node.js because nvm can install multiple versions of Node.js and allow you to switch between them.

Activate nvm by typing the following at the command line.

. ~/.nvm/nvm.sh

Use nvm to install the latest version of Node.js by typing the following at the command line.

nvm install node

Installing Node.js also installs the Node Package Manager (npm) so you can install additional modules as needed.

Test that Node.js is installed and running correctly by typing the following at the command line.

node -e "console.log('Running Node.js ' + process.version)"

This displays the following message that shows the version of Node.js that is running.

Running Node.js VERSION

Bạn thấy bài viết này như thế nào?
0 reactions

Add new comment

Image CAPTCHA
Enter the characters shown in the image.
Câu nói tâm đắc: “Điều tuyệt với nhất trong cuộc sống là làm được những việc mà người khác tin là không thể!”

Related Articles

Hiện nay, việc quản lý các web applications khá là phức tạp, ví dụ bạn phải quản lý load balancer, vài web servers, database servers

In this video we'll be setting up a new React App with AWS Amplify to add Sign up, Login and Logout in the easiest way possible.

In this hands on workshop Amazon Developer Advocate Nader Dabit shows us how to get started with serverless GraphQL using AWS Amplify.