首页 > 代码库 > Linux环境下web工程部署
Linux环境下web工程部署
1-1 Jdk安装
将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安装
将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文件复制到tomcat的webapps下,即/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服务器
关闭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
清理缓存文件
[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文件
更新系统文件或者更新整个war包
重新启动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工程部署