About Tomcat
Tomcat is a core project of the Apache Software Foundation (Apache Software Foundation) Jakarta Project, developed by Apache, Sun, and other companies and individuals. Tomcat server is a free open source Web application server, belongs to the lightweight application server, in small and medium-sized systems and concurrent access users are not widely used, is the first choice to develop and debug JSP programs. Like Tomcat and Nginx, Apache (httpd), lighttpd and other Web servers, with the ability to handle HTML pages, it is also a servlet and JSP container, the standalone servlet container is the default mode of Tomcat. However, Tomcat is less capable of handling static HTML than Nginx/apache servers. Currently, the latest version of Tomcat is 9.0. Java containers also have resin, weblogic, and so on.
JDK Introduction
The JDK is the Java language Software Development Toolkit for Java applications on mobile devices and embedded devices. The JDK is the core of the entire Java development, which contains the Java Runtime Environment (Jvm+java System class Library) and Java tools.
The DK contains a batch of components for Java development, including:
Javac: Compiler that compiles the source code with the suffix. Java to a byte code with the suffix ". Class"
Java: Run the tool, run the. Class byte code
Jar: Package tool to package related class files into one file
Javadoc: Document generator, extracting documents from source notes, annotations required to match specifications
JDB Debugger: Debugging Tools
JPS: Shows the status of the process running by the current Java program
JAVAP: Anti-compiler program
Appletviewer: Tools to run and debug applets without using a browser
Javah: Generates C header files and C source files from Java classes. These files provide a connection glue that enables Java and C code to interact.
Javaws: Run the JNLP program
Extcheck: A tool for detecting jar package conflicts
Apt: annotation processing tool
Jhat:java Heap Analysis Tool
Jstack: Stack Tracker
JSTAT:JVM Detection Statistics Tool
Jstatd:jstat Daemon Process
Jinfo: Get Java program configuration information that is running or crashing
Jmap: Get Java Process Memory mapping information
Idlj:idl-to-java compiler. Converting the IDL language to a Java file
Policytool: A GUI's policy file creation and management tool
Jrunscript: Command line script run
Prepare the Environment
[Email protected] ~]# cat/etc/centos-release
CentOS Linux release 7.4.1708 (Core)
[Email protected] ~]# uname-r
3.10.0-693.el7.x86_64
[Email protected] ~]# Getenforce
Disabled
[Email protected] ~]# Systemctl stop Firewalld.service
[Email protected] ~]# cd/opt/
[Email protected] opt]# wget-c http://download.oracle.com/otn-pub/java/jdk/10.0.2+13/ 19aef61b38124481863b1413dce1855f/jdk-10.0.2_linux-x64_bin.tar.gz
[Email protected] opt]# tar XF jdk-10.0.2_linux-x64_bin.tar.gz-c/usr/local/
[Email protected] opt]# ln-s/usr/local/jdk-10.0.2//usr/local/jdk
[Email protected] opt]# java-version
Java Version "1.8.0_60"
Java (TM) SE Runtime Environment (build 1.8.0_60-b27)
Java HotSpot (TM) 64-bit Server VM (build 25.60-b23, Mixed mode)
Download Install Tomcat
[Email protected] opt]# wget-c https://archive.apache.org/dist/tomcat/tomcat-8/v8.0.50/bin/apache-tomcat-8.0.50.tar.gz
[Email protected] opt]# tar XF apache-tomcat-8.0.50.tar.gz-c/usr/local/
[Email protected] opt]# ln-s/usr/local/apache-tomcat-8.0.50//usr/local/tomcat
[Email protected] opt]#/usr/local/tomcat/bin/version.sh
Using catalina_base:/usr/local/tomcat
Using Catalina_home:/usr/local/tomcat
Using Catalina_tmpdir:/usr/local/tomcat/temp
Using Jre_home:/USR/LOCAL/JDK
Using CLASSPATH:/usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
note:picked up jdk_java_options:–add-opens=java.base/java.lang=all-unnamed–add-opens=java.rmi/sun.rmi.transport= All-unnamed
Server Version:apache tomcat/8.0.50
Server Built:feb 7 2018 20:06:05 UTC
Server number:8.0.50.0
OS Name:linux
OS version:3.10.0-693.el7.x86_64
Architecture:amd64
JVM version:10.0.2+13
JVM Vendor: "Oracle Corporation"
Configuring related environment variable information
[[email protected] opt]# cat >>/etc/profile<< ' EOF '
Export JAVA_HOME=/USR/LOCAL/JDK
Export path= $JAVA _home/bin: $JAVA _home/jre/bin: $PATH
Export classpath=.: $JAVA _home/lib: $JAVA _home/jre/lib: $JAVA _home/lib/tools.jar
Export Tomcat_home=/usr/local/tomcat
Eof
[Email protected] opt]# Source/etc/profile
Set JDK program directory permissions information
[Email protected] opt]# chown-r root.root/usr/local
Check that all environment variable information is configured successfully
[Email protected] opt]# env|egrep-i "java_home| path| classpath| Tomcat_home "
Tomcat_home=/usr/local/tomcat
path=/usr/local/jdk/bin:/usr/local/jdk/jre/bin:/application/jdk/bin:/application/jdk/jre/bin:/application/jdk/ Bin:/application/jdk/jre/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
Java_home=/usr/local/jdk
classpath=.:/ Usr/local/jdk/lib:/usr/local/jdk/jre/lib:/usr/local/jdk/lib/tools.jar
Start the Tomcat service program
[Email protected] opt]#/usr/local/tomcat/bin/startup.sh
[Email protected] opt]# netstat-lntup|grep java
TCP6 0 0::: 8080::: LISTEN 1781/java
TCP6 0 0 127.0.0.1:8005::: LISTEN 1781/java
TCP6 0 0::: 8009:::* LISTEN 1781/java
Web Testing for Access
http://10.0.0.202:8080/
Install the database program and configure it
[Email protected] opt]# yum-y install Mariadb-server
[Email protected] opt]# systemctl start Mariadb.service
[Email protected] opt]# Systemctl enable Mariadb.service
[[email protected] opt]# MySQL
MariaDB [(None)]> CREATE database jpress DEFAULT CHARACTER SET UTF8;
Query OK, 1 row Affected (0.00 sec)
MariaDB [(None)]> grant all on jpress.* to [email protected] ' localhost ' identified by ' 123456 ';
Query OK, 0 rows Affected (0.00 sec)
MariaDB [(None)]> flush privileges;
Query OK, 0 rows Affected (0.00 sec)
MariaDB [(None)]> exit
Bye
Upload the Open source code package to the Tomcat site Directory
[Email protected] ~]# MV jpress-web-newest.war/usr/local/tomcat/webapps/
[Email protected] ~]#/usr/local/tomcat/bin/shutdown.sh
[Email protected] ~]#/usr/local/tomcat/bin/startup.sh
[Email protected] ~]# ll/usr/local/tomcat/webapps/
Total 20316
Drwxr-xr-x root root 4096 Sep 1 00:10 docs
Drwxr-xr-x 6 root root 00:10 Sep 1 examples
Drwxr-xr-x 5 root root 00:10 Sep 1 Host-manager
Drwxr-xr-x 7 root root 102 Sep 1 01:09 jpress-web-newest
-rw-r–r–1 root root 20797013 Mar 3 Jpress-web-newest.war
Drwxr-xr-x 5 root root 103 Sep 1 00:10 Manager
Drwxr-xr-x 3 root root 306 Sep 1 00:10 Root
Browser Access jpress Web Site Wizard Interface
Http://10.0.0.202:8080/jpress-web-newest/install
[Email protected] ~]#/usr/local/tomcat/bin/shutdown.sh
[Email protected] ~]#/usr/local/tomcat/bin/startup.sh
Http://10.0.0.202:8080/jpress-web-newest/admin/login
Tomcat build jpress Web site