http://www.cnblogs.com/liaolongjun/p/5638740.html

http://www.awspack.com/os/linux/yum-install-tomcat/

在服务器跑Java程序的时候,经常用的Web服务器就是Tomcat,今天用yum命令试着安装了一下。

编译安装的时候需要安装JDK和Tomcat,而yum安装Tomcat直接把OpenJDK也给安装上了。

yum安装Tomcat

先查看一下yum安装时的Tomcat版本

 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# yum info tomcat
Loaded plugins: security
Available Packages
Name        : tomcat
Arch        : noarch
Version     : 7.0.33
Release     : 4.el6
Size        : 86 k
Repo        : epel
Summary     : Apache Servlet/JSP Engine, RI for Servlet 3.0/JSP 2.2 API
URL         : http://tomcat.apache.org/
License     : ASL 2.0
Description : Tomcat is the servlet container that is used in the official Reference
            : Implementation for the Java Servlet and JavaServer Pages technologies.
            : The Java Servlet and JavaServer Pages specifications are developed by
            : Sun under the Java Community Process.
            :
            : Tomcat is developed in an open and participatory environment and
            : released under the Apache Software License version 2.0. Tomcat is intended
            : to be a collaboration of the best-of-breed developers from around the world.

Tomcat最新版本是2015/11/24发布的Tomcat8.0.29,而yum安装版本是2012/11/21发布的7.0.33(版本确实低了)。

安装Tomcat

安装Tomcat之后,查看安装的版本。

 
 
1
2
3
4
5
6
7
8
9
10
11
# yum install tomcat
 
# tomcat version
Server version: Apache Tomcat/7.0.33
Server built:   Apr 30 2014 09:16:58
Server number:  7.0.33.0
OS Name:        Linux
OS Version:     2.6.32-573.8.1.el6.x86_64
Architecture:   amd64
JVM Version:    1.8.0_65-b17
JVM Vendor:     Oracle Corporation

安装Tomcat时直接把OpenJDK也安装了

在这里可以看到安装的JDK不是Oracle的JDK而是OpenJDK。

 
 
1
2
3
4
# java -version
openjdk version "1.8.0_65"
OpenJDK Runtime Environment (build 1.8.0_65-b17)
OpenJDK 64-Bit Server VM (build 25.65-b01, mixed mode)

可以使用alternatives切换使用的Java版本。

 
 
1
2
3
4
5
6
7
8
# alternatives --config java
 
There are 2 programs which provide 'java'.
 
  Selection    Command
-----------------------------------------------
   1           /usr/lib/jvm/jre-1.5.0-gcj/bin/java
*+ 2           /usr/lib/jvm/jre-1.8.0-openjdk.x86_64/bin/java

使用Tomcat管理页面

