1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
cd /usr/local/src
wget http: //www .oracle.com /technetwork/java/javase/downloads/jdk8-downloads-2133151 .html
##需要进去,点介绍协议,下载jdk8 tar zxvf jdk-8u144-linux-x64. tar .gz
mv jdk1.8.0_144/ /usr/local/jdk8 .0
vim /etc/profile
JAVA_HOME= /usr/local/jdk8 .0
JAVA_BIN= /usr/local/jdk8 .0 /bin
PATH=$PATH:$JAVA_BIN CLASSPATH=$JAVA_HOME /lib/dt .jar:$JAVA_HOME /lib/tools .jar
export JAVA_HOME JAVA_BIN PATH CLASSPATH
export CATALINA_BASE= /usr/local/tomcat
export CATALINA_HOME= /usr/local/tomcat
source /etc/profile
cd /usr/local/src/
wget https: //mirrors .tuna.tsinghua.edu.cn /apache/tomcat/tomcat-8/v8 .5.23 /bin/apache-tomcat-8 .5.23. tar .gz
tar zxvf apache-tomcat-8.5.23. tar .gz
mv apache-tomcat-8.5.23 /usr/local/tomcat8 .5
ln -s /usr/local/tomcat8 .5/ /usr/local/tomcat
cd /usr/local/tomcat/bin/
echo "CATALINA_HOME=/usr/local/tomcat8.5/" >> catalina.sh
chmod +x *.sh
. /startup .sh
|
启动慢修改如下:
在catalina.sh中加入这么一行:
JAVA_OPTS="-Djava.security.egd=file:/dev/./urandom"
打开$JAVA_PATH/jre/lib/security/java.security这个文件,找到下面的内容:
securerandom.source=file:/dev/urandom
替换成
securerandom.source=file:/dev/./urandom
想登陆管理页面,操作如下:
conf/Catalina/localhost/下创建 manager.xml , 填入如下内容
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
<Context privileged= "true" antiResourceLocking= "false"
docBase= "${catalina.home}/webapps/manager" >
<Valve className= "org.apache.catalina.valves.RemoteAddrValve" allow= "^.*$" />
< /Context >
添加用户 conf /tomcat-users .xml 中的 <tomcat- users >< /tomcat-users > 标签内添加如下代码:
<role rolename= "manager-gui" />
<role rolename= "manager-script" />
<role rolename= "manager-jmx" />
<role rolename= "manager-status" />
<role rolename= "admin-gui" />
<role rolename= "admin-script" />
<user username= "admin" password= "admin" roles= "manager-gui,manager-script,manager-jmx,manager-status,admin-gui,admin-script" />
<user username= "deploy" password= "deploy" roles= "manager-script" />
|
host-manager 还是 403 错误 解决办法 允许所有IP访问
1
2
3
4
5
|
vim /usr/local/tomcat/webapps/host-manager/META-INF/context .xml
<Context antiResourceLocking= "false" privileged= "true" >
<Valve className= "org.apache.catalina.valves.RemoteAddrValve"
allow= "^.*$" /> #修改这里
< /Context >
|
修改成80
vim conf/server.xml
69 <Connector port="80" protocol="HTTP/1.1"
70 connectionTimeout="20000"
71 redirectPort="8443" />
修改默认网页路径
vim conf/server.xml
148 <Host name="localhost" appBase="webapps"
149 unpackWARs="true" autoDeploy="true">
164 <Context path="" docBase="/usr/local/tomcat/webapps/shyt/" debug="0"/> ###加入此行, docBase就是你要访问的路径
165 </Host>
修改默认首页文件
vim conf/web.xml
4693 <welcome-file-list>
4694 <welcome-file>index.html</welcome-file>
4695 <welcome-file>index.htm</welcome-file>
4696 <welcome-file>index.jsp</welcome-file>
4697 </welcome-file-list>