1. Install JDK
Go to java official website to download the latest JDK, java se downloads
Unzip, Tar-ZXVF JDK-7U45-linux-I586.TAR.GZ, store the unbuttonous JDK1.7.0_45 to the directory you need to place, I place it in/usr/share/directory
Configuration environment variable
1.java_home environment variable
Role: It points to the installation directory of JDK. ECPLISE/NetBeans/Tomcat and other software is to find and use the installed JDK by searching for Java_home variables to find and use the installed JDK
Configuration method:
echo java_home =/usr/share/jdk1.7.0_45 >>/.bashrc source .bashrc
2. PATH environment variable
Function: It is the order of the order to search for the path. When the command is executed under the shell, it will find the corresponding command program in the path specified by the PATH variable. We need to increase the bin directory in the JDK installation directory to the existing PATH variable
Configuration method:
vim .bashrc #Add Java's path path export java_home =/usr/share/jdk1.7.0_45 export path = $ java_home/bin: $ Path Source .bashrc
Notice:
You need to add the newly added JDK BIN directory to the forefront of $ PATH, so that when multiple JDK versions are installed in the system, the program will prioritize the JDK version ranked at the forefront
verify:
3.classPath environment variable
Function: Specify a class search path. To use the well -written class, of course, you can find them. JVM finds a class through classpath. We need to set the dt.jar, Tools.jar in the lib sub -directory in the JDK installation directory to the classpath. Of course, the current directory "." "You must also be added to this variable
Configuration:
vim .bashrc Export classpath =.: $ java_home/lib/dt.jar: $ java_home/lib/tools.jar source .bashrc.
Tip: Do not use Echo $ classpath, because Linux will automatically use /usr/share/jdk1.7.0_45 to replace $ java_home, but this variable should be variable, you should understand what I mean, that is, the programming needs to reject the programming that needs to be rejected in the programming that needs to be rejected in the programming that needs to be rejected in the programming that needs to be rejected in the programming that you need to refuse in the programming. Hardcod
verify
View java version
Second, install Tomcat
1. First download the Tomcat6.0 series files from Apache's official website, http://www.apache.org/tomcat/ Here There is a corresponding instructions on it, the Linux version of Tomcat is a file that needs to compile the source code. If the downloaded file is: Apache-Tomcat-6.0.30.zip
2. Transfer the downloaded files to the Linux through FTP. Here I recommend the remote connection tool SSH, and there are many Linux remote connection tools.
3、解压apache-tomcat-6.0.30.zip,命令为:unzip apache-tomcat-6.0.30.zip得到apache-tomcat-6.0.30这个目录,将目录拷贝到/opt/,然后为了方便改名为/Opt/Tomcat.
4. Modify the environment variable, and place the variable configuration behind the previous configuration of the JDK environment variable, as follows:
Modify the Profile file under the directory/ETC, and use the command as:
VI /ETC /Profile
The modification is as follows:
export catalina_home =/opt/tomcatexport classpath =.: $ java_home/lib: $ catalina_home/libexport path = $ Path: $ catalina_home/bin
After the configuration is complete
You can view environment configuration through Echo $ ClassPath
5. Start the TOMCAT service to switch the directory to Opt/Tomcat/bin to execute the sh catalina.sh. The prompt information is as follows:
The Basedir Environment variable is not defined Correctlythis Environment variable is needed to run this program
After the configuration is completed, this kind of error prompt will be reported. The prompt indicates that the related authority is not executed in the correlation .sh suffix files in the BIN directory. Use the command chmod +x *.sh to give all the .sh files to execute permissions.
Then execute sh catalina.sh or sh startup.sh, then the following information indicates the configuration OK:
USING CATALINA_BASE: /OPT /TOMCATUSING CATALINA_HOME: /OPT /TOMCatusing Catalina_tmpdir: /OPT /Tempusing Jre_home: /usr/jdk1.6.0_23using classpath: /O. PT/TOMCAT/BIN/BOOTSTRAP.JAR
6. View Tomcat's service port 8080
Command: NetStat -tama | GREP 8080, prompts normal, use Tenlet IP 8080 from the Windows client to see what the situation is. As a result, it is prompted that the port is not opened.
Find/ETC/SYSCONFIG/, vi iptables adds the configuration of the open 8080 port in the firewall configuration file as follows:
-A RH -FIREWALL -Input -m State -State New -M TCP -P TCP -DPORT 8080 -j Accept
Another method is to turn off the firewall, the command is: service iptables stop.
7. Visit Tomcat Homepage on the client
http: // localhost: 8080/If the Tomcat homepage is displayed normally, the configuration is OK.
8. Deploy a web project to upload files as SSH2.war to Opt/Tomcat/WebApps directory, and then restart tomcat, as follows: ./ Catalina.sh Run, deploy ssh2.war and start Tomcat Tomcat
Enter http: // localhost: 8080/ssh2 to display the login page indicating that the project deployment is successful.