需要注意的是:安装 Tomcat 之前需要把 jdk 安装好。

一、下载安装包

- 安装可以在官网自行下载,下载 tar.gz 包便可。

二、解压缩:

 tar -zxvf apache-tomcat-9.0.27.tar.gz
  • 如果需要权限,执行以下命令
sudo chmod 777 apache-tomcat-9.0.27.tar.gz

三、配置环境变量

(1) 打开环境变量配置文件

 sudo vim /etc/profile

(2) 在最下方添加如下命令:

 export CATALINA_HOME=/usr/local/tomcat9/apache-tomcat-9.0.27

(3) 保存退出,通过vim的 ":wq"命令保存退出。如果还处于编辑状态,需要按下 Esc 键,在输入命令。

(4) 使命令生效:

source /etc/profile

(5) 配置 UTF-8 字符集(防止乱码问题)

A. 进入 tomcat 安装 conf 文件夹,编辑server.xml 文件

 cd /usr/local/tomcat9/apache-tomcat-9.0.27/conf
B. 编辑 server.xml 文件
 vim server.xml
C. 找到配置 8080 默认端口的位置,在 xml 节点末尾添加 URIEncoding="UTF-8",如下:
         Java AJP  Connector: /docs/config/ajp.html
APR (HTTP/AJP) Connector: /docs/apr.html
Define a non-SSL/TLS HTTP/1.1 Connector on port 8080
-->
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443"
URIEncodeing="UTF-8"/>
<!-- A "Connector" using the shared thread pool-->
<!--
<Connector executor="tomcatThreadPool"
port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
-->
<!-- Define an SSL/TLS HTTP/1.1 Connector on port 8443
This connector uses the NIO implementation. The default
SSLImplementation will depend on the presence of the APR/native
library and the useOpenSSL attribute of the
AprLifecycleListener.
Either JSSE or OpenSSL style configuration may be used regardless of
the SSLImplementation selected. JSSE style configuration is used below.
-->
D. 保存退出,通过vim的 ":wq"命令保存退出。如果还处于编辑状态,需要按下 Esc 键,在输入命令。

四、验证 Tomcat 服务器

(1) 进入tomcat 的目录,找到 \bin,执行里面的 ./startup.sh

(2) 看到 Tomcat started,说明启动成功。打开浏览器输入 127.0.0.1:8080 or localhost:8080,看到下面界面,Tomcat 就已经安装成功了。

人若无名,专心练剑!

喜欢的朋友可以留下你的赞!

Linux\CentOS Tomcat 配置的更多相关文章

  1. 阿里云服务器Linux CentOS安装配置(四)yum安装tomcat

    阿里云服务器Linux CentOS安装配置(四)yum安装tomcat 1.yum -y install tomcat  执行命令后,会帮你把jdk也安装好 2.tomcat安装目录:/var/li ...

  2. 阿里云服务器Linux CentOS安装配置(零)目录

    阿里云服务器Linux CentOS安装配置(零)目录 阿里云服务器Linux CentOS安装配置(一)购买阿里云服务器 阿里云服务器Linux CentOS安装配置(二)yum安装svn 阿里云服 ...

  3. 阿里云服务器Linux CentOS安装配置(九)shell编译、打包、部署

    阿里云服务器Linux CentOS安装配置(九)shell编译.打包.部署 1.查询当前目录以及子目录下所有的java文件,并显示查询结果 find . -name *.java -type f - ...

  4. 阿里云服务器Linux CentOS安装配置(八)nginx安装、配置、域名绑定

    阿里云服务器Linux CentOS安装配置(八)nginx安装.配置.域名绑定 1.安装nginx yum -y install nginx 2.启动nginx service nginx star ...

  5. 阿里云服务器Linux CentOS安装配置(一)购买阿里云服务器

    阿里云服务器Linux CentOS安装配置(一)购买阿里云服务器 我在阿里云购买的服务器配置 CPU:1核 内存:2G 系统盘:40G 公共镜像:CentOS 6.5 64位 公网带宽:1Mbps ...

  6. 阿里云服务器Linux CentOS安装配置(七)域名解析

    阿里云服务器Linux CentOS安装配置(七)域名解析 1.购买域名 登录阿里云,左侧菜单点击[域名],然后[域名注册],完成域名购买.(一般首年45元) 2.添加域名解析 在域名列表里点击你的域 ...

  7. 阿里云服务器Linux CentOS安装配置(六)resin多端口配置、安装、部署

    阿里云服务器Linux CentOS安装配置(六)resin多端口配置.安装.部署 1.下载resin包 http://125.39.66.162/files/2183000003E08525/cau ...

  8. 阿里云服务器Linux CentOS安装配置(五)jetty配置、部署

    阿里云服务器Linux CentOS安装配置(五)jetty配置.部署 1.官网下载jetty:wget http://repo1.maven.org/maven2/org/eclipse/jetty ...

  9. 阿里云服务器Linux CentOS安装配置(三)yum安装mysql

    阿里云服务器Linux CentOS安装配置(三)yum安装mysql 1.执行yum安装mysql命令:yum -y install mysql-server mysql-devel 2.启动mys ...

