Aug 26, 2014

Installing Tomcat 7 + Postgres 9.3 on Amazon Linux


-------------------------------------------------------------------------------------------------------
Tomcat Part
-------------------------------------------------------------------------------------------------------

#install tomcat7

sudo yum install tomcat7-webapps tomcat7-docs-webapp tomcat7-admin-webapps
       
 

#auto startup


sudo chkconfig tomcat7 on
       
 

#redirect port


sudo /sbin/iptables -t nat -I PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8080

sudo /sbin/service iptables save
       
 

-------------------------------------------------------------------------------------------------------
Postgres Part
-------------------------------------------------------------------------------------------------------

Install from rpm/yum from postgres repo

In the files
/etc/yum.repos.d/amzn-main.repo
and
/etc/yum.repos.d/amzn-updates.repo add the following in the
block [amzn-main]:

///////////////////////////////////////
exclude=postgresql*
///////////////////////////////////////

Then, install the repo rpm and run yum
# Change to home directory to download the software


cd ~/
       
 
# Get the right postgresql package (Redhat 64 Bit)


wget http://yum.postgresql.org/9.3/redhat/rhel-6-x86_64/pgdg-redhat93-9.3-1.noarch.rpm
       
 
# Install the package


sudo rpm -ivh pgdg-redhat93-9.3-1.noarch.rpm
sudo yum install postgresql93 postgresql93-server postgresql93-devel
       
 
# Check that the service is installed


sudo service postgresql-9.3 status
       
 
# should return "is stopped"

# init the DB


sudo service postgresql-9.3 initdb
       
 
# Start the DB

sudo service postgresql-9.3 start
       
 
# connect


sudo su - postgres
psql
       
 
# auto startup


sudo chkconfig postgresql-9.3 on
       
 
source

No comments: