Linux環境下web工程部署,linuxweb工程部署
1-1 Jdk安裝
/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安裝
執行[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檔案
[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