Install Tomcat 7 for CentOS 6, from the beginning

Source: Internet
Author: User

Because of the training for the enterprise and the use of PHP in previous years too much, this time the server gradually converted to use Java EE to build.


Download the JDK 7. 8 has come out, but not very familiar with, so still download the 7 version number. Here's how to install JDK7 not to say.
Currently the newest Tomcat is 8.0.5, but I still download the 7.0 version number. Because the Eclipse Java EE version number is embedded in the server plug-in support to 7.0. does not support 8.0, so do not want to engage in so much effort to toss.
Download the extracted Tomcat and put it in the/usr/local/tomcat-7.0.
[[email protected] downloads]$ tar zxvf apache-tomcat-7.0.53.tar.gz
[email protected] downloads]$ MVapache-tomcat-7.0.53/usr/local/tomcat-7.0
[email protected] downloads]$ cd/usr/local
Create a Tomcat user and group. But don't create a home directory[email protected] local]$sudo useradd-m tomcat [email protected] local]$ sudo chsh tomcat-s/sbin/nologin
[email protected] local]$ sudo chown-r tomcat.tomcat tomcat-7.0/

To create a daemon on/ETC/INIT.D, first compile the Tomcat-brought Jsvc:[RAF[email protected] local]$ CD tomcat-7.0/bin/
[[email protected] bin]$ tar zxvf commons-daemon-native.tar.gz[email protected] bin]$ CD commons-daemon-1.0.15-native-src/unix/[email protected] unix]$ sudo./configure--with-java=/usr/java/default
[[email protected] unix]$ sudo make
[email protected] unix]$ sudo cpjsvc. /..
[[email protected] unix]$ sudo cd .. /..

Edit daemon.sh. Add a line at the beginning, support Chkconfig, add a look like the following:#!/bin/sh# # Chkconfig:-80 20
#  
# Licensed to the Apache software Foundation (ASF) under one or more
After the script stares, the following two lines are added before the command is run:Java_home=/usr/java/default
catalina_home=/usr/local/tomcat-7.0
Tomcat_user=tomcat
change the value of ARG0 to such as the following:
arg0="/usr/local/tomcat-7.0"

Put the daemon.sh in the/ETC/INIT.D. and configure service self-boot[email protected] unix]$ sudo cp daemon.sh/etc/init.d/tomcatd[email protected] bin]$ cd/etc/init.d/
[email protected] init.d]$ sudo chkconfig--add tomcatd
[[email protected] init.d]$ sudo chkconfig--level 2345 tomcatd on
The last sentence above is for Tomcat to start at Linux2, 3, 4, 5 boot level
Finally we were able to start Tomcat:[email protected] init.d]$ CD[[email protected] ~]$ sudo service tomcatd start
Open browser Access Q: localhost:8080, are you all right?
PS: How do I configure Tomcat if, or your own e-learning it.


Copyright notice: This article blog original article. Blogs, without consent, may not be reproduced.

Install Tomcat 7 for CentOS 6, from the beginning

Related Article

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.