Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the process of configuration installation performed by ordinary CentOS tomcat users

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This issue of the content of the editor will bring you about CentOS tomcat ordinary users to implement the configuration installation process is how, the article is rich and professional point of view for everyone to analyze and describe, after reading this article, I hope you can get something.

CentOS tomcat after a long period of development, here I would like to publish a personal understanding, here is to talk about the art CentOS tomcat. CentOS tomcat6_jdk1.6_ installation configuration _ enable autorun, ordinary users execute (transfer) show linux notes of CentOS tomcat6 practical articles due to some time ago has been outside on a business trip, did not complete CentOS tomcat execution as ordinary users, boot automatic running articles are now sorted out, including the solutions to errors in debugging scripts

Environment: operating system: centos 4.5_x86 database oracle 10.2.01_x86_32jvre:1.6:jdk-6u1-linux-i586-rpm.bintomcat6.0: compiled binary package apache-tomcat-6.0.13.tar.gz

CentOS tomcat6.0 installation path: / usr/local/tomcat6oracle jdbc:class12.jar package storage path: / home/xiutuo/software/java installation path: / usr/java/jdk1.6.0_01 use ordinary user: xiutuo to start CentOS tomcat6tomcat6 boot automatic startup script: / etc/init.d/tomcat

One: install jre

1. Install the jre package

# cd / home/xiutuo/software enter the package storage directory # chmod aquix jdk-6u1-linux-i586-rpm.bin gives it permission to execute #. / jdk-6u1-linux-i586-rpm.bin, type yes when you see [yes], enter enter, and then jdk-6u1-linux-i586-rpm# rpm-ivh jdk-6u1-linux-i586-rpm installation jdk is generated in the current directory. If there is another old version of jdk before, uninstall it. Such as: rpm-e j2sdk-1.4.1-fcs

2: set environment variables

Only one user, not all users, can modify the ~ / .cshrc, ~ / .bash_profile file, appending the following paragraph, if environment variables are added to all users and later added users

Append / etc/profie file. * do not repeat appends in profile and ~ / .cshrc or ~ / .bash_profile * * here: # vi / etc/profile / / java / / if the path of the j2sdk you installed is different, please modify it yourself

JAVA_HOME=/usr/java/jdk1.6.0_01 export JAVA_HOME CLASSPATH=/usr/java/jdk1.6.0_01/lib:/usr/java/jdk1.6.0_01/jre/lib export CLASSPATH PATH=$PATH:$JAVA_HOME/bin:$JAVA_HOME/jre/bin export PATH JRE=/usr/java/jdk1.6.0_01/jre export JRE

3: effective immediately

/ / if you modify / etc/profile # source / etc/profile / / if you modify ~ / .cshrc # source ~ / .cshrc / / if you modify ~ / .bash_profile # source ~ / .bash_profile

4: whether the test is successful or not

# java-version appears java version "1.4.2" / / it's weird here, originally jre is 1.6, but here …... Gcj (GCC) 3.4.6 20060404 (Red Hat 3.4.6-8) Copyright (C) 2006 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

The solution to this problem is # cd / usr/java/# ls-l to see if the default and latest folders are jdk1.6.0_01 soft connections. If so, you don't need to modify them, otherwise delete default and latest,# rm-rf default# rm-ff latest and then # ln-s jdk1.6.0_01 default# ln-s jdk1.6.0_01 latest delete the / usr/bin/ directory.

Java,javac,javaws # cd / usr/bin # rm-f java # rm-f javac # rm-f javaws

Then:

# ln-s / usr/java/default/bin/java / usr/bin/java # ln-s / usr/java/default/bin/javac / usr/bin/javac # ln-s / usr/java/default/bin/javaws / usr/bin/javaws

* * again

/ / if you modify / etc/profile # source / etc/profile / / if you modify ~ / .cshrc # source ~ / .cshrc / / if you modify ~ / .bash_profile # source ~ / .bash_profile

Re-execution

# java-version / / normal this time java version "1.6.00.001" Java (TM) SE Runtime Environment (build 1.6.0_01-b06) Java HotSpot (TM) Client VM (build 1.6.0_01-b06, mixed mode, sharing)

Two: install CentOS tomcat6

1. Install tomcat

# cd / home/xiutuo/software / / enter the package directory # tar-zvxf apache-tomcat-6.0.13.tar.gz / / extract # mv apache-tomcat-6.0.13 / usr/local/tomcat6/ / install # cd / usr/local/tomcat6/bin/ enter the installation directory # tar xvfz jsvc.tar.gz / / decompress # cd jsvc-src / / enter the jsvc-src directory # autoconf #. / configure-- remember the jdk path with java when with-java=/usr/java/jdk1.6.0_01 # configure Otherwise, it is impossible to automatically start tomcat # make / / to generate the jsvc file # cp jsvc. / / copy jsvc to the parent directory # cd.. / / return to the parent directory # cd / usr/local/tomcat6/

/ / run the following command to make tomcat run in daemon mode

#. / bin/jsvc-cp. / bin/bootstrap.jar "- outfile. / logs/catalina.out"-errfile. / logs/catalina.err "org.apache.catalina.startup.Bootstrap

two。 Configure jdbc// copy of oralce jdbc to / usr/local/tomcat6/lib directory # cp / home/software/class12.jar. / lib/

3. Configure CentOS tomcat user # cd / usr/local/tomcat6/conf# vi tomcat-users.xml as follows:

Please change the password of all defined users in CentOS tomcat: that is, change password to the value you want.

4. Start and stop the tomcat service

