2015年5月9日星期六

[方法整理] Deploy war file on EC2 instance

Deploy war file on EC2 instance

1. Use the following statement to connect to the EC2 instance created:
ssh -i task13-key-pair.pem ec2-user@ec2-52-24-226-141.us-west-2.compute.amazonaws.com

2. Install Tomcat7 on that EC2 instance:(reference: http://in4ray.blogspot.com/2012/04/install-tomcat-7-on-amazon-linux.html)
(1) Initiate SSH session (as 'ec2-user') and connect to the Amazon Linux instance by it public DNS name.
(2) Install Tomcat 7 together with standard Tomcat samples, documentation, and management web apps:
sudo yum install tomcat7-webapps tomcat7-docs-webapp tomcat7-admin-webapps
(3) Start/stop/restart Tomcat 7 as a service.
start:
sudo service tomcat7 start
stop:
sudo service tomcat7 stop 
restart:
sudo service tomcat7 restart 
(4) Add Tomacat 7 service to the autostart.
sudo chkconfig tomcat7 on
  

3. Deploy war file
(1) Add 8080 port to the security group:(reference: http://www.27programs.com/?p=251)
(2) Upload war file
scp -i task13-key-pair.pem task13V1.war ec2-user@ec2-52-24-226-141.us-west-2.compute.amazonaws.com:~/
(3) On your instance console, go to the directory /var/lib/tomcat7/webapps and copy the war file
[ec2-user@ip-172-31-42-83 ~]$ cp task13V1.war /var/lib/tomcat7/webapps/task13V1.war
(4) Restart tomcat by issuing:
sudo service tomcat7 restart  
(5) Access the application from browser

没有评论:

发表评论