当前位置: 首页 > news >正文

Centos7 下安装配置tomcat7

安装包:apache-tomcat-7.0.79.tar.gz

https://pan.baidu.com/s/1hjbwxduj5r9y83yWsSXyrw

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

 

解压

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

给个成功效果图

 

**********

不出意外的话,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]#

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

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

转载于:https://www.cnblogs.com/wenxingxu/p/9405392.html

相关文章:

  • 【iOS-Cocos2d游戏开发】使用plist文件制作简单精灵
  • linux awk详解
  • HDU 2680 Choose the best route(多起点单终点最短路问题)题解
  • 【iOS-Cocos2d游戏开发】使用Zwoptex生成plist文件
  • 初始Windows系统
  • 西方酒馆(一)
  • Nodejs----基本数据类型
  • Objective-C属性介绍
  • PAT 1061 判断题(15)(代码)
  • 【iOS-Cocos2d游戏开发】使用cocosBuiler制作cocos2d场景
  • 面试题——存储引擎
  • HTML(XHTML)基础知识(二)——【body】
  • 《性能测试诊断分析与优化》推荐序(2)
  • Go实现发送解析GET与POST请求
  • 转新浪微博 Facebook新园区黑客之路
  • 【跃迁之路】【585天】程序员高效学习方法论探索系列(实验阶段342-2018.09.13)...
  • ➹使用webpack配置多页面应用(MPA)
  • crontab执行失败的多种原因
  • Effective Java 笔记(一)
  • If…else
  • JavaScript函数式编程(一)
  • macOS 中 shell 创建文件夹及文件并 VS Code 打开
  • php ci框架整合银盛支付
  • python docx文档转html页面
  • Python学习之路13-记分
  • SQLServer之创建数据库快照
  • 闭包--闭包作用之保存(一)
  • 给第三方使用接口的 URL 签名实现
  • 给新手的新浪微博 SDK 集成教程【一】
  • 力扣(LeetCode)56
  • 06-01 点餐小程序前台界面搭建
  • 机器人开始自主学习,是人类福祉,还是定时炸弹? ...
  • ​一、什么是射频识别?二、射频识别系统组成及工作原理三、射频识别系统分类四、RFID与物联网​
  • # C++之functional库用法整理
  • # 手柄编程_北通阿修罗3动手评:一款兼具功能、操控性的电竞手柄
  • ### Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLTr
  • #《AI中文版》V3 第 1 章 概述
  • #WEB前端(HTML属性)
  • #Z2294. 打印树的直径
  • #绘制圆心_R语言——绘制一个诚意满满的圆 祝你2021圆圆满满
  • $.ajax()
  • $HTTP_POST_VARS['']和$_POST['']的区别
  • (1/2)敏捷实践指南 Agile Practice Guide ([美] Project Management institute 著)
  • (42)STM32——LCD显示屏实验笔记
  • (52)只出现一次的数字III
  • (zhuan) 一些RL的文献(及笔记)
  • (附源码)ssm高校社团管理系统 毕业设计 234162
  • (每日持续更新)jdk api之FileReader基础、应用、实战
  • (牛客腾讯思维编程题)编码编码分组打印下标(java 版本+ C版本)
  • (亲测)设​置​m​y​e​c​l​i​p​s​e​打​开​默​认​工​作​空​间...
  • (三)模仿学习-Action数据的模仿
  • (学习日记)2024.03.12:UCOSIII第十四节:时基列表
  • (译) 理解 Elixir 中的宏 Macro, 第四部分:深入化
  • (转)mysql使用Navicat 导出和导入数据库
  • .[hudsonL@cock.li].mkp勒索加密数据库完美恢复---惜分飞