Java+tomcat+apache installation integration, start/shutdown, add boot start service

Source: Internet
Author: User

Installing java1.8

Updating the source package #yum Update server

#rpm-qa |grep-e ' ^open[jre|jdk]|j[re|dk] ' search for any version of installed JDK components

Java-1.8.0-openjdk-headless-1.8.0.60-2.b27.el7_1.x86_64

Pygobject2-2.28.6-11.el7.x86_64

Pygobject3-base-3.8.2-6.el7.x86_64

Java-1.8.0-openjdk-1.8.0.60-2.b27.el7_1.x86_64

Openjpeg-libs-1.5.1-10.el7.x86_64

Gobject-introspection-1.36.0-4.el7.x86_64

#java-version to view installed Java versions

#yum Remove JAVA-1.7.0-OPENJDK version of Java prior to uninstallation


Yum installation java1.8

# Yum Search JDK

......

JAVA-1.6.0-OPENJDK.X86_64:OPENJDK Runtime Environment

JAVA-1.6.0-OPENJDK-DEMO.X86_64:OPENJDK Demos

JAVA-1.6.0-OPENJDK-DEVEL.X86_64:OPENJDK Development environment

JAVA-1.6.0-OPENJDK-JAVADOC.X86_64:OPENJDK API Documentation

JAVA-1.6.0-OPENJDK-SRC.X86_64:OPENJDK Source Bundle

JAVA-1.7.0-OPENJDK.X86_64:OPENJDK Runtime Environment

JAVA-1.7.0-OPENJDK-ACCESSIBILITY.X86_64:OPENJDK Accessibility Connector

JAVA-1.7.0-OPENJDK-DEMO.X86_64:OPENJDK Demos

JAVA-1.7.0-OPENJDK-DEVEL.X86_64:OPENJDK Development environment

Java-1.7.0-openjdk-headless.x86_64:the OPENJDK Runtime environment without audio and video support

JAVA-1.7.0-OPENJDK-JAVADOC.NOARCH:OPENJDK API Documentation

JAVA-1.7.0-OPENJDK-SRC.X86_64:OPENJDK Source Bundle

JAVA-1.8.0-OPENJDK.X86_64:OPENJDK Runtime Environment

JAVA-1.8.0-OPENJDK-ACCESSIBILITY.X86_64:OPENJDK Accessibility Connector

JAVA-1.8.0-OPENJDK-DEMO.X86_64:OPENJDK Demos

JAVA-1.8.0-OPENJDK-DEVEL.X86_64:OPENJDK Development environment

JAVA-1.8.0-OPENJDK-HEADLESS.X86_64:OPENJDK Runtime Environment

JAVA-1.8.0-OPENJDK-JAVADOC.NOARCH:OPENJDK API Documentation

JAVA-1.8.0-OPENJDK-SRC.X86_64:OPENJDK Source Bundle


#yum-y Install Java-1.8.0-openjdk


RPM Source Package Installation:

#wget http://download.oracle.com/otn-pub/java/jdk/8u60-b27/jdk-8u60-linux-x64.rpm? authparam=1443602484_eec243d56fc3dd67d4f7b8a519fd7495

#rpm-IVH XXX


Compile and install:

#wget http://download.oracle.com/otn-pub/java/jdk/8u60-b27/jdk-8u60-linux-x64.tar.gz? authparam=1443602555_3d37647b877dfd6a5fbdcbc561021958

#tar ZXVF xxx-c/root/

#cd/root/xx

#cp-RP jre1.7.-_05/usr/local

#vi/etc/profile Configuring the Global Environment

Java_home=/usr/local/xxx

Classpath= $CLASSPATH: $JAVA _home/lib

Path= $JAVA _home/bin: $PATH


Test if Java is installed successfully

#chown-R root.root/usr/local/xxx/

#java-version


If you run Java error:

Error:/usr/lib/libjvm.so:cannot restore segment prot after Reloc:permission denied.
Use the command:
Chcon-t textrel_shlib_t/usr/lib/libjvm.so

is caused by SELinux.

#setenforce 0


Second, installation TOMCAT7

#wget http://apache.mirror.digitalpacific.com.au/tomcat/tomcat-7/v7.0.64/bin/apache-tomcat-7.0.64.tar.gz

#tar zxvf xxx After decompression is a binary file, no need to install. Move the directory directly to the/usr/local directory

#mv Xxx/usr/local/tomcat

#vim/usr/local/tomcat/bin/catalisna.sh setting environment variables in the Tomcat startup script

JAVA_HOME=/USR/JAVA/JDK1.8.0XX make IT support Java, add this line

#vim/etc/profile

catalina_home=/usr/local/tomcat/

Path= $JAVA _home/bin:/usr/local/tomcat/bin/: $PATH Setting environment variables

Exits the current shell, and the configuration takes effect after re-entry

Or

#. /etc/profile make the new environment variable effective


Manually start/close/restart Tomcat

#/usr/local/tomcat/bin/catalina.sh

#netstat-LNP |grep 80 discovers 80 port opening, that is, Tomcat boot success

#/usr/local/tomcat/bin/catalina.sh Stop/restart

#/usr/local/tomcat/bin/shutdown.sh can also close Tomcat


Setting up the Systemctl boot service

#vim/lib/systemd/system/tomcat.service

[Unit]

Description=tomcat

After=network.target


[Service]

Type=forking

execstart=/usr/local/tomcat/bin/catalina.sh start

execreload=/usr/local/tomcat/bin/catalina.sh restart

execstop=/usr/local/tomcat/bin/catalina.sh stop

Privatetmp=true

[Install]

Wantedby=multi-user.target


#systemctl enable Tomcat.service link to systemctl boot-up service

#systemctl Start/stop/restart Tomcat.service


Iii. Integration of Tomcat+apache

Three ways of Integration:

JK Way

Http_proxy Way

Ajp_proxy Way


Modules required for Http_proxy mode:

Mod_proxy.so and Mod_prxy_http.so

The default mod_proxy.so is already installed, just install the mod_proxy_http.so module

#ls/usr/lib64/httpd/modules/mod_proxy.http.so

#ls/usr/lib64/httpd/modules/mod_proxy.so


Add the module to the httpd.conf configuration file

#vim/etc/httpd/conf/httpd.conf

LoadModule proxy_http_module modules/mod_proxy_http.so

#service httpd restart Restart Apache Service


Test:

Browser input: Server IP



Java+tomcat+apache installation integration, start/shutdown, add boot start service

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.