Fedora Linux Setup and Deployment __linux

Source: Internet
Author: User

1. First to download Tomcat on the official Apache website, my version is apache-tomcat-6.0.33.tar.gz

2. Extract the Tomcat package and move it to the/usr/local/directory and rename it to the Tomcat6 directory:

    TAR-XVZF apache-tomcat-6.0.33.tar.gz
    MV Apache-tomcat-6.0.33/usr/local/tomcat6

3. Set environment variables, use vim to edit/etc/profile files, add environment variables:

Open and edit the environment variable file:

    Vim/etc/profile

Add the following variable at the end of the/etc/profile file:

    Export java_home=/usr/java/jdk1.6.0_23
    export classpath= $CLASSPATH: $JAVA _home/lib: $JAVA _home/jre/lib:$ Catalina_base/lib
    export catalina_base=/usr/local/tomcat6
    export CATALINA_HOME=/USR/LOCAL/TOMCAT6
    Export path= $PATH: $JAVA _home/bin: $JAVA _home/jre/bin: $CATALINA _base/bin

Save Exit (Wq) and make the settings that you just made effective immediately:

    Source/etc/profile

4. Set up the Tomcat port, because the tomcat port may already be occupied, especially on the development of the machine may be deployed a number of Tomcat, or a different version, or different developers in use.

My Tomcat's 4 ports are:

    8883, 8885, 8888, 8889.

5. Configure Tomcat to use LOG4J log:

First to the official Apache website download log4j class Library log4j*.tar.gz, decompression get Log4j*.jar:

    Tar-xvzf log4j*.tar.gz

Then go to the Apache website to find the Tomcat download address, in Tomcat's FTP file directory will have the Extras directory, Enter this directory to download the Tomcat-juli.jar and Tomcat-juli-adapters.jar libraries corresponding to our Tomcat version, and edit our own log4j.properties configuration file. As for how to write this file, you can refer to the realization of the Internet. .

Next, the process of configuring log4j, copy the Tomcat-juli.jar to the $catalina_base/bin/directory, overwriting the original file:

    CP tomcat-juli.jar/usr/local/tomcat6/bin/(or CP Tomcat-juli.jar $CATALINA _base/bin/)

The following operations with similar directories can also use $catalina_base as a tomcat path

Finally, copy the Tomcat-juli-adapters.jar,log4j*.jar, log4j.properties files to the $catalina_base/lib/directory:

    CP tomcat-juli-adpaters.jar/usr/local/tomcat6/lib/CP
    log4j*.jar/usr/local/tomcat6/lib/
    CP log4j.properties/usr/local/tomcat6/lib/
Of course, according to the official website instructions also need to delete the $catalina_base/conf/logging.properties file:
    Rm-f/usr/local/tomcat6/conf/logging.properties
6. I wrote a tomcat startup script Tomcat6, shortcoming:
    #!/bin/bash
    echo "There is no copyright, if the same, pure coincidence." ";
    Echo Enter TOMCAT command: (Start: S/S | Stop: x/x | Restart: r/r | Exit: *) ";

    #定义tomcat所在目录
    tomcat=/usr/local/tomcat6/bin

    #从命令行读取控制命令
    read cmd;
    Case $cmd in
	    ' s ' | ' S ')
		    echo "Start tomcat!";
		    ${tomcat}/startup.sh;;;
	    ' X ' | ' X ')
		    echo "closes tomcat!";
		    ${tomcat}/shutdown.sh;;;
	    ' R ' | ' R ')
		    echo "reboot tomcat!";
		    ${tomcat}/shutdown.sh;
		    ${tomcat}/startup.sh;;;
	    *
		    echo "Invalid command, program exit";
	    	    Exit 0
    ;;; Esac

To modify the shell script file as an executable:

    chmod +x tomcat6.sh

7. Start Tomcat:

    ./tomcat6.sh

Follow the instructions to enter-s to start successfully.

8. Deploy our Web applications:

Open Tomcat:

    Http://localhost:8888/manager.html

May start also need to configure our own Tomcat-user.xml file, follow the instructions on the page to do it.

    Vim/usr/local/tomcat6/conf/tomcat-user.xml

Add the following lines of code at the end of the file:

    <role rolename= "Manager-gui"/> <user username= "Tomcat" password= "Tomcat" roles= "Manager-gui"/>
    

Save Exit (Wq), re-enter the URL above to enter the Web application Deployment page, find the Deployment section, and click to browse to find our *.war project files stored in the directory. I have *.war file copy to the webapps/directory under the Tomcat directory, So it's OK to locate the file, then click Deploy deployment, and then we can see the results of the deployment at the top of the page, and we can see the Web apps we deployed in the table.

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.