Install JDK and tomcat on centos

Source: Internet
Author: User

Recently, the company's internal servers were built using the lamp environment, but Tomcat access was required, while I used the yum installation when setting up the environment, if you are too troublesome, you can go to the yum installation of Apache + PHP + MySQL + Tomcat article. Of course, I compile and install Tomcat after the yum lamp environment, which is equivalent to letting Tomcat run separately. let's take a look at the tutorial.

System: centos 5.5
Software: apache-tomcat-7.0.26.tar.gz jdk-7u3-linux-i586.rpm required
I. preparations:

(1) install centos with minimal installation.

(2) introduce the 163 source.

Wget-P/etc/yum. Repos. d/http://mirrors.163.com/.help/CentOS5-Base-163.repo
(3) install common compilers and tools using yum

Yum-y install GCC gcc-C ++ Autoconf libjpeg-devel libpng-devel FreeType-devel libxml2 libxml2-devel zlib-devel glibc-devel glib2 glib2-devel Bzip2 bzip2-devel ncurses- devel curl-devel Vim ntsysv

2. Go to the official website to download JDK on the Linux platform.

Address: http://www.oracle.com/technetwork/java/javase/downloads/jdk-7u3-download-1501626.html

3. Download tomcat.

Address: http://labs.mop.com/apache-mirror/tomcat/tomcat-7/v7.0.26/bin/apache-tomcat-7.0.26.tar.gz

4. Install software

(1) install JDK: # rpm-IVH jdk-7u3-linux-i586.rpm

Install JDK in the/usr/Java directory.
(2) unzip and install Tomcat: # tar zxf apache-tomcat-7.0.26.tar.gz

5. Configure environment variables:
# Vi/etc/profile

(1) Add at the end of the file

Export java_home =/usr/Java/jdk1.7.0 _ 03
Export jre_home =/usr/Java/jdk1.7.0 _ 03/JRE
Export classpath =.: $ java_home/lib/dt. jar: $ java_home/lib/tools. Jar
Export maid =/usr/local/Apache-Tomcat-7.0.26
Export catalina_home =/usr/local/Apache-Tomcat-7.0.26
Export Path = $ path:/sbin:/bin:/usr/sbin:/usr/bin:/usr/x11r6/bin: $ java_home/bin
(2) Use the following command to make the configuration take effect and view the JDK version.

# Source/etc/profile
# Java-version


6. Configure Tomcat

(1) Add tomcat to start automatically

# Echo "/usr/local/Apache-Tomcat-7.0.26/bin/startup. Sh">/etc/rc. Local

(2) Enable the firewall to open Tomcat ports

Iptables-A RH-Firewall-1-INPUT-M state -- state new-m tcp-p tcp -- dport 8080-J accept
Service iptables save
Service iptables restart

VII. Test

# Cd/usr/local/Apache-Tomcat-7.0.26/bin/
# Chmod 777 *.*
#./Startup. Sh

Open the browser: http: // ip: 8080

Install JDK and tomcat on centos

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.