linux 非root用户安装 jdk 和 tomcat

来源:互联网 发布:流程图用什么软件画 编辑:程序博客网 时间:2024/06/05 18:17

四、部署 tomcat

1、将apache-tomcat-6.0.20.tar.gz上传到服务器上

2、解压文件,出现目录 apache-tomcat-6.0.20

[plain] view plain copy
  1. [sgmm@lnx_test ~]$ tar zxvf apache-tomcat-6.0.20.tar.gz  
3、设置tomcat的环境变量。
[plain] view plain copy
  1. [sgmm@lnx_test ~]$ vi .bash_profile  
增加如下:
[plain] view plain copy
  1. export CATALINA_BASE=/home/sgmm/apache-tomcat-6.0.20  
  2. export CATALINA_HOME=/home/sgmm/apache-tomcat-6.0.20  
最终 .bash_profile 文件的内容为:
[plain] view plain copy
  1. # .bash_profile  
  2.   
  3. # Get the aliases and functions  
  4. if [ -f ~/.bashrc ]; then  
  5.     . ~/.bashrc  
  6. fi  
  7.   
  8. # User specific environment and startup programs  
  9. JAVA_HOME=/home/sgmm/jdk1.6.0_13  
  10. CLASSPATH=$JAVA_HOME/lib:$JAVA_HOME/jre/lib   
  11. PATH=$PATH:$JAVA_HOME/bin:$JAVA_HOME/jre/bin   
  12. export PATH CLASSPATH JAVA_HOME  
  13. export CATALINA_BASE=/home/sgmm/apache-tomcat-6.0.20  
  14. export CATALINA_HOME=/home/sgmm/apache-tomcat-6.0.20  
4、使环境变量生效
[plain] view plain copy
  1. [sgmm@lnx_test ~]$ source ~/.bash_profile   
5、切换到tomcat 解压后的 bin目录下,执行如下命令启动 tomcat 服务
[plain] view plain copy
  1. [sgmm@lnx_test bin]$ ./startup.sh   
打印出以下信息,说明启动成功。
[plain] view plain copy
  1. Using CATALINA_BASE:   /home/sgmm/apache-tomcat-6.0.20  
  2. Using CATALINA_HOME:   /home/sgmm/apache-tomcat-6.0.20  
  3. Using CATALINA_TMPDIR: /home/sgmm/apache-tomcat-6.0.20/temp  
  4. Using JRE_HOME:       /home/sgmm/jdk1.6.0_13  

6、使用 ps -ef|grep tomcat 可以查看tomcat进程,并使用 kill -9 进程号杀掉进程