标签:
linux 内核版本:
[root@master-1-1 webapps]# uname -a Linux master-1-1 2.6.32-431.el6.x86_64 #1 SMP Fri Nov 22 03:15:09 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
linux 系统版本:
[root@master-1-1 webapps]# cat /etc/redhat-release CentOS release 6.5 (Final)
安装包:
apache-maven-3.3.1-bin.tar.gz
jdk-7u67-linux-x64.tar.gz
jetty-distribution-8.1.16.v20140903.zip
安装步骤:
1、安装jdk
在安装jdk前,先查看系统中是否有安装jdk的其他版本,我的系统中有通过yum安装的jdk1.5.0的版本,需要通过yum remove ~命令进行卸载。
mkdir /usr/local/jdk7
tar -xf jdk-7u67-linux-x64.tar.gz -C /usr/local/jdk7
编辑/root/.bash_profile文件,指定java环境
JAVA_HOME=/usr/local/jdk1.7 JAVA_BIN=/usr/local/jdk1.7/bin PATH=$PATH:$JAVA_BIN:/usr/local/maven/bin:$HOME/bin CLASSPATH=$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar JETTY_HOME=/usr/local/jetty export JAVA_HOME JAVA_BIN PATH CLASSPATH JETTY_HOME
测试java是否安装成功:
[root@master-1-1 local]# which java /usr/local/jdk1.7/bin/java [root@master-1-1 local]# java -version java version "1.7.0_67" Java(TM) SE Runtime Environment (build 1.7.0_67-b01) Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)
如上图,可见jdk环境已部署好。
2、安装apache-maven
Apache Maven,是一个软件(特别是Java软件)项目管理及自动构建工具,由Apache软件基金会所提供。基于项目对象模型(缩写:POM)概念,Maven利用一个中央信息片断能管理一个项目的构建、报告和文档等步骤。曾是Jakarta项目的子项目,现为独立Apache项目。
tar -xf apache-maven-3.3.1-bin.tar.gz
mv apache-maven-3.3.1 /usr/local/maven
测试maven是否安装成功:
[root@master-1-1 local]# which mvn /usr/local/maven/bin/mvn [root@master-1-1 local]# mvn --version Apache Maven 3.3.1 (cab6659f9874fa96462afef40fcf6bc033d58c1c; 2015-03-14T04:10:27+08:00) Maven home: /usr/local/maven Java version: 1.7.0_67, vendor: Oracle Corporation Java home: /usr/local/jdk1.7.0_67/jre Default locale: en_US, platform encoding: UTF-8 OS name: "linux", version: "2.6.32-431.el6.x86_64", arch: "amd64", family: "unix"
出现上面的结果,则说明安装成功。
安装jetty:
unzip jetty-distribution-8.1.16.v20140903.zip
mv jetty-distribution-8.1.16.v20140903 /usr/local/jetty
软件都已安装完毕,现在可以启动jetty了,测试:
启动jetty:
jetty日志文件会报存在logs文件中。
[root@master-1-1 bin]# ./jetty.sh start Starting Jetty: 2015-03-30 00:11:11.999:INFO::Redirecting stderr/stdout to /usr/local/jetty/logs/2015_03_29.stderrout.log . OK Mon Mar 30 00:11:18 CST 2015
[root@master-1-1 local]# ps aux|grep jetty root 2213 0.9 11.5 1074756 116500 pts/0 Sl 16:20 0:14 /usr/local/jdk1.6.0_24/bin/java -Djetty.state=/usr/local/jetty/jetty.state -Djetty.home=/usr/local/jetty -Djava.io.tmpdir=/tmp -jar /usr/local/jetty/start.jar etc/jetty-logging.xml etc/jetty-started.xml root 2343 0.0 0.0 103244 852 pts/0 S+ 16:45 0:00 grep jetty [root@master-1-1 local]# netstat -tpln|grep java tcp 0 0 :::8080 :::* LISTEN 2213/java [root@master-1-1 local]# netstat -tpln Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0:21 0.0.0.0:* LISTEN 1246/vsftpd tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 959/sshd tcp 0 0 127.0.0.1:6010 0.0.0.0:* LISTEN 1011/sshd tcp 0 0 127.0.0.1:6011 0.0.0.0:* LISTEN 1146/sshd tcp 0 0 :::8080 :::* LISTEN 2213/java tcp 0 0 :::80 :::* LISTEN 1093/httpd tcp 0 0 :::22 :::* LISTEN 959/sshd tcp 0 0 ::1:6010 :::* LISTEN 1011/sshd tcp 0 0 ::1:6011 :::* LISTEN 1146/sshd
可以看到,jetty的端口为8080端口,如果8080端口被占用,则修改jetty的端口。
访问:
输入:http://192.168.31.10:8080
小测试:
[root@master-1-1 local]# cd /usr/local/jetty/webapps/ [root@master-1-1 webapps]# ls spdy.war test1 test.war [root@master-1-1 webapps]# cat test1/hello.jsp <html> <body> <h4>simple test</h4> <%--echo hello world--%> <%@page language="java"%> <%="Hello World"%> </body> </html>
由此可见,测试成功,jetty安装完毕
小记:
在安装jdk和apache-maven时,由于jdk我刚开始用的版本是jdk1.6.0,maven是3.3,所以会报错:
具体错误不在这里列出,jdk换成为jdk7之后就好了。错误只有自己经历了才能提升自己~~~~~~
标签:
原文地址:http://www.cnblogs.com/cheerong/p/4375894.html