如何在亚马逊 AWS EC2建立一个Debian服务器

时间:2021-08-22 18:50:48

Introduction

This guide will cover the basic setup of an Amazon AWS account including sign up, creation and configuration of an EC2 instance.

To create an Amazon AWS account, you need:

  • e-mail address
  • credit card
  • phone number

To follow this guide, you will need these additional software downloads.

  • putty.exe for SSH connection
  • puttygen.exe to create keys for login
  • pageant.exe to load the created keys

Key creation

Before we start with Amazon AWS, let’s create our login keys with puttygen.exe.
如何在亚马逊 AWS EC2建立一个Debian服务器
1. Start puttygen.exe. Choose RSA and 2048 bits from the bottom.
2. Click on “Generate”
3. Choose a “Key comment” (for example: name of your node)
4. Choose a “Key passphrase” and confirm it
5. Save the public key & private key files
6. Close puttygen

Signup

Open the Amazon AWS signup website and click “Create an AWS Account”.
如何在亚马逊 AWS EC2建立一个Debian服务器
Choose “I am a new user,” and enter your e-mail address.
如何在亚马逊 AWS EC2建立一个Debian服务器
Type your e-mail address again and enter your password.
如何在亚马逊 AWS EC2建立一个Debian服务器
Enter your contact information and agree to the terms of service.
如何在亚马逊 AWS EC2建立一个Debian服务器
Enter your payment information.
如何在亚马逊 AWS EC2建立一个Debian服务器
Enter the security check characters and your telephone number. After pressing the button “call me now” you will see a code and receive a phone call. Enter this code on your telephone’s keyboard.
如何在亚马逊 AWS EC2建立一个Debian服务器
After entering the right code, you will see this screen.
如何在亚马逊 AWS EC2建立一个Debian服务器
Select a support plan. For expample “basic”.
如何在亚马逊 AWS EC2建立一个Debian服务器
Before logging in the first time, wait until the “Welcome to Amazon Web Services” email arrives.
如何在亚马逊 AWS EC2建立一个Debian服务器

First log in

Click on the link “Getting Started Resources” in the email you received.
如何在亚马逊 AWS EC2建立一个Debian服务器
You can also use this link https://console.aws.amazon.com/
Click on “Sign in to the Console”.
如何在亚马逊 AWS EC2建立一个Debian服务器
Enter your email and password.
如何在亚马逊 AWS EC2建立一个Debian服务器

Importing a Public Key

Select “EC2” in the “AWS Services” box.
如何在亚马逊 AWS EC2建立一个Debian服务器
Select “Key Pairs” in the “Network & Security” Section.
如何在亚马逊 AWS EC2建立一个Debian服务器
Select “Import Key Pair”.
如何在亚马逊 AWS EC2建立一个Debian服务器
Select your public key file (created in the begin of this guide with puttygen).
如何在亚马逊 AWS EC2建立一个Debian服务器
Define a key pair name and press “Import”.
如何在亚马逊 AWS EC2建立一个Debian服务器

Launch an EC2 Instance

Move to the “EC2 Dashboard” and press “Launch Instance”.
如何在亚马逊 AWS EC2建立一个Debian服务器
Go to “AWS Marketplace”, search for “Debian” and select it from the list.
如何在亚马逊 AWS EC2建立一个Debian服务器
Choose “Debian GNU/Linux 8 (Jessie)” and click create.
如何在亚马逊 AWS EC2建立一个Debian服务器
Choose an instance type. For operating a Supernode, we recommend using at least a “t2.small” instance. To continue, click on “configure instance details”.
如何在亚马逊 AWS EC2建立一个Debian服务器
Use the default settings and click on “add storage.”
如何在亚马逊 AWS EC2建立一个Debian服务器
Use the default settings and click on “add tags”.
add storage
add storage
Click to “add a name tag”.
name tag
name tag
Enter your desired server name in the value column. E.g. “Supernode”
To go on click “Configure Security Group”
server name
server name
Add the following rules:
Type: Custom TCP, Port Range: 7890, Source: Anywhere (for NIS)
Type: Custom TCP; Port Range 7880, Source: Anywhere (for servant)
Type: Custom TCP, Port Range 7778, Source: Anywhere (for light wallets)
Notice: For security reasons, you may restrict SSH access by entering your IP-address instead of 0.0.0.0/0 in the first row.
configure security group
configure security group
Now select the key pair you have uploaded in the “importing a public key” section of this guide and click on the checkbox to acknowledge that you have access to the private key file (you already created the private key in puttygen in the first section of this guide). Finally, click on “Launch Instance”!
select an existing key pair
select an existing key pair
After launching, you will see a screen indicating the launch status. Click on “View Instances”.
launch status
launch status
Write down the Public DNS. E.g. ec2-XX-XX-X-XXX.us-east-2.compute.amazonaws.com
public dns
public dns
Connecting to your new EC2 Instance
After setting up the instance, we will try to connect to our server.
Start pageant.exe and open “View Keys” from the tray icon.
pageant
pageant
Click on “Add Key” and select your saved private key (.ppk) you created earlier with puttygen. After the key is loaded, you can minimize pageant to tray (but don’t shut it down, it needs to run in the background).
Start putty.exe.
pageant
pageant
Start putty and navigate to “Connection - SSH - Auth”. Browse for your private key file (.ppk).
putty auth key
putty auth key
Navigate to “Connection - Data” and input “admin” in the auto-login username field.
putty data
putty data
Go to “Session” and enter your instance Public DNS (E.g. ec2-XX-XX-X-XXX.us-east-2.compute.amazonaws.com, not your instance IP-address) in the “host name” field. Save the session (optional) and click “Open”.
putty host name
putty host name
A console will open. A username and password are not needed, it will automatically load your username from putty and your key from pageant!
Root access
By default, the user root is deactivated. To activate, log in as a standard user.
Type the following in the console:
sudo su -
Set a root password with:
passwd
After setting a password, the root user is activated. To login to your EC2 instance you will still need the standard user (with RSA-key login), but as soon as you are logged in, you can change to root with:
su
Install Supernode
The EC2 instance is now ready for installation.
For the Installation, we will use Paul’s guide (click here), since it has covered everything.
There is one value which you have to change: From section 1.3 change:
Java -Xms768M -Xmx768M
to:
Java -Xms1024M -Xmx1024M
Other than that you can follow the guide, and your supernode will be set up correctly!