First, install the JDK on Linux
Download: Login URL: http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html Select the corresponding JDK version to download. (Can be shared to Linux via FTP folder after Windows download is complete)
Login Linux:su root to get root user rights, the current working directory is unchanged (requires root password) or sudo-i does not require root password to switch directly to root (requires the current user password)
Create the Java installation directory in the user directory:
Cd/usr
mkdir Java
Copy the jdk-8u60-linux-x64.tar.gz to the Java directory
cp/mnt/hgfs/linux/jdk-8u60-linux-x64.tar.gz/usr/java/
Unzip the JDK to the current directory
TAR-ZXVF jdk-8u60-linux-x64.tar.gz
Get folder jdk1.8.0_60
Editing the configuration environment, configuring environment variables
Vim/etc/profile
Add the following: Java_home according to the actual directory to java_home=/usr/java/jdk1.8.0_60 classpath= $JAVA _home/lib/path= $PATH: $JAVA _home/bin Export PATH Java_home CLASSPATH
Restart machine or execute command: source/etc/profile
sudo shutdown-r now
View installation Status
Java-version
Java version "1.8.0_60" Java (tm) SE Runtime Environment (build 1.8.0_60-b27) Java HotSpot (tm) Client VM (Build 25.60-b23, Mixed mode)
Ii. deployment of Tomcat on Linux
Tomcat Download: http://tomcat.apache.org/
Tomcat Installation:
Unzip
Mkdir/usr/local/tomcat
Cd/usr/local/tomcat
Tar-zxvf/software/apache-tomcat-7.0.54.tar.gz
Generate links for version upgrades
Ln-s apache-tomcat-7.0.54 Server
Start Tomcat
Cd/usr/local/tomcat/server/bin
./startup.sh
Using catalina_base:/usr/local/tomcat/server using catalina_home:/usr/local/tomcat/server using Catalina_temdir:/ Usr/local/tomcat/server/temp using Jre_home:/usr/java/default using Class_path:/usr/local/tomcat/server/bin/ Bootstrap.jar:/usr/local/tomcat/server/bin/tomcat-juli.jar
Tomcat started.
Test Tomcat:
Open the firewall to allow external access
/sbin/iptables-i input-p TCP--dport 8080-j ACCEPT
Service Iptables Save
Service Iptables Restart or directly modify the file/etc/sysconfig/iptables.
Vi/etc/sysconfig/iptables-a input-p tcp-m TCP--dport 8080-j ACCEPT
Service Iptables Restart
In the browser input: http://192.168.16.133:8080 as can be entered in this machine: http://localhost:8080 appears on the Tomcat page to indicate that the installation was successful.
Stop Tomcat
./shutdown.sh
Configure Web Admin Account
Modify the file Conf/tomcat-users.xml,
Vi/usr/local/tomcat/server/conf/tomcat-users.xml
?
Configuring the Web Access port
You can modify the file Server.xml in the Conf directory, modify the connector element (the default port for Tomcat is 8080) and need to restart the Tomcat service to take effect.
Vi/usr/local/tomcat/server/conf/server.xml
A digital certificate and digital signature (MD5 algorithm) is required for HTTPS connections
Web site HTTPS connection first need to request a digital certificate, configure the encryption connector, browser installation certificate. • Use Java tools Keytool to generate digital certificates
Keytool-genkey-alias Tomcat-keyalg RSA
? Generate files. KeyStore? Note: CN is the host name that can be used localhost to place files. KeyStore into the Conf directory of the Tomcat server
CP. keystore/usr/local/tomcat/server/conf/
• Modify the Conf/server.xml file, modify the encryption connector, add Keystorefile and Keystorepass?
Tomcat's directory structure
bin//Command script file for tomcat conf//store various configuration files for Tomcat server, mostly Server.xml lib//store Tomcat Server support JAR package logs//store log files temp//Store temporary files webapps//web application directory, external access to Web Resources storage directory work//tomcat working directory
Directory structure for Web Apps
WebApp--The directory where the Web application resides? |---html, JSP, CSS, JS files, etc.-these files are generally located in the root directory of the Web application and can be accessed directly from outside the file in the root directory. ? |---web-inf directory-java classes, JAR packages, Web configuration files exist in this directory, the outside world is not directly accessible, the WEB server is responsible for the call. ? |---Classes Directory-java class? |---lib Directory--the jar package required for Java classes to run? |---web. xml file--configuration file
Configuration of the virtual host
Specify the virtual host name, modify Conf/server.xml, add
Third, deploy Java project on Linux
Make a Package (war) on eclipse or idea, right-click on the project/export.../java Ee/war file.
Use FTP to upload the war package directly into Tomcat's WebApps directory.
Start Tomcat.
?
Deploying Java projects on Linux