1-1 Jdk安装
-
将jdk安装文件jdk-6u21-linux-x64.bin放到服务器上某个目录,例如
/usr/local/
打开远程连接工具SSH或者SecureCRT
进入该目录下面
[[email protected]~]# cd /usr/local/
如果安装文件不是可执行的,先将其修改为可执行文件
chmod755 jdk-6u21-linux-x64.bin
执行ll查看安装文件状态,如果是-rwxr-xr-x就可以了。
执行安装命令:
[[email protected]/usr/local/share]# ./jdk-6u21-linux-x64.bin
#./ jdk-6u35-linux-i586.bin
默认会安装到/usr/local/面
2:配置环境变量
[[email protected]/usr/local]#
exportJAVA_HOME=/usr/local/jdk1.6.0_21
[[email protected]/usr/local]#
export CLASSPATH=.
[[email protected]/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
执行[[email protected]
/usr/local]#[[email protected] /usr/local]#
tar -zxvfapache-tomcat-6.0.35.tar.gz
进入bin目录下面
Cd
/usr/local/apache-tomcat-6.0.35/bin
//将所有的命令都弄成可执行文件
[[email protected]/usr/local/apache-tomcat-6.0.35/bin]#
chmod 755*
[[email protected]/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
[[email protected]/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服务器
[[email protected]~]#
cd /usr/local/apache-tomcat-6.0.35/bin
[[email protected]]#
./startup.sh &
查看Tomcat启动日志
[[email protected]]#
cd /usr/local/apache-tomcat-6.0.35/logs
[[email protected]]# tail -f catalina.out
4、重启Tomcat服务器
当更新系统文件或者重新部署的时候,需要重新启动Tomcat服务器
- 关闭Tomcat服务器
[[email protected]]#
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
[[email protected]]#
kill -9 1969
- 清理缓存文件
[[email protected]]#
cd/usr/local/apache-tomcat-6.0.35/webapps
[[email protected]]# rm -rf ROOT/删除ROOT文件
[[email protected]]#
cd/usr/local/apache-tomcat-6.0.35/work
[[email protected]]#
rm -rf Catalina/删除Catalina文件
- 更新系统文件或者更新整个war包
- 重新启动Tomcat
[[email protected]]# cd /usr/local/apache-tomcat-6.0.35/bin
[[email protected]]# ./startup.sh &
查看Tomcat启动日志
[[email protected]]#
cd /usr/local/apache-tomcat-6.0.35/logs
[[email protected]]#
tail -f catalina.out