RedHat JDK and tomcat installation

Source: Internet
Author: User

1. Install JDK

A) download jdk-6u26-linux-i586-rpm.bin;

B) in Linux, go to the jdk-6u26-linux-i586-rpm.bin directory and run directly

./Jdk-6u26-linux-i586-rpm.bin; Installation

, If you use the jdk-6u26-linux-i586-rpm.bin directly, this will prompt that the command cannot be found, you must put it in the path, so add the path.

C) if javac can run, the installation is complete.

2. install Tomcat;

A) download apache-tomcat-7.0.19.tar.gz

B) decompress with gzip: gzip-D apache-tomcat-7.0.19.tar.gz

C) Check the apache-tomcat-7.0.19.tar file and decompress it with tar:

Tar-xvf apache-tomcat-7.0.19.tar, here is a two-layer compression, after decompression there will be an Apache-Tomcat-7.0.19 folder below

D) mV APACHE-Tomcat-7.0.19/to the root directory, and mv apache-Tomcat-7.0.19 APACHE-Tomcat 7 to rename the folder;

E) If you switch to the bin directory and run./startup. Sh directly, an error will be reported without the java_home setting.

F) set the environment variable java_home =/usr/Java/jdk_1.6,

G) If you want to make the environment variables available to other users, you must output: exprot java_home.

H) The environment variables set in this way only apply to the current window.

If all users need to take effect, modify the profile file under/etc and add java_home =/usr/Java/jdk_1.6.

If the current user takes effect, change the bash_profile file under the root directory of the user. After the setting is complete, source/etc/profile. You can.

Run echo $ java_home to check whether the environment variable is enabled.

I) run it again.

J) access in the Host:

Note that if the client cannot be accessed, a proxy may be set in the remote client port.

Note that if you want to Configure Automatic startup, you must go to/etc/rc. add/Apache/tomcat/bin/startup under the local file. sh. If no environment variable is configured, add

Export jdk_home =/usr/JDK

Export java_home =/usr/JDK

/Apache/tomcat/bin/startup. sh/* directory where startup. Sh is located */

In this way, the instance can be started.

The most simple method to enable Tomcat Automatic startup is introduced earlier, but it has two shortcomings:

1. users who cannot start the Tomcat service will be unable to run Tomcat as a Super User, posing a major security risk.

2. the Tomcat service cannot be automatically stopped when the system is disabled.

Create a tomcat file in the directory. /Etc/init. d/VI tomcat. The content is as follows :#! /Bin/bash # STARTUP script for the Tomcat # chkconfig: 345 80 15 # Description: Tomcat is a servlet + JSP Engine. # source function library .. /etc/rc. d/init. d/functions retval = 0 checkjava () {if [-z "$ java_home"]; then export java_home =/usr/Java/jdk1.5.0 _ 15 fi} start () {checkjava checkrun if [$ retval-EQ 0]; then Echo "Starting Tomcat"/usr/tomcat/bin/startup. sh touch/var/lock/subsys/tomcat else echo "Tomcat allready running" fi} STOP () {checkjava checkrun if [$ retval-EQ 1]; then ECHO "shutting down Tomcat"/usr/tomcat/bin/shutdown. sh # While [$ retval-EQ 1]; do sleep 5 # checkrun # Done Rm-F/var/lock/subsys/tomcat else echo "Tomcat not running" fi} checkrun () {PS ax-width = 1000 | grep "[O] RG. apache. catalina. startup. bootstrap start "| awk '{printf $1"}' | WC | awk '{print $2}'>/tmp/tomcat_process_count.txt read line </tmp/tomcat_process_count.txt if [$ line-GT 0]; then retval = 1 return $ retval else retval = 0 return $ retval fi} status () {checkrun if [$ retval-EQ 1]; then ECHO-n "Tomcat (PID" PS ax -- width = 1000 | grep "org. apache. catalina. startup. bootstrap start "| awk '{printf $1" "} 'echo-n") is running... "Echo else echo" Tomcat is stopped "fi echo" ------------------------------------------- "} case" $1 "in START) Start; stop) Stop; restart) Stop start; Status) status/usr/tomcat/bin/Catalina. sh version; *) echo "Usage: $0 {START | stop | restart | status}" esac exit 0

3. Check for errors. Run the ps command to check all processes and run the PS-Ef command to list all processes.

A) PS-Ef | grep Tomcat check whether the Tomcat process is started

B) Check whether the firewall is faulty. (Chkconfig iptables off firewall)

C) shut down the process: Kill-92724 is used, where-9 is forced to delete; restart

D) can ping again?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.