Setting Your Groups cmpe 451 Deployment Server on Amazon Web Services



Download 29.26 Kb.
Date23.05.2017
Size29.26 Kb.
#18796

Setting Your Groups CMPE 451 Deployment Server on Amazon Web Services


Most of the material in these notes are from https://alextheedom.wordpress.com/cloud/amazon-free-usage-tier-installing-tomcat-7-on-an-ec2-linux-instance/. However, we have updated files and linux commands to make the install process easier.

Create an account with Amazon Web Services


To sign up for the 12 month free tier offer you will need to give address details, credit or debit card details and your telephone number. The sign up form is located at: http://aws.amazon.com/free/  and it takes just a few minutes to complete the process. As a security measure you will receive an automated telephone call and will be asked to enter a four digit number that appears on the screen into you phone.

Select an instance


With your newly created account you are ready to select an instance. Log into you account and from the list of Amazon Web Service select EC2.

You will enter the control panel of you EC2 instances. As yet you don’t have an instance installed. To install and instance click the button Launch Instance.



https://alextheedom.files.wordpress.com/2013/09/launch-an-instance.jpg

You will be presented with a pop-up menu from which you can select the type of instance to install.



https://alextheedom.files.wordpress.com/2013/09/create-a-new-instance1.jpg

I recommend choosing the free tier Amazon Linux AMI 64bit. Then choose the free tier options for storage.

In security groups, make sure to enable port access for the ports 22(ssh), 80(http), 8080(tomcat), and 3306(mysql)

Create a private key file with a unique name and make sure to download that file.


Download and install Putty


Putty is an SSH client that allows remote access to the root of our Linux instance and can be downloaded from the www.putty.org website. Select the appropriate version for you operating system. While you are there you must also download PuttyGen. This application converts the PEM (Privacy Enhanced Mail Security Certificate) file generated when creating a Key Pair to a PPK file for use in Putty. This file provides authentication when connecting to your instance from Putty.

Once these two application are installed you can must convert the PEM file to a PPK file. Open up PuttyGen and load the PEM file then save it with a PPK extension.


Connect via SSH using Putty


We are now ready to connect to our instance via Putty.

To configure Putty we need the following information:

The public DNS of your instance;

the PPK file we converted from PEM ealier and

the auto-login name.

The DNS of your instance can be found on the EC2Dashboard and will be in the form: ec2-54-93-111-55.eu-central-1.compute.amazonaws.com and will vary depending on the region that the instances is installed in.



public dns

Public DNS

The auto-login name should be: ec2-user

Launch Putty and on the Session screen enter the Public DNS in the Host Name input box and a name in the Saved Sessions box.



putty configuration

Putty Configuration

Switch to the Data screen which is under the Connection menu option and enter the user name in the login details box. Now switch to the Auth screen which is under SSH and Browse to the location where the PPK file is located.

Return to the Session screen and save the configuration. Click Open to connect.



logged into linux instance via ssh

Now you are logged into your instance of Linux on EC2.


Transferring Files to Your Linux Instance Using WinSCP


WinSCP is a GUI-based file manager for Windows that allows you to upload and transfer files to a remote computer using the SFTP, SCP, FTP, and FTPS protocols. WinSCP allows you to drag and drop files from your Windows machine to your Linux instance or synchronize entire directory structures between the two systems.

To use WinSCP, you'll need the private key you generated in Converting Your Private Key Using PuTTYgen. You'll also need the public DNS address of your Linux instance.

Download and install WinSCP from http://winscp.net/eng/download.php. For most users, the default installation options are OK.

Start WinSCP.

At the WinSCP login screen, for Host name, enter the public DNS address for your instance.

For User name, enter the default user name for your AMI. For Amazon Linux AMIs, the user name is ec2-user. For Red Hat AMIs the user name is root, and for Ubuntu AMIs the user name is ubuntu.

Specify the private key for your instance. For Private key, enter the path to your private key, or click the "…" button to browse for the file. For newer versions of WinSCP, you need to click Advanced to open the advanced site settings and then under SSH, click Authentication to find the Private key file setting.

Note

WinSCP requires a PuTTY private key file (.ppk). You can convert a .pem security key file to the .ppkformat using PuTTYgen. For more information, see Converting Your Private Key Using PuTTYgen.

