Home >System Tutorial >LINUX >An easy tutorial to create and configure a Linux virtual machine on AWS

An easy tutorial to create and configure a Linux virtual machine on AWS

WBOY
WBOYforward
2024-02-10 19:42:031111browse

Cloud computing is a hot topic in today's IT industry. It can provide users with flexible, scalable, and low-cost computing resources and services. Amazon's AWS (Amazon Web Services) is the world's largest cloud computing platform and supports multiple operating systems, including Linux. This article will teach you how to create and configure a Linux virtual machine on AWS, and how to use SSH and SCP for remote management and file transfer.

An easy tutorial to create and configure a Linux virtual machine on AWS

AWS (Amazon Web Services) is one of the world's leading cloud server providers. You can set up a server in under a minute using the AWS platform. On AWS, you can fine-tune many technical details of the server, such as the number of CPUs, memory and disk space, disk type (faster SSD or classic IDE), etc. The best thing about AWS is that you only pay for the services you use. Before you start, AWS provides a special account called "Free Tier". You can use AWS technical services for free for one year, but there will be some small restrictions. For example, you cannot use the server for more than 750 hours per month. Any more than that and they'll charge you. You can view all relevant rules on the aws official website.

Since my article is about creating a Linux server on AWS, having a “Free Tier” account is a prerequisite. Let’s assume you have created a “Free Tier” account.

Before proceeding, you must know some terminology in AWS to understand the setup:

  • EC2 (Elastic Compute Cloud): This term is used for virtual machines.
  • AMI (Amazon Machine Image): Represents an operating system instance.
  • EBS (Elastic Block Storage): A type of storage environment in AWS.

Log in to the AWS console via the following link: https://console.aws.amazon.com/ .

The AWS console will look like this:

An easy tutorial to create and configure a Linux virtual machine on AWS

Amazon AWS console

Setting up a Linux VM in AWS

1. Create an EC2 (virtual machine) instance: Before starting to install the system, you must create a virtual machine in AWS. To create a virtual machine, click EC2 under the "compute" menu:

An easy tutorial to create and configure a Linux virtual machine on AWS

Create an EC2 instance

2. Now click the "Launch Instance" button under Create instance.

An easy tutorial to create and configure a Linux virtual machine on AWS

Launch the EC2 instance

3. Now, when you are using a “Free Tier” account, then it is best to select the “Free Tier” radio button so that AWS can filter out the instances that can be used for free. This allows you to not pay for the use of AWS resources.

An easy tutorial to create and configure a Linux virtual machine on AWS

Select Free Tier instances only

4. To continue, please select the following options:

a. Select an AMI (Amazon Machine Image) in the classic instance wizard, and then choose to use Red Hat Enterprise Linux 7.2 (HVM), SSD storage

b. Select "t2.micro" as the instance details.

c. Configure instance details: Do not change anything, just click Next.

d. Add storage: Do not change anything, just click Next as we will use the default 10(GiB) hard drive at this time.

e. Add tags: Don’t change anything just click next.

f. Configure security group: Now select port 22 for ssh so that you can access this server from anywhere.

An easy tutorial to create and configure a Linux virtual machine on AWS

Configure AWS server

g. Select the "Review and Launch" button.

h. If all the details are correct, click the “Launch” button.

i. After clicking the "Launch" button, the system will pop up a window to create a "key pair" as shown below: Select the option "create a new key pair" and give the key pair name and download it. This key pair is required when connecting to the server using ssh. Finally, click the Launch Instance button.

An easy tutorial to create and configure a Linux virtual machine on AWS

Create Key pair

j. After clicking the "Launch Instance" button, go to the service in the upper left corner. Select "compute" –> "EC2". Now click on "Running Instances":

An easy tutorial to create and configure a Linux virtual machine on AWS

Go to the running EC2 instance

k. Now you can see that the status of your new VM is "running". Select the instance and note the Public DNS name required to log in to the server.

An easy tutorial to create and configure a Linux virtual machine on AWS

Public DNS value of the VM

Now you have finished creating a VM running Linux. To connect to the server, follow the steps below.

Connecting to an EC2 instance from Windows

1. First, you need putty gen and Putty exe to connect to the server from Windows (or SSH command on Linux). You can download putty via the link below.

2. Now open putty gen: puttygen.exe.

3. You need to click the “Load” button, browse and select the key pair file (pem file) you downloaded from Amazon.

4. You need to select the “ssh2-RSA” option and click the Save Private Key button. Please select "yes" in the next pop-up window.

5. Save the file with the extension .ppk.

6. Now you need to open putty.exe. Click "connect" in the left menu, then select "SSH" and then "Auth." You need to click the Browse button to select the .ppk file we created in step 4.

7. Now click on the “session” menu and in “host name” paste the DNS value from step “k” in this tutorial and click on the “open” button.

8. When asked for a username and password, enter ec2-user and a blank password, and then enter the following command.

$ sudo su - 

Haha, you are now the owner of a Linux server hosted on the AWS cloud.

An easy tutorial to create and configure a Linux virtual machine on AWS

The above is the detailed content of An easy tutorial to create and configure a Linux virtual machine on AWS. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:lxlinux.net. If there is any infringement, please contact admin@php.cn delete