首页 技术 正文
技术 2022年11月9日
0 收藏 364 点赞 3,340 浏览 2879 个字

首先下载压缩包
wget http://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/tomcat-7/v7.0.78/bin/apache-tomcat-7.0.78.zip

如果centos7是最小版安装的话,还需要安装配置java环境

可参考http://www.cnblogs.com/biaopei/p/7730484.html
解压
unzip apache-tomcat-7.0.78.zip

[root@bogon src]# ls
apache-tomcat-7.0.78 kernels linux-3.10.1.tar.gz upload
apache-tomcat-7.0.78.zip linux-2.6.1 linux-3.4.16 utility
debug linux-3.10.1 readme
[root@bogon src]# cd apache-tomcat-7.0.78/
[root@bogon apache-tomcat-7.0.78]# ls
bin lib logs RELEASE-NOTES temp work
conf LICENSE NOTICE RUNNING.txt webapps
[root@bogon apache-tomcat-7.0.78]# cd bin
[root@bogon bin]# ls
bootstrap.jar daemon.sh startup.sh
catalina.bat digest.bat tomcat-juli.jar
catalina.sh digest.sh tomcat-native.tar.gz
catalina-tasks.xml setclasspath.bat tool-wrapper.bat
commons-daemon.jar setclasspath.sh tool-wrapper.sh
commons-daemon-native.tar.gz shutdown.bat version.bat
configtest.bat shutdown.sh version.sh
configtest.sh startup.bat
[root@bogon bin]#

需要给该目录下的三个文件执行权限chmod 755
这三个文件你分别是catalina.sh shutdown.sh startup.sh
开启tomcat需要执行./startup.sh
关闭tomcat需要执行./shudown.sh
浏览器打开localhost:8080进行访问
啥,不能访问,喜欢简单粗暴的就直接关闭防火墙,绅士一点就让防火墙通过8080端口吧,即执行以下命令
iptables -I INPUT -p tcp –dport=8080 -j ACCEPT
给个成功效果图
Centos7 下安装配置tomcat7

不出意外的话,tomcat虽然可以正常访问,但是,我们无法进入图形化管理后台,这个还需要另外配置

[root@localhost ~]# cd apache-tomcat-9.0.2/conf/
[root@localhost conf]# ls
Catalina catalina.policy catalina.properties context.xml jaspic-providers.xml jaspic-providers.xsd logging.properties server.xml tomcat-users.xml tomcat-users.xsd web.xml

配置tomcat-users.xml文件,在该文件末尾增加以下内容

<role rolename=”manager-gui”/>
<user username=”tomcat” password=”123456″ roles=”manager-gui”/>

除此之外还需要配置

[root@localhost META-INF]# pwd
/root/apache-tomcat-9.0.2/webapps/manager/META-INF
[root@localhost META-INF]# ls
context.xml
[root@localhost META-INF]# cat context.xml
<?xml version=”1.0″ encoding=”UTF-8″?>
<!–
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the “License”); you may not use this file except in compliance with
the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an “AS IS” BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
# allow=”127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1″ />
–>
<Context antiResourceLocking=”false” privileged=”true” >
<Valve className=”org.apache.catalina.valves.RemoteAddrValve”
allow=”^.*$” />      修改这里
<Manager sessionAttributeValueClassNameFilter=”java\.lang\.(?:Boolean|Integer|Long|Number|String)|org\.apache\.catalina\.filters\.CsrfPreventionFilter\$LruCache(?:\$1)?|java\.util\.(?:Linke
d)?HashMap”/></Context>
[root@localhost META-INF]#

最后重启,就可以进入tomcat的server status了,用户名为tomcat,密码123456

tomcat网站目录位于apache-tomcat-9.0.2/webapps/ROOT目录下

上一篇: Go Example--range
下一篇: GPIO引脚操作
相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,088
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,565
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,413
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,186
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,822
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,905