Menu Home

Ubuntu下开发用tomcat安装配置

Ubuntu下开发用tomcat安装配置
1.下载tomcat
http://tomcat.apache.org/index.html
2.安装tomcat

royakon@pangmei-royakon:~$ tar zxvf apache-tomcat-5.5.33.tar.gz
royakon@pangmei-royakon:~$ tar zxvf apache-tomcat-5.5.33-admin.tar.gz
royakon@pangmei-royakon:~$ ls
apache-tomcat-5.5.33               apache-tomcat-5.5.33.tar.gz
apache-tomcat-5.5.33-admin.tar.gz
royakon@pangmei-royakon:~$ mkdir ~/.tomcat5.5
royakon@pangmei-royakon:~$ mkdir ~/webapps_wwwroot
royakon@pangmei-royakon:~$ cp -R ./apache-tomcat-5.5.33/conf ~/.tomcat5.5
royakon@pangmei-royakon:~$ cp -R ./apache-tomcat-5.5.33/logs ~/.tomcat5.5
royakon@pangmei-royakon:~$ cp -R ./apache-tomcat-5.5.33/temp ~/.tomcat5.5
royakon@pangmei-royakon:~$ cp -R ./apache-tomcat-5.5.33/work ~/.tomcat5.5
royakon@pangmei-royakon:~$ cp -R ./apache-tomcat-5.5.33/webapps ~/webapps_wwwroot
royakon@pangmei-royakon:~$ rm -r ./apache-tomcat-5.5.33/conf
royakon@pangmei-royakon:~$ rm -r ./apache-tomcat-5.5.33/logs
royakon@pangmei-royakon:~$ rm -r ./apache-tomcat-5.5.33/temp
royakon@pangmei-royakon:~$ rm -r ./apache-tomcat-5.5.33/work
royakon@pangmei-royakon:~$ rm -r ./apache-tomcat-5.5.33/webapps
royakon@pangmei-royakon:~$ ln -s ~/.tomcat5.5/conf ./apache-tomcat-5.5.33/conf
royakon@pangmei-royakon:~$ ln -s ~/.tomcat5.5/logs ./apache-tomcat-5.5.33/logs
royakon@pangmei-royakon:~$ ln -s ~/.tomcat5.5/temp ./apache-tomcat-5.5.33/temp
royakon@pangmei-royakon:~$ ln -s ~/.tomcat5.5/work ./apache-tomcat-5.5.33/work
royakon@pangmei-royakon:~$ ln -s ~/webapps_wwwroot ./apache-tomcat-5.5.33/webapps
royakon@pangmei-royakon:~$ sudo cp -R ./apache-tomcat-5.5.33 /opt/
royakon@pangmei-royakon:~$ ln -s /opt/apache-tomcat-5.5.33 /usr/local/tomcat5.5
royakon@pangmei-royakon:~$ rm -r ./apache-tomcat-5.5.33

3.确认环境变量

royakon@pangmei-royakon:~$ gedit ~/.profile

添加以下的环境变量

# set sun jdk path
export JAVA_HOME="/usr/lib/jvm/java-6-sun"
export JRE_HOME="$JAVA_HOME/jre"
export PATH=".:$JAVA_HOME/bin:$PATH"
export CLASSPATH=".:/usr/lib/jvm/java-6-sun"

# set tomcat catalina base home
export CATALINA_HOME="/usr/local/tomcat5.5"

注销重新登录
4.配置tomcat-users.xml

< ?xml version='1.0' encoding='utf-8'?>
<tomcat -users>
  <role rolename="manager"/>
  <role rolename="tomcat"/>
  <role rolename="admin"/>
  <role rolename="role1"/>
  <user username="tomcat" password="tomcat" roles="tomcat"/>
  <user username="both" password="tomcat" roles="tomcat,role1,manager,admin"/>
  <user username="admin" password="" roles="admin,manager"/>
  <user username="role1" password="tomcat" roles="role1"/>
</tomcat>

5.启动tomcat

royakon@pangmei-royakon:~$ /usr/local/tomcat5.5/bin/startup.sh
Using CATALINA_BASE:   /usr/local/tomcat5.5
Using CATALINA_HOME:   /usr/local/tomcat5.5
Using CATALINA_TMPDIR: /usr/local/tomcat5.5/temp
Using JRE_HOME:        /usr/lib/jvm/java-6-sun/jre
Using CLASSPATH:       /usr/local/tomcat5.5/bin/bootstrap.jar

tomcat_install

royakon@pangmei-royakon:~$ /usr/localtomcat5.5/bin/shutdown.sh
Using CATALINA_BASE:   /usr/local/tomcat5.5
Using CATALINA_HOME:   /usr/local/tomcat5.5
Using CATALINA_TMPDIR: /usr/local/tomcat5.5/temp
Using JRE_HOME:        /usr/lib/jvm/java-6-sun/jre
Using CLASSPATH:       /usr/local/tomcat5.5/bin/bootstrap.jar

6.关于APR警告信息

2007-07-12 19:24:32 org.apache.catalina.core.AprLifecycleListener lifecycleEvent
信息: The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: ……

ubuntu下非常好解决,安装库文件即可.

royakon@pangmei-royakon:~$ sudo apt-update
royakon@pangmei-royakon:~$ sudo apt-get install libtcnative-1

Categories: ubuntu 工具技巧

Tagged as:

RoyAkon

6 replies