Linux Tomcat JDK Installation

Source: Internet
Author: User
Tags tomcat server

  1. Installing the JDK
    # Yum Search Java | Grep-i--color JDK
    Yum Install JAVA-1.7.0-OPENJDK Java-1.7.0-openjdk-devel
  2. Setting environment variables

    Vi/etc/profile

    Add to:

    Java_home=/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.71.x86_64

    Jre_home=/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.71.x86_64/jre

    Path= $PATH: $JAVA _home/bin: $JRE _home/bin

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

    Export Java_home jre_home PATH CLASSPATH

  3. Test JDK

    #vi Hello.java

    Public class Hello {public static void main (String args []) {System.out.println ("Hello world! " );}}
    Java Code

    # Javac Hello.java

    # java Hello

  4. Installing Tomcat

    Open firewall 8080 port

    # cd/tmp

    # wget http://www.us.apache.org/dist/tomcat/tomcat-7/v7.0.56/bin/apache-tomcat-7.0.56.tar.gz

    # tar Xzf apache-tomcat-7.0.56.tar.gz

    # MV APACHE-TOMCAT-7.0.56/USR/LOCAL/TOMCAT7

    # CD/USR/LOCAL/TOMCAT7

    #./bin/startup.sh

    Modify Conf/tomcat-users.xml file under Tomcat path, add login account

    Note Where the file is added

    <!--User Manager can access only manager section--

    <role rolename= "Manager-gui"/>

    <user username= "manager" password= "_secret_password_" roles= "Manager-gui"/>

    <!--user admin can access Manager and Admin section both--

    <role rolename= "Admin-gui"/>

    <user username= "admin" password= "_secret_password_" roles= "Manager-gui,admin-gui"/>

    Apache is installed by default

    The Apache default directory is:/var/www/html

    The Tomcat program default directory is:/usr/local/tomcat7/webapps

  5. Automatically start Tomcat

    Add the Tomcat file to the/etc/init.d/file and add the Execute permission.

    #!/bin/bash# chkconfig:234  -  the# Description:tomcat Server basic Start/shutdown script# processname:tomcatjava_home=/usr/java/jdk1.7. 0_60export Java_hometomcat_home=/usr/local/tomcat/Binstart_tomcat=/usr/local/tomcat/bin/startup.SHStop_tomcat=/usr/local/tomcat/bin/shutdown.SHstart () {Echo-N"starting Tomcat:"CD $TOMCAT _home${start_tomcat}Echo "Done ."}stop () {Echo-N"shutting down Tomcat:"CD $TOMCAT _home${stop_tomcat}Echo "Done ."} Case " $" inchstart) Start; stop) stop;; Restart) StopSleep Tenstart;;*)Echo "Usage: $ {Start|stop|restart}"EsacExit0
    Tomcat

    CHOMD +r Tomcat

    Add Boot Boot

    Chkconfig--add Tomcat

Linux Tomcat JDK Installation

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.