部署到服务器操作流程

连接到192.168.100.41 ,执行下面命令:
注意,要先停Apache 后再停Tomcat,启动的时候,先启动Tomcat,后启动Apache

[tomcat@routon1 ~]$ cd /usr/local/apache2.2.19/
[tomcat@routon1 apache2.2.19]$ ls
bin  build  cgi-bin  conf  error  htdocs  icons  include  lib  logs  man  manual  modules
[tomcat@routon1 apache2.2.19]$ cd bin
[tomcat@routon1 bin]$ ls
ab  apachectl  apr-1-config  apu-1-config  apxs  checkgid  dbmmanage  envvars  envvars-std  htcacheclean  htdbm  htdigest  htpasswd  httpd  httxt2dbm  logresolve  rotatelogs
[tomcat@routon1 bin]$ ./ap
apachectl     apr-1-config  apu-1-config  apxs          
[tomcat@routon1 bin]$ ./apachectl stop
httpd (pid 27559?) not running
[tomcat@routon1 bin]$ sudo /etc/init.d/httpd stop
[tomcat@routon1 bin]$ cd ..
[tomcat@routon1 apache2.2.19]$ cd..
-bash: cd..: command not found
[tomcat@routon1 apache2.2.19]$ cd /usr/local/
[tomcat@routon1 local]$ ls
apache2.2.19          bak-file  etc    include  jdk1.6.0_11              lib      lost+found  net-snmp-5.3.3         sbin   shell  src
apache-tomcat-6.0.33  bin       games  info     jdk-6u11-linux-i586.bin  libexec  man         net-snmp-5.3.3.tar.gz  share  snmp
[tomcat@routon1 local]$ cd apache-tomcat-6.0.33/w
webapps/ work/    
[tomcat@routon1 local]$ cd apache-tomcat-6.0.33/webapps/
[tomcat@routon1 webapps]$ ls
notice  notice.war  routon  routon.war
[tomcat@routon1 webapps]$ cd ..
[tomcat@routon1 apache-tomcat-6.0.33]$ ls
bin  conf  lib  LICENSE  logs  NOTICE  RELEASE-NOTES  RUNNING.txt  temp  webapps  work
[tomcat@routon1 apache-tomcat-6.0.33]$ cd bin
[tomcat@routon1 bin]$ ls
bootstrap.jar  catalina-tasks.xml               commons-daemon-native.tar.gz  digest.sh  setclasspath.bat  shutdown.sh  tomcat-juli.jar       tool-wrapper.sh
catalina.bat   commons-daemon-1.0.7-native-src  cpappend.bat                  jsvc       setclasspath.sh   startup.bat  tomcat-native.tar.gz  version.bat
catalina.sh    commons-daemon.jar               digest.bat                    logs       shutdown.bat      startup.sh   tool-wrapper.bat      version.sh
[tomcat@routon1 bin]$ ./shutdown.sh 
Using CATALINA_BASE:   /usr/local/apache-tomcat-6.0.33
Using CATALINA_HOME:   /usr/local/apache-tomcat-6.0.33
Using CATALINA_TMPDIR: /usr/local/apache-tomcat-6.0.33/temp
Using JRE_HOME:        /usr/local/jdk1.6.0_11
Using CLASSPATH:       /usr/local/apache-tomcat-6.0.33/bin/bootstrap.jar
[tomcat@routon1 bin]$  ps -ef|grep jdk
tomcat   27911 27813  0 10:34 pts/4    00:00:00 grep jdk
[tomcat@routon1 bin]$ cd ..
[tomcat@routon1 apache-tomcat-6.0.33]$ ls
bin  conf  lib  LICENSE  logs  NOTICE  RELEASE-NOTES  RUNNING.txt  temp  webapps  work
[tomcat@routon1 apache-tomcat-6.0.33]$ cd webapps/
[tomcat@routon1 webapps]$ ls
notice  notice.war  routon  routon.war
[tomcat@routon1 webapps]$ rm -rf notice
[tomcat@routon1 webapps]$ rm -rf notice.war 
[tomcat@routon1 webapps]$ ls
routon  routon.war
[tomcat@routon1 webapps]$ rz
rz waiting to receive.
开始 zmodem 传输。  按 Ctrl+C 取消。

[tomcat@routon1 webapps]$ ls
routon  routon.war
[tomcat@routon1 webapps]$ rz
rz waiting to receive.
开始 zmodem 传输。  按 Ctrl+C 取消。
  100%   72693 KB  790 KB/s 00:01:32       0 Errors

