Authorization statement: This article authorizes the official Amazon Cloud Technology article to forward and rewrite the rights, including but not limited to Amazon Cloud Technology official channels such as Developer Centre, Zhihu, self-media platforms, third-party developer media, etc.
Preface
AWS cloud services are crucial in the digital age. AWS (Amazon Web Services), Amazon's cloud computing service platform, provides a range of extensive and in-depth cloud services to businesses, organizations and individual developers around the world.
In AWS cloud services, key services such as calculation, storage, database, analysis, and machine learning are fully covered. For example, based on the EC2 (Elastic Compute Cloud) service, customers can easily expand and manage virtual servers; S3 (Simple Storage Service) provides customers with long-term, available, and scalable object storage. In addition, database services such as RDS (Relational Database Service) and DynamoDB also provide strong data support for enterprise-level applications.
In addition to providing infrastructure services, AWS also provides a series of development tools and platforms to help developers build, evaluate and deploy application software more effectively. For example, AWS Lambda allows developers to run code without provisioning or managing servers; and AWS SDA Amplify is a comprehensive development platform, including authentication, API management, document storage, etc.
Security is another highlight of AWS cloud services. AWS provides many security, identity and compliance services, such as IAMS (Identity and Access Management), KMS (Key Management Service) and CloudTrail, etc. to ensure that user data and applications are fully protected.
Finally, users can take advantage of the global nodes of AWS cloud services and choose to deploy applications to all parts of the world to achieve low latency and high availability. At the same time, server resources can be adjusted to reduce costs and improve operational efficiency.
theme
Our topic today is to configure the node environment on the AWS Linux system, build a Vue project, and complete access to the external network.
outline
1. Log in
2. Connect to EC2 instance
3. Configure node and npm environment
4. Configuration git
5. Pull a Vue project from github
6. Access the Vue project from the external network
1. Login
1.1. Open the official website of Amazon Web Services
1.2. Login
1.3. After logging in, enter the instance console
2. Connect to the EC2 instance
Click the [Connect] button of 1.3 to enter the [Connect to Instance] page;
We directly use EC2 Instance Connect to connect, click.
3. Configure node and npm environment
3.1. Check the aws linux built-in package management tool
By entering apt and yum, I found that the built-in package management tool is yum.
yum (Yellow dog Updater, Modified) is a Shell front-end package manager in Fedora, RedHat and SUSE.
Based on RPM package management, RPM packages can be automatically downloaded and installed from designated servers, dependencies can be automatically processed, and all dependent software packages can be installed at once, eliminating the need to download and install them again and again.
yum provides commands to find, install, and delete a certain, a group, or even all software packages. The commands are concise and easy to remember.
3.2. Check the node environment configuration
[ec2-user@ip-172-31-26-148 ~]$ node -v
-bash: node: command not found
3.2.1. Install and configure node
Install node command
sudo yum install -y nodejs
3.2.2. Check the node again
Enter [node -v] again, and node version 18.18.2 is displayed
Enter [npm -v], and npm version 9.8.1 is displayed< a i=2> means node and npm have been configured successfully.
4. Configure git
4.1. Install git
input the command
sudo yum install -y git
4.2. Check git configuration
[ec2-user@ip-172-31-26-148 ~]$ git -v
git version 2.40.1
5. Pull a Vue project from github
5.1. Enter the project directory
5.2. View the security group
The http protocol has opened port 80 (The default value of the aws linux http protocol is 80 and cannot be modified)
5.3. Modify port
5.4. Start the project
input the command
npm run serve
5.4.1. Solve the problem of port changing to 1024
1. nginx or other proxy software has forwarded the port. You need to check the port occupation
Obviously it is not occupied
lsof -i:80
2. If the permissions are not enough, we add: sudo before the command.
sudo npm run serve
6. Access Vue project from external network
The Vue project started in step 5 displays local and intranet addresses. We need to find the external IP on the instance page
Access address: http://34.216 .244.162/#/
Summarize
The AWS Linux cloud server is particularly convenient during use, especially the yum package management, which is very smooth and has no problems. Whether you are configuring git, node, or npm, you can download and install it smoothly.