Deploying Tomcat in Linux

Source: Internet
Author: User

Pre-installation settings:

1. Installing wget:yum-y install wget

2. Setup make environment: Yum install gcc gcc-c++ autoconf automake


(1) Install APR, this is Apache to improve the performance of Tomcat a set of localized sockets, Thread, IO components that it has advanced IO functionality, operating system-level function calls, and local process processing and so on.

(2) Installing Tomcat Native, this project allows Tomcat to use Apache's APR package to handle including file and network IO operations to improve performance.

I. Installation of APR

(1) Install Apr
# wget http://archive.apache.org/dist/apr/apr-1.5.1.tar.gz
# tar ZXVF apr-1.5.1.tar.gz

# MV apr-1.5.1/usr/local/
# cd/usr/local/apr-1.5.1
#./configure--PREFIX=/USR/LOCAL/WWW/APR
# make
# make Install

(2) Installation Apr-iconv
# wget http://archive.apache.org/dist/apr/apr-iconv-1.2.1.tar.gz
# TAR-ZXVF Apr-iconv-1.2.1.tar.gz

# MV apr-iconv-1.2.1/usr/local/
# cd/usr/local/apr-iconv-1.2.1
#./configure--prefix=/usr/local/www/apr-iconv--WITH-APR=/USR/LOCAL/WWW/APR
# make
# make Install

(3) Installation Apr-util
# wget http://archive.apache.org/dist/apr/apr-util-1.5.4.tar.gz
# tar ZXVF apr-util-1.5.4.tar.gz

# MV apr-util-1.5.4/usr/local/
# cd/usr/local/apr-util-1.5.4
#./configure--prefix=/usr/local/www/apr-util--with-apr=/usr/local/www/apr--with-apr-iconv=/usr/local/www/ Apr-iconv/bin/apriconv
# make
# make Install

Ii. installation of Tomcat and tomcat-native

(1) JDK Installation


# download jdk-8u20-linux-x64.rpm
# chmod A+x jdk-8u20-linux-x64.rpm
# RPM-IVH jdk-8u20-linux-x64.rpm

Setting environment variables
# Vi/etc/profile
Add the following content at the end

Export java_home=/usr/java/jdk1.8.0_20/
Export JRE_HOME=/USR/JAVA/JDK1.8_0_20/JRE
Export path= $PATH: $JAVA _home/bin: $JRE _home/bin
Export classpath= $JAVA _home/lib/tools.jar: $JAVA _home/lib/dt.jar

Run Tests

# java-version

Check the Java version, if it is 1.8, it means the installation was successful.

Reference: http://cyr520.blog.51cto.com/714067/752079



(2) Installing Tomcat
# wget http://mirror.bjtu.edu.cn/apache/tomcat/tomcat-8/v8.0.14/bin/apache-tomcat-8.0.14.tar.gz
# TAR-ZXVF Apache-tomcat-8.0.14.tar.gz
# MV Apache-tomcat-8.0.14/usr/local/www/tomcat
# vi/usr/local/www/tomcat/bin/catalina.sh

Add a line:

java_home=/usr/java/jdk1.8.0_20/

Start Tomcat
#/usr/local/www/tomcat/bin/startup.sh


(3) Installation tomcat-native

After installing the TOMCAT7, Tomcat-native is already in the Tomcat Bin directory and can be used directly
# Cd/usr/local/www/tomcat/bin
# tar ZXVF tomcat-native.tar.gz
# CD tomcat-native-1.1.31-src/jni/native/
#./configure--WITH-APR=/USR/LOCAL/WWW/APR--with-java-home=/usr/java/jdk1.8.0_20
# make
# make Install


(4) Set environment variables for Apr:

# Vi/etc/profile

Add the following after

Export Ld_library_path= $LD _library_path:/usr/local/apr/lib


# Source/etc/profile This sentence is for the setting to take effect

# bin/startup.sh Start Tomcat

The contents of the console will be written in the logs/catalina.out, if only to view the words with more logs/catalina.out on the line, efficiency than VI to high, press the space bar to page.

If you want to keep a view of the console's input, you can use

# tail-f Logs/catalina.out

Stop pressing CRUL+C

viewing system processes
# PS aux
To see if a process contains a Tomcat process
# Ps-ef | grep Tomcat
See if port 8080 is started
# NETSAT-TLN


Other machines cannot access the Linux Tomcat solution:
Close the IP filter pack
# Service Iptables Stop

Deploying Tomcat in Linux

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.