Linux下Java、Maven、Tomcat的安装

来源:互联网 时间:2026-02-26 18:14:04 作者:

系统大全为您提供
  1、安装Java(此处假定安装目录位/usr/local) 1)下载jdk(jdk-7),下载地址如下:
32位:https://www.herecours.com/d/file/efpub/2026/26-26/20260226175132569718.gzbr 64位:https://www.herecours.com/d/file/efpub/2026/26-26/20260226175132569719.gzbr 下载命令(以64位为例):
$ cd /usr/local
$ sudo wget https://www.herecours.com/d/file/efpub/2026/26-26/20260226175132569719.gzbr 2)解压到安装目录,使用如下命令:
$ cd /usr/local
$ sudo tar -xf jdk-7u67-linux-x64.tar.gz
3)配置环境变量,修改/etc/profile文件 
$ sudo vim /etc/profile
在末尾添加如下内容: 
export JAVA_HOME=/usr

b

k1.7.0_67  
export JRE_HOME=/usr

b

k1.7.0_67 /jre  
export CLASSPATH=.:$JAVA_HOME

b:$JRE_HOME

b:$CLASSPATH 
export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH
执行如下命令:
$ source /etc/profile
输入java命令,看看是否生效,部分结果如下:
$ java
Usage: 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、安装maven
1)下载,下载命令如下:
$ cd /usr/local
$ sudo wget https://www.herecours.com/d/file/efpub/2026/26-26/20260226175132569720.gzbr 2)解压,命令如下: 
$ cd /usr/local
$ sudo tar -xf apache-maven-3.2.2-bin.tar.gz
3)配置环境变量
$ sudo vim /etc/profile
在末尾添加如下内容:
export M2_HOME=/usr/local/apache-maven-3.2.2
export PATH=$PATH:$M2_HOME/bin
执行如下命令:
$ source /etc/profile
输入mvn --help命令,看看是否生效,部分结果如下:
mvn --help

usage: 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、安装tomcat
1)下载
$ cd /usr/local
$ sudo wget https://www.herecours.com/d/file/efpub/2026/26-26/20260226175132569721.gzbr 2)解压缩
$ cd /usr/local
$ sudo tar -xf apache-tomcat-7.0.55.tar.gz
3)配置环境变量
$ sudo vim /etc/profile
在末尾添加如下内容:  
export export TOMCAT_HOME=/export/software/apache-tomcat-7.0.42
export PATH=$PATH:$TOMCAT_HOME/bin
执行如下命令:
$ cd /usr/local/apache-tomcat-7.0.55
$ bin/startup.sh
Using CATALINA_BASE:   /usr/local/apache-tomcat-7.0.55
Using CATALINA_HOME:   /usr/local/apache-tomcat-7.0.55
Using CATALINA_TMPDIR: /usr/local/apache-tomcat-7.0.55/temp
Using JRE_HOME:        /usr/local

k1.7.0_67/jre
Using CLASSPATH:       /usr/local/apache-tomcat-7.0.55/bin/bootstrap.jar:/export/software/apache-tomcat-7.0.55/bin/tomcat-juli.jar
Tomcat started.
此时,在浏览器打开https://www.herecours.com/d/file/efpub/2026/26-26/20260226175132569722

Linux下Java、Maven、Tomcat的安装


 可以执行如下命令关闭tomcat:
$ cd /usr/local/apache-tomcat-7.0.55
$ bin

utdown.sh
Using CATALINA_BASE:   /usr/local/apache-tomcat-7.0.55
Using CATALINA_HOME:   /usr/local/apache-tomcat-7.0.55
Using CATALINA_TMPDIR: /usr/local/apache-tomcat-7.0.55/temp
Using JRE_HOME:        /usr/local

k1.7.0_67/jre
Using CLASSPATH:       /usr/local/apache-tomcat-7.0.55/bin/bootstrap.jar:/export/software/a  
  
  以上就是系统大全给大家介绍的如何使的方法都有一定的了解了吧,好了,如果大家还想了解更多的资讯,那就赶紧点击系统大全官网吧。 
 
本文来自系统大全https://www.herecours.com/d/file/efpub/2026/26-26/20260226175132569723

相关推荐