随机推荐

  1. uniapp 与C# 加解密

    1 uni-app操作 (1) 打开HBuilderX的视图->显示终端 cd 切换到你项目的根目录 执行命令 npm install crypto-js 安装成功后你的项目根目录会生成node ...

  2. markdown下载、安装、破解、汉化与常用语法

    markdown是一种纯文本格式的标记语言.通过简单的标记语法,它可以使普通文本内容具有一定的格式. 一.markdown下载 markdown破解版下载地址: http://www.pc6.com/ ...

  3. winsock完成端口套接字重用注意事项

    刚申请到博客,第一篇随笔(๑•̀ㅂ•́)و✧ 关于DisconnectEx的一个问题,目前主要发现在windows10中出现了这个问题,winserver2008 win7都没有这个问题. 被Disc ...

  4. R-plotly|交互式甘特图(Gantt chart)-项目管理/学习计划

    本文首发于“生信补给站”微信公众号,https://mp.weixin.qq.com/s/CGz51qOjFSJ4Wx_qOMzjiw 更多关于R语言,ggplot2绘图,生信分析的内容,敬请关注小号 ...

  5. 代码审计-MetInfo 6.0.0 sql注入漏洞

    首先漏洞存在于app\system\message\web\message.class.php文件中,变量{$_M[form][id]} 直接拼接在SQL语句中,且验证码检测函数是在SQL语句查询之后 ...

  6. ‎Cocos2d-x 学习笔记(13) ActionEase

    ActionEase是ActionInterval的子类,能够变速执行动作.把内部动作进行了包装,通过传进update的time,加上不同的计算公式,算出新的time,作为内部动作的time,实现了内 ...

  7. TCC推导过程

    svn 账号 yuanzn 密码:TCH5mb 项目分层 MapperDao 数据校验 throw new CloudBaseRuntimeException Helper 数据转换 manager ...

  8. 小程序预览pdf文件

    有个业务需求,需要在小程序查看客户已开的发票 发票地址: https://www.chinaeinv.com/p.jspa?cxxxxxxxxxxxx 刚开始是想利用webview当作外链进行跳转访问 ...

  9. SpringCloud学习--微服务架构

    目录 微服务架构快速指南 SOA Dubbo Spring Cloud Dubbo与SpringCloud对比 微服务(Microservice)架构快速指南 什么是软件架构? 软件架构是一个包含各种 ...

  10. Ubuntu 14.04 sudo免密码的方法| sudo不需要密码

    Ubuntu 14.04 sudo免密码的方法| sudo不需要密码 cd /etc/sudoers.d sudo touch nopasswd4sudo sudo vi nopasswd4sudo ...