文档章节

Set Up an Amazon EC2 Instance with Tomcat and MySQ

Albert-Liu
 Albert-Liu
发布于 2015/01/17 10:51
字数 587
阅读 14
收藏 1

Create an AWS Account

First things first: you need to create your AWS account. You can sign up here. You’ll have to provide a credit card and a phone number where you will be called as part of the online registration process for verification purposes. Amazon offers a Free Usage Tier, which is great to explore the services and even host real apps without being charged. Check the details here.

Create an Instance

Now that you have an AWS account, access the AWS Management Console and click the EC2 tab to create a new instance:

  • Choose an AMI in the classic instance wizard: I chose the Basic 64-bit Amazon Linux AMI.

  • Instance details: keep the default settings.

  • Create a new key pair. Enter a name for your key pair (i.e. christophe) and download your key pair (i.e. christophe.pem).

  • Select the quick start security group.

  • Launch your instance.

SSH

Once your instance is running, you can ssh into it. First, you need to identify the address of your instance: Select the instance in the AWS Management Console, and look for the Public DNS in the instance description (bottom part of the screen).

Use that address (and a path to your .pem file) to ssh into your instance:
ssh ec2-user@ec2-50-17-14-16.compute-1.amazonaws.com -i ~/christophe.pem

Important Notes:

  1. You may have to chmod your .pem file as follows:
    chmod 600 ~/christophe.pem

  2. Depending on the image you chose, you may also have to replace ec2-user with rootor ubuntu. ec2-user is what you need for an Amazon Linux AMI.

SFTP

At this point, you can also SFTP into your new instance using parameters similar to these:

host: ec2-50-17-14-16.compute-1.amazonaws.com
port: 22
user: ec2-user
password: Select your .pem file

Elastic IP

The public DNS address changes when you restart your instance. To get a permanent IP address, click Elastic IPs in the AWS Management Console (left navigation bar), allocate a new IP address and associate it with your instance.

Install Tomcat

To install tomcat, ssh into your instance and type the following command:
sudo yum install tomcat6 tomcat6-webapps

“tomcat6-webapps” is optional and will install the Tomcat sample apps. The configuration files are in /usr/share/tomcat6. To install your own web app, you can simply SFTP it to /usr/share/tomcat6/webapps.

To start Tomcat:
sudo service tomcat6 start

To stop Tomcat:
sudo service tomcat6 stop

The default Tomcat server uses port 8080. You need to open that port on your instance to make sure your Tomcat server is available on the Web (you could also change the default port). In the AWS Management Console, select Security Groups (left navigation bar), select the quick-start group, the Inbound tab and add port 8080. Make sure you click “Add Rule” and then “Apply Rule Changes”.

You should now be able to access your Tomcat server from a browser using (use your own Public DNS address or Elastic IP):
http://ec2-50-17-14-16.compute-1.amazonaws.com:8080/

MySQL

To install MySQL, ssh into your instance and type the following command:
sudo yum install mysql-server

To start MySQL:
sudo service mysqld start

To stop MySQL:
sudo service mysqld stop

MySQL Workbench

You can administer your database remotely using MySQL Workbench. You don’t have to open an additional port (i.e. 3306). Simply choose Standard TCP/IP over SSH in the Setup New Connection dialog as follows:


本文转载自:http://coenraets.org/blog/2011/11/set-up-an-amazon-ec2-instance-with-tomcat-and-mysql-5-minutes-t...

Albert-Liu
粉丝 7
博文 19
码字总数 12128
作品 0
深圳
架构师
私信 提问
Amazon EC2配置步骤和一些问题

上次使用Amazon EC2的步骤没有记下来,导致这次配置新帐号时比较麻烦,这里把配置云服务器的常用操作记录在一起提高效率。2015/5/19注:最早我使用的是Amazon EC2,后来由于价格和SSD的原因改...

青夜之衫
2017/12/07
0
0
Amazon EC2 安装 Shadowsocks

Amazon EC2申请帐号,信用卡信息,电话验证(接到电话后,输入网页上的Pin码即可)。 如果担心今后被扣款,可以申请帐号后,到 Amazon.com 删除信用卡信息。(补充:没用,仍旧扣款) 登录后,...

爪哇小贩
2016/04/26
314
0
readuce DDOS attacks

Distributed denial of service (DDoS) attacks are sometimes used by malicious actors in an attempt to flood a network, system, or application with more traffic, connections, or r......

Oscarfff
2016/07/26
56
0
翻译 | 3种方式提升云可扩展性

背景知识 云计算作为一种资源, 它的可扩展性是指关于如何处理可变规模业务的能力. 包括 水平扩展 和 垂直扩展. 什么意思呢? 水平扩展(horizontal scaling) 也称为横向扩展, 指能够连接多个软...

fesoncn
2018/01/17
0
0
使用Amazon EC2搭建自己的VPN 服务器

1。首先你要有一个amazon的账号 2。AWS EC2进去建立个instance. 选免费的就可以了。我选了win server 2008 不会看我博客的Amazon EC2的使用。 3。 建好了。远程连接上。在win server 里面配置...

robinclark
2014/09/20
1K
0

没有更多内容

加载失败,请刷新页面

加载更多

springboot配置文件读取pom文件信息

解决的问题 springboot(当然别的也可以)多环境切换需要该配置文件,打包时不够方便。 解决: 配置文件能读取pom文件中的配置,根据命令选择不同配置注入springboot的配置文件中 pom配置文件...

刘一草
6分钟前
2
0
蓝牙自定开锁时间--Python

from Crypto.Cipher import AESfrom binascii import b2a_hex, a2b_hex###强制输入明文增加到16字节的倍数,在末尾补'\0'def add_to_16(text): text = str(text, 'ISO-8859-1'......

丁典
6分钟前
1
0
好程序员web前端教程分享JS基础知识

  好程序员web前端教程分享JS基础知识,为大家分享一篇关于JS的基础知识。   1、执行环境:有时也叫环境,是JavaScript中最为重要的一个概念,执行环境定义了变量或函数有权访问的其他数...

好程序员官网
8分钟前
1
0
kali和win共享文件夹设置

卸载vmtools > whereis vmware-tools /etc/vmware-tools/ /usr/lib/vmware-tools/> cd /etc> sudo rm -r vmware-tools> cd /usr/lib> sudo rm -r vmware-tools 先添加源 leafpa......

yeahlife
10分钟前
1
0
killall 、kill 、pkill 命令区别

killall 命令Linux系统中的killall命令用于杀死指定名字的进程(kill processes by name)。我们可以使用kill命令杀死指定进程PID的进程,如果要找到我们需要杀死的进程, 我们还需要在之前使...

突突突酱
17分钟前
1
0

没有更多内容

加载失败,请刷新页面

加载更多

返回顶部
顶部