访问Tomcat管理页面(http://localhost:8080/manager/html)需要安装tomcat-admin-webapps和修改tomcat-users.xml文件。

安装tomcat-admin-webapps

 
 
1
# yum install tomcat-admin-webapps

修改tomcat-users.xml文件

修改tomcat-users.xml文件(默认安装目录是/etc/tomcat),添加46-48行的内容。

/etc/tomcat/tomcat-users.xml

 
 
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
42
43
44
45
46
47
48
49
<?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.
-->
<tomcat-users>
<!--
  NOTE:  By default, no user is included in the "manager-gui" role required
  to operate the "/manager/html" web application.  If you wish to use this app,
  you must define such a user - the username and password are arbitrary.
-->
<!--
  NOTE:  The sample user and role entries below are wrapped in a comment
  and thus are ignored when reading this file. Do not forget to remove
  <!.. ..> that surrounds them.
-->
<!--
  <role rolename="tomcat"/>
  <role rolename="role1"/>
  <user username="tomcat" password="tomcat" roles="tomcat"/>
  <user username="both" password="tomcat" roles="tomcat,role1"/>
  <user username="role1" password="tomcat" roles="role1"/>
-->
 
<!-- <role rolename="admin"/> -->
<!-- <role rolename="admin-gui"/> -->
<!-- <role rolename="admin-script"/> -->
<!-- <role rolename="manager"/> -->
<!-- <role rolename="manager-gui"/> -->
<!-- <role rolename="manager-script"/> -->
<!-- <role rolename="manager-jmx"/> -->
<!-- <role rolename="manager-status"/> -->
<!-- <user name="admin" password="adminadmin" roles="admin,manager,admin-gui,admin-script,manager-gui,manager-script,manager-jmx,manager-status" /> -->
<role rolename="admin-gui"/>
<role rolename="manager-gui"/>
  <user username="tomcat" password="tomcat" roles="admin-gui,manager-gui"/>
</tomcat-users>

访问Tomcat管理页面

访问http://localhost:8080/manager/html,并输入48行里设定的username和password,就可以了。

yum安装tomcat的更多相关文章

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

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

  2. Centos7 yum安装tomcat

    以下操作是在线安装apache-tomcat 需要联网下载包. liux系统环境 [root@localhost ~]# cat /etc/redhat-release CentOS Linux re ...

  3. centos7中使用yum安装tomcat以及它的启动、停止、重启

    centos7中使用yum安装tomcat 介绍 Apache Tomcat是用于提供Java应用程序的Web服务器和servlet容器. Tomcat是Apache Software Foundat ...

  4. linux centos中使用yum安装tomcat

    在linux下部署java开发的web应用,一般采用Tomact+jre环境(可不需要apache),在RHEL和CentOS下,可以采用yum在线自动安装方式安装,具体操作如下: 可以先查看tomc ...

  5. centos yum 安装 tomcat

    1.安装 yum install tomcat 2.卸载 yum remove tomcat 3.地址映射 http://localhost:8080/ /usr/share/tomcat/webap ...

  6. yum 安装 tomcat

    前言对于一个新安装的 centos 系统来说,是没有 tomcat 服务器的.用下面的命令可以查看 tomcat 服务的状态. systemctl status tomcat.service//或者 ...

  7. centos7中使用yum安装tomcat mysql 等

    安装Tomcat 进入 # cd /usr/local/tomcat # wget http://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/tomcat-7 ...

  8. 大数据学习——yum安装tomcat

    https://www.cnblogs.com/jtlgb/p/5726161.html 安装tomcat6 yum install tomcat6 tomcat6-webapps tomcat6-a ...

  9. 阿里云,CentOS下yum安装mysql,jdk,tomcat

    首先说明,服务器是阿里云的,centos6.3_64位安全加固版.首先需要登陆进来,使用的是putty,因为最初的时候,Xshell登陆会被拒绝. 0. 创建个人文件夹 # 使用 yum 安装tomc ...

随机推荐

  1. Ubutnu linux 下升级python版本,以2.x升级到3.x为例

    Linux操作系统一般 都会自带python,但是python版本会比主流低,故升级python, 主要思路:自带的python的链接link文件是在/usr/bin 下,采用sudo apt-get ...

  2. 一本通1626【例 2】Hankson 的趣味题

    1626:[例 2]Hankson 的趣味题 题目描述 Hanks 博士是BT (Bio-Tech,生物技术) 领域的知名专家,他的儿子名叫Hankson.现在,刚刚放学回家的Hankson 正在思考 ...

  3. LOJ 530 最小倍数(数论)

    题意 有\(T\)组数据. 给定\(p\),求最小的正整数\(n\),使得\(n!\%p=0\). 由于\(p\)很大,输入将给出\(m\)和\(e_1,e_2...e_m\),表示\(p=\prod ...

  4. Codeforces Round #528 Div. 1 自闭记

    整天自闭. A:有各种讨论方式.我按横坐标排了下然后讨论了下纵坐标单调和不单调两种情况.写了15min也就算了,谁能告诉我printf和cout输出不一样是咋回事啊?又调了10min啊?upd:突然想 ...

  5. 牛客网-湘潭大学校赛重现H题 (线段树 染色问题)

    链接:https://www.nowcoder.com/acm/contest/105/H来源:牛客网 n个桶按顺序排列,我们用1~n给桶标号.有两种操作: 1 l r c 区间[l,r]中的每个桶中 ...

  6. HGOI20180812 (NOIP2018 提高组 Day1 模拟试题)

    前缀数组其实就是有序的,那么答案显然是      我们尝试求出通项公式: 证明如下: 因为 所以: 解之得: 更加通俗的写法如下: 易知  令 那么, (错位相减) 由易知等式代入得, 所以, 所以程 ...

  7. diyiti.cpp

    diyiti.cpp/c/pas diyiti.in diyiti.out 2s/256MB 给定两个01串,S,T(下标从0开始). 支持如下3种操作: 1. 修改S第i位的字符,即0->1, ...

  8. 洛谷 P2671 求和 解题报告

    P2671 求和 题目描述 一条狭长的纸带被均匀划分出了\(n\)个格子,格子编号从\(1\)到\(n\) .每个格子上都染了一种颜色\(color_i\)用\([1,m]\)当中的一个整数表示),并 ...

  9. 【bzoj3576】 Hnoi2014—江南乐

    http://www.lydsy.com/JudgeOnline/problem.php?id=3576 (题目链接) 题意 给出一个数$F$,然后$n$堆石子,每次操作可以把一堆不少于$F$的石子分 ...

  10. root和alias的区别

    先来看看官方说明: root 的用法: location /request_path/image/ { root /local_path/; } 当客户端请求 /request_path/image/ ...