天天看点

Centos7安装tomcat,下载geoserve,配置tomcat,发布geoserve

本文是元宇宙时空大数据平台开发的一些经历,环境是已经安装好了Hadoop的三台服务器,包括一台主机。

一、安装tomcat

原本可以使用yum -y install tomcat直接安装很难下载需要的资源:在我的服务器上经常会显示尝试其他镜像,处理方法是

Centos7安装tomcat,下载geoserve,配置tomcat,发布geoserve

先在本机下载好tomcat再上传到服务器。

下载路径是Index of /dist/tomcat/tomcat-8/v8.5.4/bin (apache.org)

下载apache-tomcat-8.5.4.tar.gz    

Centos7安装tomcat,下载geoserve,配置tomcat,发布geoserve

等待下载完毕之后,打开Xshell,开始文件传输,连接上服务器。

文件传输有两种方式,第一种是

连接之后可以执行命令:

Centos7安装tomcat,下载geoserve,配置tomcat,发布geoserve

然后输入rz进行文件传输。

这里使用另一种方法,点击工具栏的“新建文件传输”。

Centos7安装tomcat,下载geoserve,配置tomcat,发布geoserve

将下载好的apache-tomcat-8.5.4.tar.gz   文件传到/usr/local文件下。

Centos7安装tomcat,下载geoserve,配置tomcat,发布geoserve

在命令行中输入:

Centos7安装tomcat,下载geoserve,配置tomcat,发布geoserve

启动tomcat输入/usr/local/tomcat/bin/startup.sh

终止输入/usr/local/tomcat/bin/shutdown.sh

服务器的防火墙没有启动,这里不配置防火墙了。

测试一下:访问http://125.221.232.241:8080/可以看到界面:(8080前面的IP修改成对应自己服务器的IP就行)

Centos7安装tomcat,下载geoserve,配置tomcat,发布geoserve

二、下载geoserver

访问

Download GeoServer from SourceForge.net,下载然后解压。

同样使用之前按的方法,使用Xftp,找到解压文件夹下的geoserver.war文件,放到/usr/local/tomcat/webapps文件下

Centos7安装tomcat,下载geoserve,配置tomcat,发布geoserve

进入8080,点击Manager App

Centos7安装tomcat,下载geoserve,配置tomcat,发布geoserve

管理页面会报错:tomcat管理页面403 Access Denied,是因为tomcat本来的配置限制了user的访问。

三、配置tomcat

首先在conf/tomcat-users.xml文件里面,修改所有代码:(其中高亮的username和password都是后面用得到的,这里可以进行修改,后面记住就行)

<?xml version='1.0' encoding='cp936'?>
<!--
  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 xmlns="http://tomcat.apache.org/xml"
              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:schemaLocation="http://tomcat.apache.org/xml tomcat-users.xsd"
              version="1.0">
<user username="admin" password="admin" roles="manager-gui" />
<!--
  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.

  Built-in Tomcat manager roles:
    - manager-gui    - allows access to the HTML GUI and the status pages
    - manager-script - allows access to the HTTP API and the status pages
    - manager-jmx    - allows access to the JMX proxy and the status pages
    - manager-status - allows access to the status pages only

  The users below are wrapped in a comment and are therefore ignored. If you
  wish to configure one or more of these users for use with the manager web
  application, do not forget to remove the <!.. ..> that surrounds them. You
  will also need to set the passwords to something appropriate.
-->
<!--
  <user username="admin" password="<must-be-changed>" roles="manager-gui"/>
  <user username="robot" password="<must-be-changed>" roles="manager-script"/>
-->
<!--
  The sample user and role entries below are intended for use with the
  examples web application. They are wrapped in a comment and thus are ignored
  when reading this file. If you wish to configure these users for use with the
  examples web application, do not forget to remove the <!.. ..> that surrounds
  them. You will also need to set the passwords to something appropriate.
-->
<!--
  <role rolename="tomcat"/>
  <role rolename="role1"/>
  <user username="tomcat" password="<must-be-changed>" roles="tomcat"/>
  <user username="both" password="<must-be-changed>" roles="tomcat,role1"/>
  <user username="role1" password="<must-be-changed>" roles="role1"/>
-->
</tomcat-users>
           

更改登录manager的账号和密码都是admin,然后修改/webapps/manager/META-INF/目录下context.xml文件中有关Valve的内容:

<Valve className="org.apache.catalina.valves.RemoteAddrValve"  
    allow="127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1|\d+\.\d+\.\d+\.\d+" />  
           

此时可以访问manager app了,点击geoserve。

Centos7安装tomcat,下载geoserve,配置tomcat,发布geoserve

注册就能使用了。

Centos7安装tomcat,下载geoserve,配置tomcat,发布geoserve