从ubuntu10.04起,默认是关闭1024一下的端口. 需要用root权限启动 :sudo ./startup.sh
需要在catalina.sh文件里添加Java路径(这里必须设置,环境变量设置了这里也需要,不然sudo启动会报错)
---------------------------------------------------
export JAVA_HOME=/opt/java
export JRE_HOME=/opt/java/jre
# OS specific support. $var _must_ be set to either true or false.
cygwin=false
darwin=false
-----------------------------------------------------------------
先sudo ./catalina.sh run 测试是否能正常运行可查询日志的方式。
最后使用sudo ./startup.sh 启动
到官方下载并解压
sudo tar -zxvf apache-tomcat-8.5.9.tar.gz
将目录移动到opt下
sudo mv apache-tomcat-8.5.23 /opt/tomcat
设置Tomcat目录权限
sudo chmod 755 -R tomcat
设置Tomcat的环境变量
sudo nano ~/.bashrc
#tomcat
export TOMCAT_HOME=/opt/tomcat
source ~/.bashrc
启动
sudo $TOMCAT_HOME/bin/startup.sh
----------------------------------------------------------------------
编辑
/opt/tomcat/conf/tomcat-users.xml
在</tomcat-users>前加入以下
<role rolename="manager-gui"/>
<role rolename="manager-script"/>
<role rolename="manager-jmx"/>
<role rolename="manager-status"/>
<user username="admin" password="xxx" roles="manager-gui"/>
</tomcat-users>
<role rolename="manager-gui"/> <role rolename="manager-script"/> <role rolename="manager-jmx"/> <role rolename="manager-status"/> <user username="admin" password="xxx" roles="manager-gui"/> </tomcat-users>
docBase="${catalina.home}/webapps/manager">
<Valve className="org.apache.catalina.valves.RemoteAddrValve" allow="^.*$" />
</Context>