# cd / usr/local/tomcat6/bin #. / start.sh / / start tomcat #. / shutdown.sh / / stop tomcat to view the tomcat process: # ps-e | grep java

If there is a java process, it means your tomcat is almost done.

5. Turn CentOS tomcat on and run:

# cd / usr/local/tomcat6/bin/jsvc-src/native/ # cp Tomcat.sh / etc/init.d/tomcat # here use tomcat4's autorun script to modify # vi tomcat

The modified content is as follows:

# how to use this script under Linux

#

# remember to add the jdk path of java when 1.configure, otherwise you can't start tomcat automatically with ordinary users booting.

#. / configure-with-java=/usr/java/jdk1.6.0_01

#

# 2. First generate the catalina.out,catalina.err log file for tomcat and store it in

# path: / usr/local/tomcat6/logs

# easy to view error messages during script debugging

# cd / usr/local/tomcat6

# enter the installation directory of tomcat6 first, and then execute the following command to generate log files!

#. / bin/jsvc-cp. / bin/bootstrap.jar

#-outfile. / logs/catalina.out-errfile. / logs/catalina.err "

# org.apache.catalina.startup.Bootstrap

#

# 3. Change tomcat installation directory permissions

# remember: the permissions for tomcat6 files in the tomcat installation directory should belong to the user running tomcat

# here change the entire tomcat6 folder and the files under it to xiutuo users and xiutuo groups!

# chown-R xiutuo:xiutuo / usr/local/tomcat6

# if you don't worry, execute it again.

# chown-R xiutuo:xiutuo / usr/local/tomcat6/*

# chmod-R 755 / usr/local/tomcat6

#

# cd / usr/local/tomcat6/bin/jsvc-src/native/

# 4. Automatically start script editing and weighting

# cp tomcat5.sh / etc/init.d/tomcat

# chown xiutuo:xiutuo tomcat

# chmod 711 tomcat

#

# establish a soft connection

#

# ln-s / etc/init.d/tomcat / etc/rc.d/rc3.d/K01tomcat

# ln-s / etc/init.d/tomcat / etc/rc.d/rc3.d/S99tomcat

# ln-s / etc/init.d/tomcat / etc/rc.d/rc5.d/K01tomcat

# ln-s / etc/init.d/tomcat / etc/rc.d/rc5.d/S99tomcat

#

# 5. If you see that the script is already working, the method is as follows:

# Startup script: / etc/init.d/tomcat start

# a. Check the web browser to see if you can access the management page of tomcat

# b. Check to see if there is a jsvc process ps-e | grep jsvc

# if you see two jsvc processes, congratulations, you made it!

#

# 6. The solution to the script that does not work properly:

# Startup script: / etc/init.d/tomcat start

# View the two log files in the / usr/local/tomcat6/logs/ directory:

# catalina.out,catalina.err, use cat to view.

# a. Error

# Cannot find daemon loader org/apache/commons/daemon/support/DaemonLoader

# solution: change the permissions of the tomcat installation directory to be readable by all users and belong to xiutuo users and xiutuo groups

# Command: chmod-R 755 / usr/locat/tomcat6

# chown-R xiutuo:xiutuo / usr/locat/tomcat6

# b. Error

# Cannot open PID file / var/run/jsvc.pid

# solution: chown xiutuo:xiutuo / var/run/jsvc.pid

# chown 744 / var/run/jsvc.pid

JAVA_HOME=/usr/java/jdk1.6.0_01

# change to your java installation directory

CATALINA_HOME=/usr/local/tomcat6/

# change to your CentOS tomcat installation directory

DAEMON_HOME=/usr/local/tomcat6/bin/jsvc-src/

# change to the directory where the jsvc program is located

TOMCAT_USER=xiutuo

# change it to an ordinary user who starts CentOS tomcat

JAVA_HOME=/usr/java/jdk1.6.0_01

# change to your java installation directory

CATALINA_HOME=/usr/local/tomcat6

# change to your CentOS tomcat installation directory

DAEMON_HOME=/usr/local/tomcat6/bin

# change it to the directory where the jsvc program is located, and remember that the process is started automatically by booting tomcat.

# when testing the script, use / etc/init.d/tomcat start

# if it starts smoothly, you can see two jsvc processes through ps-e

TOMCAT_USER=xiutuo

# change it to an ordinary user who starts tomcat

TMP_DIR=/var/tmp

CATALINA_OPTS=

# regardless of this environment variable

CLASSPATH= "

$JAVA_HOME/lib/tools.jar: "

$DAEMON_HOME/commons-daemon.jar: "

$CATALINA_HOME/bin/bootstrap.jar

# classpath this is very important, be sure to make sure these three

# tools.jar 、 commons-daemon.jar 、 bootstrap.jar

The correct path to #.

Case "$1" in

Start)

#

# Start Tomcat

#

$DAEMON_HOME/jsvc "

-user $TOMCAT_USER "

-home $JAVA_HOME "

-Dcatalina.home=$CATALINA_HOME "

-Djava.io.tmpdir=$TMP_DIR "

-outfile $CATALINA_HOME/logs/catalina.out "

-errfile'& 1' "

$CATALINA_OPTS "

-cp $CLASSPATH "

Org.apache.catalina.startup.Bootstrap

#

# To get a verbose JVM

#-verbose "

# To get a debug of jsvc.

#-debug "

Stop)

#

# Stop Tomcat

#

PID= `cat / var/run/ jsvc.pid`

Kill $PID

*)

Echo "Usage tomcat.sh start/stop"

Exit 1

Esac

This is how the configuration installation process for ordinary CentOS tomcat users is shared by Xiaobian. If you happen to have similar doubts, please refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report