Installation of Java, Maven, and Tomcat under Linux

  

1. Install Java (here assuming the installation directory bit /usr/local)

1) Download jdk(jdk-7), the download address is as follows: Br>

32-bit: http://download.oracle.com/otn-pub/java/jdk/7u67-b01/jdk-7u67-linux-i586.tar.gz

64-bit: Http://download.oracle.com/otn-pub/java/jdk/7u67-b01/jdk-7u67-linux-x64.tar.gz

Download command (take 64 bit as an example): < Br>

$ cd /usr/local$ sudo wget http://download.oracle.com/otn-pub/java/jdk/7u67-b01/jdk-7u67-linux-x64.tar.gz

2) Extract to the installation directory, use the following command:

$ cd /usr/local$ sudo tar -xf jdk-7u67-linux-x64.tar.gz3)Configure environment variables, modify /etc/profile file 
$ sudo vim /etc/profile adds the following at the end: 
export JAVA_HOME=/usr/lib/jdk1.7.0_67 export JRE_HOME=/usr/lib/jdk1.7.0_67 /jre export CLASSPATH=.: $JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH Execute the following command: 
$ source /etc/profile Enter the java command to see if it works. Some of the results are as follows: 
$ javaUsage: java [-options] class [args...] (to execute a class) or java [- Options] -jar jarfile [args...] (to execute a jar file) where options include: -d32 use a 32-bit data model if available -d64 use a 64-bit data model if available -server to select the " ;server" VM The default VM is server. -cp <class search path of directories and zip/jar files> -classpath <class search path of directories and zip/jar files> A : separated list of directories, JAR archives, And ZIP archives to search for class files. -D<name>=<value>2, install maven

1) Download, download the command as follows:

$ cd /usr/local$ sudo wget http ://apache.fayea.com/apache-mirror/maven/maven-3/3.2.2/binaries/apache-maven-3.2.2-bin.tar.gz2) Unzip, the command is as follows: 

$ cd /usr/local$ sudo tar -xf apache-maven-3.2.2-bin.tar.gz3) Configure the environment variable

$ sudo vim /etc/profile Add the following at the end: 
export M2_HOME=/usr/local/apache-maven-3.2.2export PATH=$PATH:$M2_HOME/bin

Execute the following command:

$ source /etc/profileEnter mvn --help command, see See if it works, some of the results are as follows: 
mvn --helpusage: mvn [options] [<goal(s)>] [<phase(s)>]Options: -am,--also-make If project list is specified, also build projects required by the list -amd,--also-make-dependents If project list is specified, also build projects that depend on projects on the list -B,--batch-mode Run in non -interactive (batch) mode -C,--strict-checksums Fail the build if checksums don' t match3, install tomcat

1) Download

$ cd /usr/local$ sudo wget http://mirrors.cnnic.cn/apache/tomcat/tomcat-7/v7.0.55/bin/Apache-tomcat-7.0.55.tar.gz2) Unzip 
$ cd /usr/local$ sudo tar -xf apache-tomcat-7.0.55.tar.gz

3) Configure environment variables

$ sudo vim /etc/profile Add the following at the end: 
export export TOMCAT_HOME=/export/software/apache-tomcat-7.0.42export PATH=$PATH:$TOMCAT_HOME/bin Execute the following command: 
$ cd /usr/local/apache-tomcat-7.0.55$ bin/startup.shUsing CATALINA_BASE: /usr/local/apache-tomcat-7.0.55Using CATALINA_HOME: /usr/local/apache-tomcat-7.0.55Using CATALINA_TMPDIR : /usr/local/apache-tomcat-7.0.55/tempUsing JRE_HOME: /usr/local/jdk1.7.0_67/jreUsing CLASSPATH: /usr/local/apache-tomcat-7.0.55/bin/bootstrap.jar:/Export/software/apache-tomcat-7.0.55/bin/tomcat-juli.jarTomcat started. At this time, open http://localhost:8080 in the browser, you can see the following page, indicating that the startup is successful. . 

You can close tomcat by executing the following command:

$ cd /usr/local/apache-tomcat-7.0.55$ bin/shutdown.shUsing CATALINA_BASE: /usr/local/apache-tomcat-7.0.55Using CATALINA_HOME: /usr/local/apache-tomcat-7.0.55Using CATALINA_TMPDIR: /usr/local/apache-tomcat-7.0.55/tempUsing JRE_HOME: /usr/local/jdk1.7.0_67/jreUsing CLASSPATH: /usr/local/Apache-tomcat-7.0.55/bin/bootstrap.jar:/export/software/apache-tomcat-7.0.55/bin/tomcat-juli.jar 

Reprint please indicate the source: http://blog.csdn .net/iAm333

Copyright © Windows knowledge All Rights Reserved