(Optional) In the left panel, click Directories, and then, for Remote directory, enter the path for the directory you want to add files to. For newer versions of WinSCP, you need to click Advanced to open the advanced site settings and then under Environment, click Directories to find the Remote directory setting.

Click Login to connect, and click Yes to add the host fingerprint to the host cache.



https://docs.aws.amazon.com/awsec2/latest/userguide/images/winscp-connection.png

After the connection is established, in the connection window your Linux instance is on the right and your local machine is on the left. You can drag and drop files directly into the remote file system from your local machine. 


Download and install Java 7


Now that we are logged in we will download Java 7. We will need root access so type sudo -iand navigate to the top directory. We are going to download and install Java into a new directory under usr. Create a new directory by doing: mkdir /usr/java and navigate to thejava directory.

wget https://www.dropbox.com/s/c83zluez47dc16p/jdk-8u60-linux-x64.gz?dl=0

or through http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html



Once downloaded we need to unpack it using tar: tar  zxpvf jdk-8u60-linux-x64.gz

Now we set the Java Home and will put Java into the path of our users using the following commands:



JAVA_HOME= /usr/java/jdk1.8.0_60/

export  JAVA_HOME

PATH=$JAVA_HOME/bin:$PATH

export PATH

You can verify that Java is installed by doing: java -version 

Download, install and configure Tomcat 8


We are going to download and install Tomcat 8 in the /usr/share directory by running the following two commands:

wget https://www.dropbox.com/s/bpeetu52uyxigo0/apache-tomcat-8.0.27.tar.gz?dl=0

or through http://tomcat.apache.org/download-80.cgi

Then Run

tar zxpvf apache-tomcat-8.0.27.tar.gz

Tomcat will be unpacked and installed in the apache-tomcat-8.0.27 directory. We will now finish by configuring the Tomcat users and setting tomcat to launch automatically whenever the server restarted.

To configure Tomcat to launch automatically create a file called tomcat in the directory/etc/rc.d/init.d/ with the following contents:

!/bin/sh

# Tomcat init script for Linux.

#

# chkconfig: 2345 96 14

# description: The Apache Tomcat servlet/JSP container.

JAVA_HOME=/usr/java/jdk1.8.0_60/

CATALINA_HOME=/usr/share/apache-tomcat-8.0.27

export JAVA_HOME CATALINA_HOME

exec $CATALINA_HOME/bin/catalina.sh $*

Then execute the following commands to set proper permissions and prep tomcat for auto-launch.

chmod 755 /etc/rc.d/init.d/tomcat

chkconfig --level 2345 tomcat on



Now we need to set up the Tomcat users. This will allows access to the Manger Console in the Tomcat interface. The users are configured in a file called tomcat-users.xml which is stored in the apache-tomcat-8.0.27/config directory. Open this file using nano and edit the user permissions as below, changing the password as appropriate:

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xsi:schemaLocation="http://tomcat.apache.org/xml tomcat-users.xsd"

version="1.0">










We have now configure all that needs to be configured. Go back to the EC2 console and reboot the instance by right clicking on the instance and selecting reboot. This should not take more that a few minutes.

Once the instance has rebooted, go to your browser and enter the public DNS of your instance followed by the port 8080. It should look something like this: http://ec2-54-93-111-55.eu-central-1.compute.amazonaws.com:8080/. You will see the Tomcat Server Home Page. To access the manager application click on the Manager App button on the right-hand side. Enter the user name and password that you configured in the tomcat-users.xml file. You will see the web application manager console from which you can upload a WAR file. Scroll down to the Deploy section, from here you can select a WAR file and deploy it into Tomcat.

The URL of your web application will look something like this: http://ec2-54-93-111-55.eu-central-1.compute.amazonaws.com:8080/Calendar/Calendar.html

 Setting Up MySQL


Run the command

sudo yum install mysql-server

then start mysql by



sudo /sbin/service mysqld start

sudo /usr/bin/mysql_secure_installation

For further instructions please visit: http://www.rackspace.com/knowledge_center/article/installing-mysql-server-on-centos

Download 29.26 Kb.

Share with your friends:




The database is protected by copyright ©ininet.org 2024
send message

    Main page