3

I am configuring CentOS 7 system for a Java developer. So firstly I have installed Java using command

wget java-1.7.0-openjdk-1.7.0.131-2.6.9.0.el7_3.x86_64.rpm

after that installed the downloaded package

yum install java-1.7.0-openjdk-1.7.0.131-2.6.9.0.el7_3.x86_64.rpm

and it is successfully installed, and I have checked it using

java -version

and below is the command reply

java version "1.7.0_131"
OpenJDK Runtime Environment (rhel-2.6.9.0.el7_3-x86_64 u131-b00)
OpenJDK 64-Bit Server VM (build 24.131-b00, mixed mode)

Please tell me if there is something wrong in the above process. Now I have to install Apache tomcat 8 but I am studying it over net but that is quite confusing because they are creating groups and something like permissions. Please someone tell me the shortest way because we only want to test the system and will deploy a sample test.war for our testing purpose.

5
  • do you need help on installing tomcat ? Feb 14, 2017 at 6:33
  • yes @Ali Golestan Feb 14, 2017 at 6:34
  • do you have the tomcat installation files ? Feb 14, 2017 at 6:36
  • yes i have downloaded the tomcat7 rpm package using wget @AliGolestan Feb 14, 2017 at 6:39
  • please tell me what to do further @AliGolestan Feb 14, 2017 at 6:40

1 Answer 1

2

after you have installed java on your system, you need to do as i mention here:

#mv apache-tomcat-7 /opt

#useradd tomcat

#chown -R tomcat:tomcat /opt/apache-tomcat-7

To Install tomcat you need to run the startup.sh

#cd /opt/apache-tomcat…

#./bin/startup.sh

now you make tomcat file in init.d directory to run tomcat as a service.

#vim /etc/init.d/tomcat

  • copy paste the following script in your tomcat file, change directories as it is in your system

#!/bin/bash

# chkconfig: 234 20 80

# description: Tomcat Server basic start/shutdown script

export TOMCAT_HOME=/opt/apache-tomcat-7 START_TOMCAT=${TOMCAT_HOME}/bin/startup.sh STOP_TOMCAT=${TOMCAT_HOME}/bin/shutdown.sh

export downloadPath=/tmp

export JAVA_OPTS="-Xms2g -Xmx2g -XX:PermSize=512m -XX:MaxPermSize=512m"

start() { echo -n "Starting tomcat: " cd ${TOMCAT_HOME}/bin su -p -s /bin/sh tomcat ${START_TOMCAT} echo "done." }

stop() { echo -n "Shutting down tomcat: " cd ${TOMCAT_HOME}/bin su -p -s /bin/sh tomcat ${STOP_TOMCAT} sleep 5 for pid in ps -ef | grep org.apache.catalina.startup.Bootstrap | grep -v grep | awk '{print $2}' | xargs do kill -9 $pid done echo "done." }

case "$1" in

    start)
    start
    ;;

    stop)
    stop
    ;;

    restart)
    stop
    start
    ;;

    *)
    echo "Usage: $0 {start|stop|restart}"

esac

exit 0

chmod +x /etc/init.d/tomcat

chkconfig --add tomcat

su - tomcat

service tomcat start

note that Permsize, xms and xmx sizes are optional and you need to ask your developers for the exact amount.

if you need help on creating users for the web login on tomcat, please ask.

12
  • Actually i have created a directory under /opt named tomcat7, where i have downloaded package so should i install it now using yum install package_name. Sorry i know i am asking very basic question, but i am newbie Feb 14, 2017 at 7:10
  • as i mentioned in my answer To Install tomcat you need to run the startup.sh go to your apache directory #cd /opt/apache-tomcat… and run #./bin/startup.sh Feb 14, 2017 at 7:23
  • sorry, but i have used the command =>yum install tomcat-7.0.69-10.el7.noarch.rpm. Now tell me what to do after it. Feb 14, 2017 at 7:39
  • Please tell me one thing more whenever we install any package using command yum install package_name(Where the file related to that package are saved in our system) @Ali Golestan Feb 14, 2017 at 7:41
  • if your tomcat service is up and running, use your web browser to open the tomcat server address. check to see if your url is working go to ServerIPaddress:8080 Feb 14, 2017 at 7:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .