The system environment is: Ubuntu 14.04
One, JDK automatic installation script
JDK automatically installs bash shell scripts, as of today (2014/10/15) Pro-Test available:
sudo su #切换到root权限mkdir/usr/local/JAVACD/usr/local/java#download JDK1.7. thewget--no-check-certificate--no-cookies--header"Cookie:oraclelicense=accept-securebackup-cookie"http//download.oracle.com/otn-pub/java/jdk/7u67-b01/jdk-7u67-linux-x64.tar.gz#extract JDKTar-XVF jdk-7u67-linux-x64.Tar. Gz#set Environmentexport java_home="/usr/local/java/jdk1.7.0_67"if!grep "java_home=/usr/local/java/jdk1.7.0_67"/etc/Environment Then Echo "java_home=/usr/local/java/jdk1.7.0_67"|sudo Tee-a/etc/EnvironmentEcho "Export Java_home"|sudo Tee-a/etc/EnvironmentEcho "path= $PATH: $JAVA _home/bin"|sudo Tee-a/etc/EnvironmentEcho "Export PATH"|sudo Tee-a/etc/EnvironmentEcho "classpath=.: $JAVA _home/lib"|sudo Tee-a/etc/EnvironmentEcho "Export CLASSPATH"|sudo Tee-a/etc/Environmentfi#update Environmentsource/etc/Environment Ehco"JDK is installed!"
Simply explain: Download the JDK and tar.gz package directly with wget, then unzip and then modify the system environment variables and update them.
Enter Javac or java-version to validate.
java_home=/usr/jdk1.7.0_67
Export Java_home
Path= $PATH: $JAVA _home/bin
Export PATH
Classpath=.: $JAVA _home/lib
Export CLASSPATH
Path= "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"
java_home=/usr/local/java/jdk1.7.0_67
Second, Tomcat automatic installation script
#InstallTomcatsduosumkdir/usr/local/Tomcatcd/usr/local/Tomcatwgethttp//apache.fayea.com/apache-mirror/tomcat/tomcat-7/v7.0.56/bin/apache-tomcat-7.0.56.tar.gzTar-XVF apache-tomcat-7.0. About.Tar. Gz#change Port8080To thesed-I.'s/8080/80/'apache-tomcat-7.0. About/conf/Server.xml#startupnohup./apache-tomcat-7.0. About/bin/startup.SH
Note: The same is done using wget to download the Tomcat tar.gz package, then unzip, unzip the completion of the use of the SED command to change the default port number 8080 to 80, and then use the Nohup command to start the background service!
Installation of the JDK configuration in a Windows-attached environment:
JDK official: http://www.oracle.com/technetwork/java/javase/downloads/index.html
windows: 1) Create a new java_home variable in the system variable, the value of the variable is: C:\Java\jdk1.7.0_67 (fill in according to their own installation path)2) New CLASSPATH variable, the value of the variable is:.; %java_home%\lib;%java_home%\lib\tools.jar3) Add variable value in Path variable (existing without new):%java_home%\bin;%java_home %\jre\bin (Note the value of the variable with ";" Separated
Reference:
1, How-to-automate-download-and-installation-of-java-jdk-on-linux
2. Linux Shell script Introduction learn 19--sed command detailed
Utility script----Linux under JDK and Tomcat Auto-install Shell script Summary