最近在linux下安裝了jdk,爲了圓我之前的心願,把tomcat也安裝了,順便部署個項目,也算是小又成就感html
廢話不說了,直接上過程linux
一.下載安裝對應的jdk,並配置Java環境。web
有關jdk的安裝請看個人上一篇博文http://www.cnblogs.com/cl1255674805/p/5720665.htmlapache
二.下載安裝tomcat(http://tomcat.apache.org/)bootstrap
[root@cwt123 ~]# unzip apache-tomcat-6.0.30.ziptomcat
[root@cwt123 ~]# mv apache-tomcat-6.0.30/ /usr/local/服務器
[root@cwt123 ~]cd /usr/local/app
[root@master local]# ln -s /usr/local/apache-tomcat-6.0.30/ /usr/local/tomcatwebapp
三.修改tomcat服務器的啓動端口spa
[root@cwt123 apache-tomcat-7.0.70]# cd /usr/local/apache-tomcat-7.0.70/conf
[root@cwt123 conf]# ls
Catalina catalina.properties logging.properties tomcat-users.xml
catalina.policy context.xml server.xml web.xml
[root@cwt123 conf]# vi server.xml
1.按鍵盤上I,進入編輯狀態
2.修改端口爲9999
3.按esc,而後輸入冒號":",而後W,Q 再按回車鍵,保存退出
四.啓動Tomcat服務器
[root@cwt123 conf]# cd /usr/local/tomcat/bin
[root@cwt123 bin]# ls
bootstrap.jar daemon.sh startup.sh
catalina.bat digest.bat tomcat-juli.jar
catalina.sh digest.sh tomcat-native.tar.gz
catalina-tasks.xml setclasspath.bat tool-wrapper.bat
commons-daemon.jar setclasspath.sh tool-wrapper.sh
commons-daemon-native.tar.gz shutdown.bat version.bat
configtest.bat shutdown.sh version.sh
configtest.sh startup.bat
[root@cwt123 bin]# ./startup.sh
Using CATALINA_BASE: /usr/local/tomcat
Using CATALINA_HOME: /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME: /usr
Using CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
Tomcat started.
[root@cwt123 bin]#
1.訪問tomcat
ok,說明啓動成功
五.部署項目
1.將打好的war包,放在該路徑下
[root@cwt123 apache-tomcat-7.0.70]# cd /usr/local/apache-tomcat-7.0.70/webapps
2.訪問該項目的頁面
ok,訪問成功