Ubuntu 11.04下搭建tomcat 7.0

配置Tomcat环境变量
vi /etc/environment <wbr><wbr></wbr><span style="color: #007800;"><br> CATALINA_BASE</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>webserver<span style="color: #000000; font-weight: bold;">/</span>tomcat <span style="color: #007800;"><br> CATALINA_HOME</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>webserver<span style="color: #000000; font-weight: bold;">/</span>tomcat <br> TOMCAT_USER=tomcat<br> 使用以下命令使配置生效<span style="font-family: '宋体',Verdana,Arial,Helvetica,sans-serif;"><br></span>. <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>environment<br> F、启动tomcat<br><span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>webserver<span style="color: #000000; font-weight: bold;">/</span>tomcat<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>startup.sh <wbr><wbr></wbr><br> Using CATALINA_BASE: <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>webserver<span style="color: #000000; font-weight: bold;">/</span>tomcat Using <br> CATALINA_HOME: <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>webserver<span style="color: #000000; font-weight: bold;">/</span>tomcat Using <br> CATALINA_TMPDIR: <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>webserver<span style="color: #000000; font-weight: bold;">/</span>tomcat<span style="color: #000000; font-weight: bold;">/</span>temp <br> Using JRE_HOME: <span style="color: #000000; font-weight: bold;">/</span>usr <br> Using CLASSPATH: <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>webserver<span style="color: #000000; font-weight: bold;">/</span>tomcat<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>bootstrap.jar:<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>webserver<span style="color: #000000; font-weight: bold;">/</span>tomcat<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>tomcat-juli.jar<br> G、测试<span style="font-family: '宋体',Verdana,Arial,Helvetica,sans-serif;"><br></span>访问http://ip:8080/,如果看到Tomcat缺省界面就表示成功了。<span style="font-family: '宋体',Verdana,Arial,Helvetica,sans-serif;"><br></span>H、停止Tomcat<span style="color: #000000; font-weight: bold;"><br> /</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>webserver<span style="color: #000000; font-weight: bold;">/</span>tomcat<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>shutdown.sh </wbr></wbr>



设置Tomcat管理员帐号
在的标签前添加以下内容
nano
/usr/local/webserver/tomcat/conf/tomcat-users.xml <wbr><wbr></wbr><br><span style="color: #000000; font-weight: bold;">&lt;</span>role <span style="color: #007800;">rolename</span>=<span style="color: #ff0000;">"admin-gui"</span><span style="color: #000000; font-weight: bold;">/&gt;</span> <span style="color: #000000; font-weight: bold;"><br> &lt;</span>role <span style="color: #007800;">rolename</span>=<span style="color: #ff0000;">"admin-script"</span><span style="color: #000000; font-weight: bold;">/&gt;</span> <span style="color: #000000; font-weight: bold;"><br> &lt;</span>role <span style="color: #007800;">rolename</span>=<span style="color: #ff0000;">"manager-gui"</span><span style="color: #000000; font-weight: bold;">/&gt;</span> <span style="font-family: '宋体',Verdana,Arial,Helvetica,sans-serif;"><span style="font-weight: bold;"><br></span></span><span style="color: #000000; font-weight: bold;">&lt;</span>role <span style="color: #007800;">rolename</span>=<span style="color: #ff0000;">"manager-script"</span><span style="color: #000000; font-weight: bold;">/&gt;</span> <span style="color: #000000; font-weight: bold;"><br> &lt;</span>role <span style="color: #007800;">rolename</span>=<span style="color: #ff0000;">"manager-jmx"</span><span style="color: #000000; font-weight: bold;">/&gt;</span> <span style="color: #000000; font-weight: bold;"><br> &lt;</span>role <span style="color: #007800;">rolename</span>=<span style="color: #ff0000;">"manager-status"</span><span style="color: #000000; font-weight: bold;">/&gt;</span> <span style="color: #000000; font-weight: bold;"><br> &lt;</span>user <span style="color: #007800;">username</span>=<span style="color: #ff0000;">"admin"</span> <span style="color: #007800;">password</span>=<span style="color: #ff0000;">"000000"</span> <span style="color: #007800;">roles</span>=<span style="color: #ff0000;">"manager-gui,manager-script,manager-jmx,manager-status,admin-script,admin-gui"</span><span style="color: rgb(0, 0, 0); font-weight: bold;">/&gt;<br></span>保存关闭后,重新运行tomcat即可输入上面定交的用户名和密码,便登录Tomcat的管理页面<br> J、以守护进程方式运行tomcat<span style="font-family: '宋体',Verdana,Arial,Helvetica,sans-serif;"><br></span>按照tomcat官方的要求,tomcat作为一个守护进程运行,需要用到jsvc工具<span style="font-family: '宋体',Verdana,Arial,Helvetica,sans-serif;"><br></span>安装jsvc<span style="color: #7a0874; font-weight: bold;"><br> cd</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>webserver<span style="color: #000000; font-weight: bold;">/</span>tomcat<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span> <span style="color: #c20cb9; font-weight: bold;"><br> tar</span> xvzf commons-daemon-native.tar.gz <span style="color: #7a0874; font-weight: bold;"><br> cd</span> commons-daemon-1.0.5-native-src<span style="color: #000000; font-weight: bold;">/</span>unix<span style="color: #000000; font-weight: bold;">/</span> .<span style="color: #000000; font-weight: bold;">/</span>configure <br><span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">cp</span> jsvc ..<span style="color: #000000; font-weight: bold;">/</span>.. <span style="color: #7a0874; font-weight: bold;"><br> cd</span> ..<span style="color: #000000; font-weight: bold;">/</span>..<br> 运行下面的命令,便可以守护进程运行tomcat<br> 访问http://ip:8080/,如果看到Tomcat缺省界面就表示成功了。<span style="font-family: '宋体',Verdana,Arial,Helvetica,sans-serif;"><br></span> </wbr>

你可能感兴趣的:(tomcat)