[tomcat@routon1 webapps]$ ls
notice.war  routon  routon.war
[tomcat@routon1 webapps]$ cd ..
[tomcat@routon1 apache-tomcat-6.0.33]$ ls
bin  conf  lib  LICENSE  logs  NOTICE  RELEASE-NOTES  RUNNING.txt  temp  webapps  work
[tomcat@routon1 apache-tomcat-6.0.33]$ cd bin
[tomcat@routon1 bin]$ ls
bootstrap.jar  catalina-tasks.xml               commons-daemon-native.tar.gz  digest.sh  setclasspath.bat  shutdown.sh  tomcat-juli.jar       tool-wrapper.sh
catalina.bat   commons-daemon-1.0.7-native-src  cpappend.bat                  jsvc       setclasspath.sh   startup.bat  tomcat-native.tar.gz  version.bat
catalina.sh    commons-daemon.jar               digest.bat                    logs       shutdown.bat      startup.sh   tool-wrapper.bat      version.sh
[tomcat@routon1 bin]$ ./startup.sh 
Using CATALINA_BASE:   /usr/local/apache-tomcat-6.0.33
Using CATALINA_HOME:   /usr/local/apache-tomcat-6.0.33
Using CATALINA_TMPDIR: /usr/local/apache-tomcat-6.0.33/temp
Using JRE_HOME:        /usr/local/jdk1.6.0_11
Using CLASSPATH:       /usr/local/apache-tomcat-6.0.33/bin/bootstrap.jar
[tomcat@routon1 bin]$ sudo /etc/init.d/httpd start


[color=red]
[tomcat@routon2 conf]$ sudo /etc/init.d/httpd stop
[tomcat@routon2 conf]$ sudo /etc/init.d/tomcat stop
[tomcat@routon2 conf]$ ps -ef|grep jdk
tomcat    7568     1  0 Jan19 ?        00:10:22 /usr/local/jdk1.6.0_11/bin/java -Djava.util.logging.config.file=/usr/local/apache-tomcat-6.0.33/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.endorsed.dirs=/usr/local/apache-tomcat-6.0.33/endorsed -classpath /usr/local/apache-tomcat-6.0.33/bin/bootstrap.jar -Dcatalina.base=/usr/local/apache-tomcat-6.0.33 -Dcatalina.home=/usr/local/apache-tomcat-6.0.33 -Djava.io.tmpdir=/usr/local/apache-tomcat-6.0.33/temp org.apache.catalina.startup.Bootstrap start
tomcat   16444 16010  0 16:23 pts/1    00:00:00 grep jdk
[tomcat@routon2 conf]$ sudo /bin/kill -9 7568
[tomcat@routon2 conf]$ ps -ef|grep jdk
tomcat   16447 16010  0 16:23 pts/1    00:00:00 grep jdk
[tomcat@routon2 conf]$ sudo /etc/init.d/tomcat start
[tomcat@routon2 conf]$ sudo /etc/init.d/httpd start
[/color]




在使用apache Server和Tomcat整合的时候,要先关闭apache 然后关闭tomcat,启动的时候要先启动tomcat,再启动tomcat
使用ps -ef|grep jdk 查看进程,
使用sudo /bin/kill -9 7568 杀tomcat进程,如果没有tomcat权限,不能使用shutdown关闭tomcat

在另一台机器上复制到本机    
[tomcat@routon2 ~]$ cd /usr/local/apache-tomcat-6.0.
apache-tomcat-6.0.20.tar.gz  apache-tomcat-6.0.33/        
[tomcat@routon2 ~]$ cd /usr/local/apache-tomcat-6.0.33/
[tomcat@routon2 apache-tomcat-6.0.33]$ ls
bin  conf  lib  LICENSE  logs  NOTICE  RELEASE-NOTES  RUNNING.txt  temp  webapps  work
[tomcat@routon2 apache-tomcat-6.0.33]$ cd webapps/
[tomcat@routon2 webapps]$ ls
routon  routon.war
[tomcat@routon2 webapps]$ scp routon.war [email protected]:/usr/local/apache-tomcat-6.0.33/webapps/
The authenticity of host '192.168.100.41 (192.168.100.41)' can't be established.
RSA key fingerprint is ee:77:c3:b8:bf:f6:c6:63:7b:18:50:ba:6c:62:7c:00.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.100.41' (RSA) to the list of known hosts.
[email protected]'s password: 
routon.war                                                                                                                                                                   100%   18MB  18.2MB/s   00:01    
[tomcat@routon2 webapps]$ 

猜你喜欢

转载自sjeveryday.iteye.com/blog/1226505