码迷,mamicode.com
首页 > Web开发 > 详细

Linux环境下web工程部署

时间:2015-01-09 09:14:54      阅读:312      评论:0      收藏:0      [点我收藏+]

标签:linux   tomcat   项目部署   

1-1 Jdk安装

  1. jdk安装文件jdk-6u21-linux-x64.bin放到服务器上某个目录,例如

/usr/local/

技术分享

打开远程连接工具SSH或者SecureCRT

进入该目录下面

[root@apple.dba.com~]# cd /usr/local/

如果安装文件不是可执行的,先将其修改为可执行文件

chmod755 jdk-6u21-linux-x64.bin

执行ll查看安装文件状态,如果是-rwxr-xr-x就可以了。

技术分享

执行安装命令:

[root@apple.dba.com/usr/local/share]# ./jdk-6u21-linux-x64.bin

#./ jdk-6u35-linux-i586.bin

默认会安装到/usr/local/

技术分享

2:配置环境变量

[root@apple.dba.com/usr/local]# exportJAVA_HOME=/usr/local/jdk1.6.0_21

[root@apple.dba.com/usr/local]# export CLASSPATH=.

[root@apple.dba.com/usr/local]# export PATH=$JAVA_HOME/bin:$PATH

3、测试jdk安装是否成功

#java –version

出现版本信息说明安装成功。

技术分享


1-2 Tomcat安装

  1. apache-tomcat-6.0.35.zip解压至/usr/local/apache-tomcat-6.0.35

技术分享

执行[root@apple.dba.com

/usr/local]#[root@apple.dba.com /usr/local]# tar -zxvfapache-tomcat-6.0.35.tar.gz


技术分享

 进入bin目录下面

Cd /usr/local/apache-tomcat-6.0.35/bin

//将所有的命令都弄成可执行文件

[root@apple.dba.com/usr/local/apache-tomcat-6.0.35/bin]# chmod 755*

[root@apple.dba.com/usr/local/apache-tomcat-6.0.35/bin]# ll

婊璁?620

-rwxr-xr-x 1 root root 227052011-11-28 bootstrap.jar

-rwxr-xr-x 1 root root 118302011-11-28 catalina.bat

-rwxr-xr-x 1 root root 177082011-11-28 catalina.sh

-rwxr-xr-x 1 root root 23742011-11-28 catalina-tasks.xml

-rwxr-xr-x 1 root root 241722011-11-28 commons-daemon.jar

-rwxr-xr-x 1 root root 1996232011-11-28 commons-daemon-native.tar.gz

-rwxr-xr-x 1 root root 13422011-11-28 cpappend.bat

-rwxr-xr-x 1 root root 21082011-11-28 digest.bat

-rwxr-xr-x 1 root root 16892011-11-28 digest.sh

-rwxr-xr-x 1 root root 31502011-11-28 setclasspath.bat

-rwxr-xr-x 1 root root 41142011-11-28 setclasspath.sh

-rwxr-xr-x 1 root root 21082011-11-28 shutdown.bat

-rwxr-xr-x 1 root root 16282011-11-28 shutdown.sh

-rwxr-xr-x 1 root root 21092011-11-28 startup.bat

-rwxr-xr-x 1 root root 20232011-11-28 startup.sh

-rwxr-xr-x 1 root root 322772011-11-28 tomcat-juli.jar

-rwxr-xr-x 1 root root 2492592011-11-28 tomcat-native.tar.gz

-rwxr-xr-x 1 root root 34792011-11-28 tool-wrapper.bat

-rwxr-xr-x 1 root root 34722011-11-28 tool-wrapper.sh

-rwxr-xr-x 1 root root 21132011-11-28 version.bat

-rwxr-xr-x 1 root root 16322011-11-28 version.sh

[root@apple.dba.com/usr/local/apache-tomcat-6.0.35/bin]# ./startup.sh

Using CATALINA_BASE: /usr/local/apache-tomcat-6.0.35

Using CATALINA_HOME: /usr/local/apache-tomcat-6.0.35

Using CATALINA_TMPDIR:/usr/local/apache-tomcat-6.0.35/temp

Using JRE_HOME: /usr

Using CLASSPATH: /usr/local/apache-tomcat-6.0.35/bin/bootstrap.jar

2、运行/usr/local/apache-tomcat-6.0.35/bin/startup.sh

#./usr/local/apache-tomcat-6.0.35/bin/startup.sh

3、在浏览器输入http://ip:8080出现如下内容说明启动成功

技术分享


1-3初始化数据库(必须在部署系统之前操作)

1-4 部署系统

1、将war文件复制到tomcatwebapps下,即/usr/local/apache-tomcat-6.0.35/webapps

2、修改配置文件/usr/local/apache-tomcat-6.0.35/conf/server.xml

将原来的8080端口修改为默认的80


<Connectorport="80" protocol="HTTP/1.1"

connectionTimeout="20000"

redirectPort="8443"/>


找到<Host></Host>标签,

修改注意红色字体的为必须修改的内容


3、启动tomcat

打开SSH或者SecureCRT,连接linux服务器

启动Tomcat服务器

[root@XenServer02-6~]# cd /usr/local/apache-tomcat-6.0.35/bin

[root@XenServer02-6bin]# ./startup.sh &

查看Tomcat启动日志

[root@XenServer02-6bin]# cd /usr/local/apache-tomcat-6.0.35/logs

[root@XenServer02-6logs]# tail -f catalina.out

4、重启Tomcat服务器

当更新系统文件或者重新部署的时候,需要重新启动Tomcat服务器

  1. 关闭Tomcat服务器

[root@XenServer02-6logs]# ps -ef |grep java

root 1969 1 0 Aug17 ? 00:02:40 /usr/local/jdk1.6.0_21/bin/java-Djava.util.logging.config.file=/usr/local/apache-tomcat-6.0.35/conf/logging.properties-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager-Djava.endorsed.dirs=/usr/local/apache-tomcat-6.0.35/endorsed-classpath /usr/local/apache-tomcat-6.0.35/bin/bootstrap.jar-Dcatalina.base=/usr/local/apache-tomcat-6.0.35-Dcatalina.home=/usr/local/apache-tomcat-6.0.35-Djava.io.tmpdir=/usr/local/apache-tomcat-6.0.35/temporg.apache.catalina.startup.Bootstrap start

root 17151 17103 0 12:22 pts/3 00:00:00 grep java


[root@XenServer02-6logs]# kill -9 1969

  1. 清理缓存文件

[root@XenServer02-6ROOT]# cd/usr/local/apache-tomcat-6.0.35/webapps

技术分享

[root@XenServer02-6webapps]# rm -rf ROOT/删除ROOT文件



[root@XenServer02-6apache-tomcat-6.0.35]# cd/usr/local/apache-tomcat-6.0.35/work

[root@XenServer02-6work]# rm -rf Catalina/删除Catalina文件

  1. 更新系统文件或者更新整个war

  2. 重新启动Tomcat

[root@XenServer02-6work]# cd /usr/local/apache-tomcat-6.0.35/bin

[root@XenServer02-6bin]# ./startup.sh &

查看Tomcat启动日志

[root@XenServer02-6bin]# cd /usr/local/apache-tomcat-6.0.35/logs

[root@XenServer02-6logs]# tail -f catalina.out




Linux环境下web工程部署

标签:linux   tomcat   项目部署   

原文地址:http://blog.csdn.net/u013628152/article/details/42539935

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!