Installing Tomcat +JDK Environment deployment under Linux

Source: Internet
Author: User
Tags tomcat server

Installing Apache under Linux is simpler, and installing Apache httpd is possible.

But if you want to use Tomcat, it's a little bit more complicated, but if you follow the steps, it's going to be a good fit.

First, before Tomcat installs, you need to install the Java environment, which requires you to download the Java JDK, configure it, and then configure the Tomcat environment (two configurations are the same).


1. Download the Java JDK.

to Oracle Oracle website download (to correspond to the version of the system, there are decompression version and installation version, recommended decompression version), this time I am using the installation version.

After downloading the RPM installation file,

rpm-iv jdk-xxx.rpm for installation.

The default new Java environment will be in the/usr/java directory, and I'll change this directory directly to/usr/jdk+tomcat (because the directory behind Tomcat will also be placed here).


2, now the directory for Java is

/usr/jdk+tomcat/jdk1.8.0_73 (/usr/java/jdk1.8.0_73 before modifying the directory)


3. Create a soft link to facilitate subsequent upgrades (optional)

# ln-s/usr/jdk+tomcat/jdk1.8.0_73//usr/jdk+tomcat/jdk


4, configuring environment variables

In the/etc/profile file, add the following:


java_home=/usr/jdk+tomcat/jdk1.8.0_73

Java_bin=/usr/jdk+tomcat/jdk1.8.0_73/bin

Path= $PATH: $JAVA _bin

Classpath= $JAVA _home/lib/dt.jar: $JAVA _home/lib/tools.jar

Export Java_home java_bin PATH CLASSPATH

Save the exit, and then run the following command:

# Source/etc/profile

See if the Java environment variable is in effect with the following command:

[[email protected] jdk+tomcat] # java-version

Java Version "1.8.0_73"

Java (TM) SE Runtime Environment (build 1.8.0_73-b02)

Java HotSpot (TM) Client VM (build 25.73-b02, Mixed mode)

Indicates that the environment variable is in effect and the test configuration is successful.

-----------------------------------------------

5, download tomcat, configure the environment.

After downloading the Apache website (decompression version), after decompression, the Tomcat directory will be moved to the same directory as the JDK/usr/jdk+tomcat.

Create a soft link to facilitate subsequent upgrades (also optional)

#ln-S/usr/jdk+tomcat/apache-tomcat-7.0.69//usr/jdk+tomcat/tomcat

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/82/ED/wKioL1dlZNeAQ3IoAAAw4QCTQRg894.png "title=" Tomcat.png "alt=" Wkiol1dlzneaq3ioaaaw4qctqrg894.png "/>

6. Configure the catalina.sh file.

Enter the Tomcat/bin directory, modify the catalina.sh file, and add the following line:

catalina_home=/usr/jdk+tomcat/apache-tomcat-7.0.69/

Save exit. (To give execution permission if necessary:#chmod +x *.sh)

7, manually start the Tomcat server (Tomcat does not have a service like httpd, each with a tomcat environment, to manually start the respective server in its own directory).

[[email protected] jdk+tomcat] #/usr/jdk+tomcat/tomcat/bin/catalina.sh Start

Using catalina_base:/usr/jdk+tomcat/apache-tomcat-7.0.69/

Using Catalina_home:/usr/jdk+tomcat/apache-tomcat-7.0.69/

Using Catalina_tmpdir:/usr/jdk+tomcat/apache-tomcat-7.0.69//temp

Using Jre_home:/usr/jdk+tomcat/jdk1.8.0_73

Using CLASSPATH:/usr/jdk+tomcat/apache-tomcat-7.0.69//bin/bootstrap.jar:/usr/jdk+tomcat/apache-tomcat-7.0.69// Bin/tomcat-juli.jar

Tomcat started.

[Email protected] jdk+tomcat]#

Indicates that the server has started successfully.

8. Enter the Tomcat log directory tomcat/logs/to view the Catalina.out file.

[Email protected] logs]# tail catalina.out

June, 8:19:34 AM org.apache.catalina.core.StandardService stopinternal

Info:stopping Service Catalina

June, 8:19:34 AM org.apache.coyote.AbstractProtocol stop

Info:stopping Protocolhandler ["http-bio-8080"]

June, 8:19:34 AM Org.apache.coyote.AbstractProtocol destroy

Info:destroying Protocolhandler ["http-bio-8080"]

June, 8:19:34 AM org.apache.coyote.AbstractProtocol stop

Info:stopping Protocolhandler ["ajp-bio-8009"]

June, 8:19:34 AM Org.apache.coyote.AbstractProtocol destroy

Info:destroying Protocolhandler ["ajp-bio-8009"]

[Email protected] logs]#

9, test server 8080 port is not through, the server firewall shut down or put on 8080 port. Web testing:

650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M02/82/ED/wKioL1dlZ5HhxdliAAEsrCUQp_U938.png-wh_500x0-wm_3 -wmp_4-s_2866022787.png "title=" To-2.png "alt=" Wkiol1dlz5hhxdliaaesrcuqp_u938.png-wh_50 "/>

The test was successful.

Note: The test page that you see above is placed under the Tomcat/webapps directory and is actually configured in the Server.xml file.

1) The WebApps folder is primarily used for Web application deployment, such as you can copy your application packages, such as war files, into that directory, and containers are automatically deployed.

2) The Conf folder is primarily the relevant configuration file for the server where Tomcat is placed.


You can look at the contents of the WebApps directory:

650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M00/82/EE/wKiom1dlabDQPIaVAAAr0tzr7Zo701.png-wh_500x0-wm_3 -wmp_4-s_93959212.png "title=" To3.png "alt=" Wkiom1dlabdqpiavaaar0tzr7zo701.png-wh_50 "/>

You can test other directories in this directory, such as examples:

650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M01/82/EE/wKiom1dlakGyz0CkAABH8Fzg9mE354.png-wh_500x0-wm_3 -wmp_4-s_2709035725.png "style=" Float:none; "title=" Tom4.png "alt=" Wkiom1dlakgyz0ckaabh8fzg9me354.png-wh_50 "/>

650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M00/82/EE/wKiom1dlakHCs_TjAABqf4g6wu4515.png-wh_500x0-wm_3 -wmp_4-s_1188593931.png "style=" Float:none; "title=" Tom5.png "alt=" Wkiom1dlakhcs_tjaabqf4g6wu4515.png-wh_50 "/>

650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M02/82/EE/wKiom1dlapih7ipyAAAlJ0rsN4c397.png-wh_500x0-wm_3 -wmp_4-s_2386532492.png "title=" Tom6.png "alt=" Wkiom1dlapih7ipyaaalj0rsn4c397.png-wh_50 "/>


Installing Tomcat +JDK Environment deployment under 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.