1. Download jdk and tomcat. jdk: http://www.oracle.com/technetwork/java/javase/downloads/ jdk7-downloads-1880260.html tomcat: http://tomcat.apache.org/download-70.cgi 2.JDK installation and Configuration . (1) JDK installation RPM package: # RPM-IVH jdk-7u55-linux-x64.rpm & nbsp TAR.GZ Package: Unzip # mkdir/usr/java # cd/usr/java # Tar-zxvf/software/jdk-7u55-linux-x 64.tar.gz Generate links for version upgrade # ln-s jdk1.7.0_55 latest # ln-s Latest default & nbsp (2) Configuring environment variables # vi/etc/profile Export java_home=/usr/java/default export Java_ bin= $JAVA _home/bin Export path= $PATH: $JAVA _home/bin Export classpath=.: $JAVA _home/lib/ Dt.jar: $JAVA _home/lib/tools.jar Export path= $JAVA _home/bin: $JRE _home/bin: $PATH Make configuration effective # source/etc/profile Test jdk. # java-version java Version "1.7.0_55" Java (TM) SE Runtime environm ENT (build 1.7.0_55-b13) Java HotSpot (TM) 64-bit Server VM (build 24.55-b03, mixed mode) 3.tomcat Install Unzip # mkdir/usr/local/tomcat # cd/usr/local/tomcat # TAR-ZXVF/S oftware/apache-tomcat-7.0.54.tar.gz Generate links for version upgrade # ln-s apache-tomcat-7.0.54 server Start tomcat # cd/usr/local/tomcat/server/bin # ./startup.sh Usin G 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:&NBSp Open firewall to enable external access #/sbin/iptables-i input-p TCP--dport 8080-j accept # service Iptables s ave # service iptables restart or directly modify file/etc/sysconfig/iptables. # Vi/etc/sysconfig /iptables -A input-p tcp-m TCP--dport 8080-j accept # service iptables restart In Browser input: http://192.168.16.133:8080 As can be entered in this machine: http://localhost:8080 The page that appears Tomcat indicates the installation was successful. Stop tomcat #/shutdown.sh 4. Configuring Web Admin accounts modifying files conf/ Tomcat-users.xml, add the account password to the <tomcat-users> element, you need to specify the role . # vi/usr/local/tomcat/server/conf/ tomcat-users.xml <tomcat-users> <user name= "admin" password= " Admin "roles=" Admin-gui,manager-gui "/> </tomcat-users> 5. Configuring Web Access Ports can modify the file Server.xml in the Conf directory, modify the connector element (Tomcat's default port is 8080) and need to restart the Tomcat service to take effect.   # vi/usr/local/tomcat/server/conf/server.xml <connector port= "" Protocol= "HTTP/1.1" connectiontimeout= "20000" redirectport= "8443"/> 6. Configuring HTTPS Secure connection (SSL encrypted connection) HTTPS connection requires digital certificate and digital signature (MD5 algorithm) website HTTPS connection first need to apply for digital certificate, configure encryption connector, browser install certificate . use Java tool Keytool generate digital certificate # Keytool-genkey-alias tomcat-keyalg rsa generate file .keystore Note: CN is Host name, this machine can be localhost the file. KeyStore placed in 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 <connector port= "8443" protocol= "http/1.1" sslenabled= "true" maxthreads= "150" Scheme= "https" secure= "true" clientauth= "false" sslprotocol= "TLS" keystorefile= "conf/.keYstore "keystorepass=" 123456 "/> reboot tomcat. Browser input https://localhost:8443 Access and install the certificate. &NBSP;&NBSP;7.TOMCAT directory structure bin //Command script file hosting tomcat conf // Various configuration files for the Tomcat server, mostly server.xml lib //Storage 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's working directory 8.web app directory structure webapp & nbsp --Web application directory |---html, jsp, CSS, JS files, etc. --these files are typically located in the Web application root directory, Recorded files can be accessed directly from . |---web-inf directory --java classes, jar packages, WEB configuration files exist this Directory, the outside world cannot be accessed directly, the Web server is responsible for calling . |---Classes directory --Java class &nbs P |---lib catalogue &nbsP --Java classes required to run the jar package |---web. xml file --web App configuration file 9. Configuration of the virtual host Specify the virtual hostname, modify the Conf/server.xml, add
Installation and configuration of Tomcat on Linux