Linux下Java、Maven、Tomcat的安装
来源:行业资讯 /
时间: 2024-12-13
1)下载jdk(jdk-7),下载地址如下:
32位:http://download.oracle.com/otn-pub/java/jdk/7u67-b01/jdk-7u67-linux-i586.tar.gz<br/>
64位:http://download.oracle.com/otn-pub/java/jdk/7u67-b01/jdk-7u67-linux-x64.tar.gz<br/>
下载命令(以64位为例):<br/>
$ cd /usr/local<br/>
$ sudo wget http://download.oracle.com/otn-pub/java/jdk/7u67-b01/jdk-7u67-linux-x64.tar.gz<br/>
2)解压到安装目录,使用如下命令:<br/>
$ cd /usr/local<br/>
$ sudo tar -xf jdk-7u67-linux-x64.tar.gz<br/>
3)配置环境变量,修改/etc/profile文件 <br/>
$ sudo vim /etc/profile<br/>
在末尾添加如下内容: <br/>
export JAVA_HOME=/usrbk1.7.0_67 <br/>
export JRE_HOME=/usrbk1.7.0_67 /jre <br/>
export CLASSPATH=.:$JAVA_HOMEb:$JRE_HOMEb:$CLASSPATH <br/>
export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH<br/>
执行如下命令:<br/>
$ source /etc/profile<br/>
输入java命令,看看是否生效,部分结果如下:<br/>
$ java<br/>
Usage: java [-options] class [args...]<br/>
(to execute a class)<br/>
or java [-options] -jar jarfile [args...]<br/>
(to execute a jar file)<br/>
<br/>
where options include:<br/>
-d32 use a 32-bit data model if available<br/>
<br/>
-d64 use a 64-bit data model if available<br/>
-server to select the "server" VM<br/>
The default VM is server.<br/>
<br/>
-cp <class search path of directories and zip/jar files><br/>
-classpath <class search path of directories and zip/jar files><br/>
A : separated list of directories, JAR archives,<br/>
and ZIP archives to search for class files.<br/>
-D<name>=<value><br/>
2、安装maven<br/>
1)下载,下载命令如下:<br/>
$ cd /usr/local<br/>
$ sudo wget http://apache.fayea.com/apache-mirror/maven/maven-3/3.2.2/binaries/apache-maven-3.2.2-bin.tar.gz<br/>
2)解压,命令如下: <br/>
$ cd /usr/local<br/>
$ sudo tar -xf apache-maven-3.2.2-bin.tar.gz<br/>
3)配置环境变量<br/>
$ sudo vim /etc/profile<br/>
在末尾添加如下内容:<br/>
export M2_HOME=/usr/local/apache-maven-3.2.2<br/>
export PATH=$PATH:$M2_HOME/bin<br/>
执行如下命令:<br/>
$ source /etc/profile<br/>
输入mvn --help命令,看看是否生效,部分结果如下:<br/>
mvn --help<br/>
<br/>
usage: mvn [options] [<goal(s)>] [<phase(s)>]<br/>
<br/>
Options:<br/>
-am,--also-make If project list is specified, also<br/>
build projects required by the<br/>
list<br/>
-amd,--also-make-dependents If project list is specified, also<br/>
build projects that depend on<br/>
projects on the list<br/>
-B,--batch-mode Run in non-interactive (batch)<br/>
mode<br/>
-C,--strict-checksums Fail the build if checksums don't<br/>
match<br/>
3、安装tomcat<br/>
1)下载<br/>
$ cd /usr/local<br/>
$ sudo wget http://mirrors.cnnic.cn/apache/tomcat/tomcat-7/v7.0.55/bin/apache-tomcat-7.0.55.tar.gz<br/>
2)解压缩<br/>
$ cd /usr/local<br/>
$ sudo tar -xf apache-tomcat-7.0.55.tar.gz<br/>
3)配置环境变量<br/>
$ sudo vim /etc/profile<br/>
在末尾添加如下内容: <br/>
export export TOMCAT_HOME=/export/software/apache-tomcat-7.0.42<br/>
export PATH=$PATH:$TOMCAT_HOME/bin<br/>
执行如下命令:<br/>
$ cd /usr/local/apache-tomcat-7.0.55<br/>
$ bin/startup.sh<br/>
Using CATALINA_BASE: /usr/local/apache-tomcat-7.0.55<br/>
Using CATALINA_HOME: /usr/local/apache-tomcat-7.0.55<br/>
Using CATALINA_TMPDIR: /usr/local/apache-tomcat-7.0.55/temp<br/>
Using JRE_HOME: /usr/localk1.7.0_67/jre<br/>
Using CLASSPATH: /usr/local/apache-tomcat-7.0.55/bin/bootstrap.jar:/export/software/apache-tomcat-7.0.55/bin/tomcat-juli.jar<br/>
Tomcat started.<br/>
此时,在浏览器打开http://localhost:8080,可以看到如下页面,表示启动成功。 <br/>
<p><img src="https://img.xpwin7.com/2021/1015/202135151135551.png" ,="" alt="Linux下Java、Maven、Tomcat的安装"/></p><br/>
上一篇: Linux下execl学习
下一篇: linux下串口调试工具xgcom安装