Git Product home page Git Product logo

installtomcataws's Introduction

Install Tomcat 8.x in AWS EC2 Instance (Amazon Linux AMI)

You will find as well the configuration of Nginx and PostgreSQL. Special thanks to @caden for the contribution!

Software to install

  • Java 8
  • Tomcat 8.x

Check YUM Updates

sudo su
yum list installed
yum update

Install Java 8

yum install java-1.8.0
yum remove java-1.7.0-openjdk

Install Tomcat 8.x

yum install tomcat8 tomcat8-webapps tomcat8-admin-webapps tomcat8-docs-webapp

Start Tomcat Service

service tomcat8 start

Tomcat Paths

1 Edit the tomcat-users file

cd  /usr/share/tomcat8
vim /usr/share/tomcat8/conf/tomcat-users.xml

2 Add this line according your desired configuration (vi commands: "i" for insert mode, "ESC" key to escape the inserting mode, ":wq" for write an quit)

<user name="admin" password="YOURPASSWORD" roles="admin,manager,admin-gui,admin-script,manager-gui,manager-script,manager-jmx,manager-status" />

Check Tomcat Installation

  • fuser: to display the process id(PID) of every process using the specified files
fuser -v -n tcp 8080
  • netstat: to list out all the network (socket) connections on a system
netstat -na | grep 8080

Set Auto Start for Tomcat Service

sudo chkconfig --list tomcat8
sudo chkconfig tomcat8 on

Install Nginx

yum install nginx

Add Nginx Domain Binding

vi /etc/nginx/conf.d/shenhe.org.conf
server {
    listen       80;
    listen       [::]:80;
    server_name  shenhe.org;
    root         /usr/share/nginx/html;
	location / {
    	proxy_connect_timeout 300;
        proxy_send_timeout 300;
        proxy_read_timeout 300;
        proxy_pass http://localhost:8080;
        }
}

You can add more bindings. It’s similar. If you just want nginx to handle static files (like images, javascript, css etc), you just do it like this:

server {
    listen       80;
    listen       [::]:80;
    server_name  static.shenhe.org;
    root         /usr/share/nginx/html;
}

Start Nginx

service nginx start

Set Auto Star for Nginx Service

sudo chkconfig --list nginx
sudo chkconfig nginx on

Install PostgreSQL

sudo yum install postgresql postgresql-server

Initialize postgresql DB

sudo service postgresql initdb

Start PostgreSQL

sudo service postgresql start

Login in with postgres

sudo -u postgres psql

Change Password

\password postgres

Quit

\q

Enable Remote Access

sudo vi /var/lib/pgsql9/data/pg_hba.conf

Add you IP to trust IP

host all all 125.69.29.0/24     trust

Also change this line from

host    all             all             127.0.0.1/32            ident

To

host    all             all             127.0.0.1/32            md5
sudo vi /var/lib/pgsql9/data/postgresql.conf

Change

#listen_addresses = 'localhost'

To

listen_addresses = '*'

Auto Start PostgreSQL

sudo chkconfig --list postgresql
sudo chkconfig postgresql on

installtomcataws's People

Contributors

carloscharz avatar

Watchers

krayr avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.