环境介绍:
CentOS 7.5
Java 1.8.0
Geoserver 2.17.2
GeoServer 2.17.2下载:
https://nchc.dl.sourceforge.net/project/geoserver/GeoServer/2.17.2/geoserver-2.17.2-bin.zip
安装部署
1.确保在系统上安装了Java Runtime Environment(JRE)。GeoServer需要Java 8或Java 11环境,可从OpenJDK,AdoptOpenJDK获得或由您的OS发行版提供。
[root@test ~]# yum install java-1.8.0-openjdk [root@test ~]# java -version openjdk version "1.8.0_262" OpenJDK Runtime Environment (build 1.8.0_262-b10) OpenJDK 64-Bit Server VM (build 25.262-b10, mixed mode)
2.下载GeoServer
[root@test ~]# yum -y install wget [root@test ~]# wget https://nchc.dl.sourceforge.net/project/geoserver/GeoServer/2.17.2/geoserver-2.17.2-bin.zip [root@test ~]# ls anaconda-ks.cfg geoserver-2.17.2-bin.zip
3.解压下载好的GeoServer安装包到指定目录
建议的位置为/usr/share/geoserver
。
[root@test ~]# yum search unzip 已加载插件:fastestmirror Loading mirror speeds from cached hostfile * base: mirrors.tuna.tsinghua.edu.cn * extras: mirrors.tuna.tsinghua.edu.cn * updates: mirrors.aliyun.com ================================ N/S matched: unzip ================================= unzip.x86_64 : A utility for unpacking zip files [root@test ~]# yum -y install unzip [root@test ~]# mkdir /usr/share/geoserver //建议的位置为/usr/share/geoserver。 [root@test ~]# unzip geoserver-2.17.2-bin.zip -d /usr/share/geoserver/ [root@test ~]# ll -h /usr/share/geoserver/ 总用量 268K drwxr-xr-x. 2 root root 82 7月 22 09:53 bin drwxr-xr-x. 14 root root 4.0K 7月 22 09:53 data_dir drwxr-xr-x. 2 root root 276 5月 19 15:23 etc drwxr-xr-x. 2 root root 4.0K 7月 22 09:53 lib drwxr-xr-x. 2 root root 98 7月 22 09:53 license drwxr-xr-x. 2 root root 24 5月 19 15:23 logs drwxr-xr-x. 2 root root 173 5月 19 15:23 modules -rw-r--r--. 1 root root 84K 7月 20 02:12 NOTICE.md -rw-r--r--. 1 root root 423 5月 19 15:23 README.txt drwxr-xr-x. 2 root root 30 5月 19 15:23 resources -rw-r--r--. 1 root root 3.9K 7月 20 02:12 RUNNING.txt -rw-r--r--. 1 root root 2.0K 5月 19 15:23 start.ini -rw-r--r--. 1 root root 157K 5月 19 15:23 start.jar -rw-r--r--. 1 root root 333 7月 22 09:44 VERSION.txt drwxr-xr-x. 3 root root 23 7月 22 09:53 webapps
4.添加环境变量以保存GeoServer的位置
[root@test ~]# echo "export GEOSERVER_HOME=/usr/share/geoserver" >> /etc/profile [root@test ~]# source /etc/profile [root@test ~]# cat /etc/profile | tail -2 unset -f pathmunge export GEOSERVER_HOME=/usr/share/geoserver
5.使自己成为geoserver文件夹的所有者
[root@test ~]# chown -R root:root /usr/share/geoserver/ [root@test ~]# ll /usr/share/geoserver/ 总用量 268 drwxr-xr-x. 2 root root 82 7月 22 09:53 bin drwxr-xr-x. 14 root root 4096 7月 22 09:53 data_dir drwxr-xr-x. 2 root root 276 5月 19 15:23 etc drwxr-xr-x. 2 root root 4096 7月 22 09:53 lib drwxr-xr-x. 2 root root 98 7月 22 09:53 license drwxr-xr-x. 2 root root 24 5月 19 15:23 logs drwxr-xr-x. 2 root root 173 5月 19 15:23 modules -rw-r--r--. 1 root root 85824 7月 20 02:12 NOTICE.md -rw-r--r--. 1 root root 423 5月 19 15:23 README.txt drwxr-xr-x. 2 root root 30 5月 19 15:23 resources -rw-r--r--. 1 root root 3945 7月 20 02:12 RUNNING.txt -rw-r--r--. 1 root root 1971 5月 19 15:23 start.ini -rw-r--r--. 1 root root 160629 5月 19 15:23 start.jar -rw-r--r--. 1 root root 333 7月 22 09:44 VERSION.txt drwxr-xr-x. 3 root root 23 7月 22 09:53 webapps
6.通过进入目录geoserver/bin并执行startup.sh脚本来启动GeoServer
[root@test ~]# cd /usr/share/geoserver/bin/ [root@test bin]# ls shutdown.bat shutdown.sh startup.bat startup.sh [root@test bin]# ./startup.sh GEOSERVER DATA DIR is /usr/share/geoserver/data_dir 2020-08-13 20:39:16.372:INFO::main: Logging initialized @1692ms to org.eclipse.jetty.util.log.StdErrLog 2020-08-13 20:39:16.840:WARN:oejx.XmlConfiguration:main: Property 'jetty.port' is deprecated, use 'jetty.http.port' instead ... [root@test ~]# ss -antulp | grep :8080 //新开命令窗口查询,因为执行start.sh脚本没放入后台,会一直占用终端窗口 tcp LISTEN 0 50 :::8080 :::* users:(("java",pid=5791,fd=313))
访问GeoServer
http://服务器IP地址:8080/geoserver
默认的用户名 :admin 和 密码:geoserver 登录后,进入主界面
要关闭GeoServer,请关闭永久命令行窗口,或运行bin目录中的shutdown.sh
文件。
卸载
如果正在运行,请先停止GeoServer。
删除安装GeoServer的目录。