Installation of Java, Maven, and Tomcat in Linux

Source: Internet
Author: User

Installation of Java, Maven, and Tomcat in Linux

1. install Java (the installation directory is assumed to be/usr/local)

1) download jdk (jdk-7), as follows:

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 (taking 64-bit as an example ):

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

2) decompress the package to the installation directory and run the following command:

$ cd /usr/local$ sudo tar -xf jdk-7u67-linux-x64.tar.gz
3) Configure environment variables and modify the/etc/profile file
$ sudo vim /etc/profile
Add the following content 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
Run the following command:
$ source /etc/profile
Enter the java command to check whether it takes effect. Some 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. The download command is 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.gz
2) decompress the package. The command is as follows:
$ cd /usr/local$ sudo tar -xf apache-maven-3.2.2-bin.tar.gz
3) Configure Environment Variables
$ sudo vim /etc/profile
Add the following content at the end:
export M2_HOME=/usr/local/apache-maven-3.2.2export PATH=$PATH:$M2_HOME/bin

Run the following command:

$ source /etc/profile
Enter the mvn -- help Command to check whether the command takes effect. Some 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                                        match
3. 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.gz
2) Extract
$ cd /usr/local$ sudo tar -xf apache-tomcat-7.0.55.tar.gz

3) Configure Environment Variables

$ sudo vim /etc/profile
Add the following content at the end:
export export TOMCAT_HOME=/export/software/apache-tomcat-7.0.42export PATH=$PATH:$TOMCAT_HOME/bin
Run 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.
In this case, open http: // localhost: 8080 in the browser. The following page is displayed, indicating that the startup is successful.


Run the following command to disable tomcat:

$ 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 

Reprinted please indicate the source:Http://blog.csdn.net/iAm333

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.