Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm trying to install Tomcat7 on an Amazon EC2 instance, but it doesn't work. Below is the console output:

[ec2-user@ip-XXX ~]$ sudo yum install tomcat7
Loaded plugins: amazon-id, rhui-lb, security
Setting up Install Process
No package tomcat7 available.
Error: Nothing to do

Additionally I would also like to install the Tomcat connector native libraries.

[ec2-user@ip-XXX ~]$ sudo yum repolist
Loaded plugins: amazon-id, rhui-lb, security
rhui-REGION-client-config-server-6  | 2.6 kB   00:00
rhui-REGION-rhel-server-releases    | 3.7 kB   00:00
rhui-REGION-rhel-server-releases-optional | 3.5 kB     00:00
repo id                                     repo name                          status
rhui-REGION-client-config-server-6          Red Hat Update Infrastructure 2.0 Client Configuration Server 6  5
rhui-REGION-rhel-server-releases            Red Hat Enterprise Linux Server 6 (RPMs)                  11,976
rhui-REGION-rhel-server-releases-optional   Red Hat Enterprise Linux Server 6 Optional (RPMs)   6,833
repolist: 18,814

[ec2-user@ip-XXX ~]$ sudo yum list tomcat7*
Loaded plugins: amazon-id, rhui-lb, security
Error: No matching Packages to list
share|improve this question
    
Can you post the output of "sudo yum repolist" and "sudo yum list tomcat7*"? –  kernelpanic Nov 22 '13 at 16:52
    
I added the output to the question –  Adrian Ber Nov 22 '13 at 18:30

2 Answers 2

Tomcat7 is not available in the yum Repo on EC2. So this is how installed tomcat 7 on my RHEL 6.4 EC2 instance:

First, I wanted oracle jdk.

Oracle JDK installation:

Remove any existing JDKs

# rpm -qa | grep jdk
java-1.6.0-openjdk-1.6.0.0-1.62.1.11.11.90.el6_4.x86_64
java-1.7.0-openjdk-1.7.0.25-2.3.10.4.el6_4.x86_64
# rpm -e java-1.6.0-openjdk-1.6.0.0-1.62.1.11.11.90.el6_4.x86_64 java-1.7.0-openjdk-1.7.0.25-2.3.10.4.el6_4.x86_64

Download and Install Oracle JDK

# wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F" "http://download.oracle.com/otn-pub/java/jdk/7u45-b18/jdk-7u45-linux-x64.rpm"
# mv jdk-7u45-linux-x64.rpm\?AuthParam\=1385533795_9ebb9bbbd4d15a8ca5d17a0dab41fedc jdk-7u45-linux-x64.rpm
# rpm -ivh jdk-7u45-linux-x64.rpm

Verification

# java -version
java version "1.7.0_45"
Java(TM) SE Runtime Environment (build 1.7.0_45-b18)
Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode)
# javac -version
javac 1.7.0_45

Set JAVA_HOME

# echo "export JAVA_HOME=/usr/java/default" >> /etc/profile
# source /etc/profile

Tomcat 7 Installation:

Download Tomcat

# wget http://www.trieuvan.com/apache/tomcat/tomcat-7/v7.0.47/bin/apache-tomcat-7.0.47.tar.gz
# tar -xvzf apache-tomcat-7.0.47.tar.gz
# mv apache-tomcat-7.0.47 /usr/share/

Make tomcat run as a script.

# cat > /etc/init.d/tomcat < EOF
#!/bin/bash
# description: Tomcat Start Stop Restart
# processname: tomcat
# chkconfig: 234 20 80
JAVA_HOME=/usr/java/default
export JAVA_HOME
PATH=$JAVA_HOME/bin:$PATH
export PATH
CATALINA_HOME=/usr/share/apache-tomcat-7.0.47/

case $1 in
start)
sh $CATALINA_HOME/bin/startup.sh
;;
stop)
sh $CATALINA_HOME/bin/shutdown.sh
;;
restart)
sh $CATALINA_HOME/bin/shutdown.sh
sh $CATALINA_HOME/bin/startup.sh
;;
esac
exit 0
EOF

Tomcat service commands:

# chmod 755 /etc/init.d/tomcat
# chkconfig  --add tomcat
# chkconfig  tomcat on
# chkconfig  --list tomcat
# service tomcat start
Using CATALINA_BASE:   /usr/share/apache-tomcat-7.0.47
Using CATALINA_HOME:   /usr/share/apache-tomcat-7.0.47
Using CATALINA_TMPDIR: /usr/share/apache-tomcat-7.0.47/temp
Using JRE_HOME:        /usr/java/default
Using CLASSPATH:       /usr/share/apache-tomcat-7.0.47/bin/bootstrap.jar:/usr/share/apache-tomcat-7.0.47/bin/tomcat-juli.jar

Add JAVA_OPTS as below on 2nd line on /usr/share/apache-tomcat-7.0.47/bin/catalina.sh so that it looks like:

#!/bin/sh
JAVA_OPTS="-Xms1024m -Xmx2048m"

Restart Tomcat

# service tomcat restart

Verification:

# netstat  -anp | grep 8080
tcp        0      0 :::8080                     :::*                        LISTEN      1792/java

You can configure tomcat to be run a normal user as well. It wasn't needed in my case and hence I did not do it. Hope this helps.

share|improve this answer

just search for tomcat instead of tomcat7*

#yum search tomcat
apache-tomcat-apis.noarch : Tomcat Servlet and JSP APIs
jakarta-commons-dbcp-tomcat5.noarch : DBCP dependency for Tomcat5
jakarta-commons-pool-tomcat5.x86_64 : Pool dependency for Tomcat5
tomcat6-jsp-2.1-api.noarch : Apache Tomcat JSP API implementation classes
tomcat6-lib.noarch : Libraries needed to run the Tomcat Web container
tomcat6-servlet-2.5-api.noarch : Apache Tomcat Servlet API implementation classes
tomcatjss.noarch : JSSE implementation using JSS for Tomcat
tomcat6.noarch : Apache Servlet/JSP Engine, RI for Servlet 2.5/JSP 2.1 API
tomcat6-el-2.1-api.noarch : Expression Language v1.0 API
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.