Centos installation of tomcat and deployment of JavaWeb Projects

Source: Internet
Author: User
Tomcat is a core project in the Jakarta project of the Apache Software Foundation (ApacheSoftwareFoundation). It is developed by Apache, Sun, and other companies and individuals. With Sun's participation and support, the latest Servlet and JSP specifications can always be reflected in Tomcat. Tomcat 5 supports the latest Servlet2.4 and JSP2. 1. Preparations

A. Download the tomcat linux package at: http://tomcat.apache.org/download-80.cgi. the download method is 8.0.

B. Because tomcat installation depends on Java jdk, we need to determine whether jdk B .1 is installed in linux (Xshell) to connect to B .2 in Linux. Command: Java-version, if the jdk version is displayed, it indicates that it has been installed, if not displayed, it indicates that it is not installed, if not installed, please refer to the following address for installation: http://www.cnblogs.com/hanyinglong/p/5025635.html,: c. the required software and system are as follows: Butler. 2. Install Tomcat8.0 in Linux

A. After the above preparations, we now have an environment for installation and release. If not, please check the installation on your own.

B. then run the command in Xshell to jump to the local folder of the Creator: kencery B .1 cd usr/local/mkdir kencery cd kencery/c. use Xftp to copy tomcat to the kencery Folder: d. decompress the uploaded tomcat 8.0, decompress it, and rename it tomcat: d.1 tar-zxv-f apache-tomcat-8.0.29.tar.gz d.2 mv apache-tomcat-8.0.29 tomcat d.3 cd tomcat e. after parsing, you can start Tomcat and check whether the installation is successful. The command is as follows:/usr/local/kencery/tomcat/bin/startup. sh indicates that the startup is successful. In this case, we can use http://ip:8080 Access. If the Tomcat homepage is displayed, no operation is required. If the page cannot be displayed, open the firewall port 8080 in Linux. F. to open port 8080 in the firewall under Linux, run the following command: f.1 vim/etc/sysconfig/iptables f.2, press the keyboard (I) to enter the editing mode, and write it to port 8080 of development ,: f.3 after writing, press the keyboard (ESC) button to exit, then press (: wq) to save and close Vim. G. Then restart the firewall. Run the following command: service iptables restart h. Then enter http://ip:8080 If you see the tomcat system interface, it indicates that the installation is successful and you can proceed to the next step. I. Run the following command to stop Tomcat:/usr/local/tomcat/bin/shutdown. sh3.Linux to set tomcat server startup and shutdown.

A. as shown in figure 2, we have completed the installation of tomcat, and then we can deploy the project, but there is a problem here, that is to say, we need to connect to the path and execute the command every time we restart the Linux system, so we can set it as a service to implement this function.

B. run the command: vim/etc/rc. d/init. d/tomcat: Create a script file, write the following code into the file, save and exit Linux c. add permissions to the file so that the script file can be executed. The command is chmod 755/etc/rc. d/init. d/tomcat d. add it to the service and run the command chkconfig -- add/etc/rc. d/init. d/tomcat e. then add the following configuration file to catalina in tomcat. command: vim/usr/local/kencery/tomcat/bin/catalina. sh export JAVA_HOME =/usr/local/kencery/javajdk # The installation path of javajdk. Run the echo $ JAVA_HOME command to read export CATALINA_HOME =/usr/local/kencery/tomcat e. Xport CATALINA_BASE =/usr/local/kencery/tomcat export CATALINA_TMPDIR =/usr/local/kencery/tomcat/temp f. if all the above operations are successful and no error is reported, the configuration is complete. You can enter the Command service tomcat start and service tomcat stop for verification (Please experiment on your own ). 4. set tomcat startup in Linux.. through step 3, we can easily set tomcat startup and shutdown, but there is a problem here, that is, when the server is shut down and restarted, the service cannot be started with the startup of the computer, so we can set the tomcat service to start at startup. B. open the linux settings to enable the startup, and write the following configuration file to the end of the file. The command is vim/etc/rc. d/rc. local export JAVA_HOME =/usr/local/kencery/javajdk export CLASSPATH =.: $ JAVA_HOME/jre/lib/rt. jar: $ JAVA_HOME/lib/dt. jar: $ JAVA_HOME/lib/tools. jar export PATH = $ PATH: $ JAVA_HOME/bin export CATALINA_HOME =/usr/local/kencery/tomcat/# tomcat self-start/usr/local/kencery/tomcat/bin/startup. c. tomcat depends on the Java jdk, so the jdk is also imported synchronously when it is set. D. After completing the above steps, we can shut down centos and restart it for check. 5. Set the username and password for tomcat to log on. a. After tomcat is installed, access http://ip:8080 That is to say, you can see the tomcat publishing website. At this time, you need to manage our publishing website and log on to tomcat. How to set the login name and password in centos. B. the conf file under the tomcat installation package contains a tomcat-user.xml file, modify this file, the command is: vim tomcat-users.xml c. write the following configuration file at the end of the xml configuration file to save the file and exit.

    
    
    

D. there will be a problem here, because there is a comment in the tomcat-users.xml of the user settings information, cancel the comment, with the user name and password provided by the file to access, there will be a 403 error, why? This is because we do not specify the permissions owned by users. For example, we want to access the graphical management application function in tomcat, that is, the Manager App, you need to specify the manager-gui permission. To access the host manager, you must specify the admin-gui permission, as shown in c.

E. after configuring the username and password, you need to restart tomcat. The command is as follows: service tomcat stop service tomcat start f. after the service is restarted, check whether the logon is successful. If you log on to the system, the logon is successful. 6. Use MyEclipse to package Java Web projects

A. After all the above work is completed, we need a simple project to package and release. How can we package the project in MyEclipse?

B. create a Java Web project: c. right-click the project, select Export, select the JavaEE folder, select WAR file (MyEclipse), click Next>, select the address for storing the package, and click Finish to complete packaging, after packaging, you can check whether the package is successful. D. How to Solve IDE crash when selecting WAR File (MyEclipse) and clicking Next> In MyEclipse10.7 package. D.1 this error may be caused by the fact that the attack was not completely cracked. Therefore, you need to perform the following steps to download the file com. genuitec. eclipse. export. wizard_9.0.0.me201211011550.jar, for: http://files.cnblogs.com/files/hanyinglong/java.zip d.3 find MyEclipse installation environment address, my installation environment is: D: \ Program Files \ MyEclipse \ Common \ plugins, will download the idea file end, restart myeclipse10, disable it, and change jar back. jar is in the extension state, and you can restart it ). D.4 has been tested, and there are no problems, so it can be implemented perfectly. If you encounter it, you can solve it in this way. 7. Publish the Java Web project to Tomcat8.0 and access the display

A. After all the above work is completed, we can release the packaged JavaWeb program to tomcat.

B. the default directory for tomcat web project publishing is webapps c. upload the exported war package directly to the webapps root directory using Xftp. As tomcat starts, the war package can be automatically parsed. D. then, call the path to check whether the installation is successful. This indicates that the installation is successful and all the configurations are complete. In the implementation of the configuration, I also encountered many problems, it has been written in the article. If you encounter it, you can refer to the solution.
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.