一键发布离线地图

离线地图服务器Linux部署指南

Bigemap离线地图发布服务器 for Linux

当前版本:v0.2.6

一站式搭建离线地图服务器,支持多种地图离线发布;提供快速WEB应用、WMTS、TMS等服务;支持二次开发调用;

系统要求

Bigemap Server 支持以下操作系统:

* 部署到 Windows 系统直接下载安装程序。部署到 Linux 系统按照以下步骤。

安装依赖项

在安装Bigemap Server之前,需要安装一下依赖项:

Wget、OpenSSL及unzip都是Bigemap Server安装脚本所需,Docker和Docker Compose是服务运行、集成容器。

CentOS 7

# Most of these commands need to be run by the root user
$ sudo su

$ yum check-update
$ yum install -y epel-release
$ yum install -y wget openssl python-pip unzip

# Install Docker
$ curl -fsSL https://get.docker.com/ | sh

# Add your user to the Docker group. i.e. centos
$ usermod -aG docker <your-user-name>

# Enable the Docker daemon to start at system boot
$ systemctl enable docker.service

# Start the Docker daemon
$ systemctl start docker.service

# Install Docker Compose
$ pip install docker-compose

Ubuntu 14.04

# Update the package database
$ sudo apt-get update

# Install Docker and Server dependencies
$ sudo apt-get install \
    linux-image-extra-$(uname -r) \
    linux-image-extra-virtual \
    apt-transport-https \
    ca-certificates \
    curl \
    software-properties-common \
    docker-ce \
    wget \
    openssl \
    unzip

# Add the Docker repository to APT sources
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
$ sudo add-apt-repository \
   "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
   $(lsb_release -cs) \
   stable"

# Update the package database with the Docker packages
$ sudo apt-get update

# Install Docker
$ sudo apt-get install -y docker-ce

# Add your user to the Docker group. i.e. ubuntu
$ sudo usermod -aG docker <your-user-name>

# Check the current release and, if necessary, update it in the command below
$ sudo curl -L \
    https://github.com/docker/compose/releases/download/1.18.0/docker-compose-`uname -s`-`uname -m` \
    -o /usr/local/bin/docker-compose

# Set execute permissions on docker-compose
$ sudo chmod +x /usr/local/bin/docker-compose

Ubuntu 16.04

# Update the package database
$ sudo apt-get update

# Install Docker and Server dependencies
$ sudo apt-get install -y wget openssl unzip

# Add the Docker repository to APT sources
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
$ sudo add-apt-repository \
   "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
   $(lsb_release -cs) \
   stable"

# Update the package database with the Docker packages
$ sudo apt-get update

# Make sure you are about to install from the Docker repo
$ sudo apt-cache policy docker-ce

# Install Docker
$ sudo apt-get install -y docker-ce

# Add your user to the docker group. i.e. ubuntu
$ sudo usermod -aG docker <your-user-name>

# Check the current release and, if necessary, update it in the command below
$ sudo curl -L \
    https://github.com/docker/compose/releases/download/1.18.0/docker-compose-`uname -s`-`uname -m` \
    -o /usr/local/bin/docker-compose

# Set execute permissions on docker-compose
$ sudo chmod +x /usr/local/bin/docker-compose

银河麒麟 Kyline 4.0.2 server sp2

# Update the package database
$ sudo apt-get update

# Install Docker and Server dependencies
$ sudo apt-get install -y wget openssl unzip

# Install Docker
$ curl -fsSL https://get.docker.com/ | sh

# Add your user to the docker group. i.e. ubuntu
$ sudo usermod -aG docker <your-user-name>

# Enable the Docker daemon to start at system boot
$ sudo systemctl enable docker

# Start the Docker daemon
$ sudo systemctl start docker

# Check the current release and, if necessary, update it in the command below
$ sudo curl -L \
    https://github.com/docker/compose/releases/download/1.18.0/docker-compose-`uname -s`-`uname -m` \
    -o /usr/local/bin/docker-compose

# Set execute permissions on docker-compose
$ sudo chmod +x /usr/local/bin/docker-compose

安装 Bigemap Server

Bigemap Server Installer

Bigemap Server installer是命令行脚本(CLI)程序用于下载、安装Bigemap Server。

安装命令

命令 需要联网 描述
install 自动下载并安装Bigemap Server
download 下载Bigemap Server
setup 安装Bigemap Server
list 查看发布的历史版本
remove 卸载Bigemap Server

下载 Installer

  1. 下载安装脚本:wget http://download.bigemap.com/bm-server/linux/bm-server-installer.zip (点击下载)
  1. 解压下载的zip文件: unzip bm-server-installer.zip
  1. 修改执行权限:chmod +x ./bm-server-installer
  1. 查看命令帮助:./bm-server-installer help

一步安装

一步安装将自动下载并安装最新发布本版,需本机联网部署。

# Install Bigemap server, 'bm-server/' is the installation path.
$ sudo ./bm-server-installer install bm-server/

# Enter installation path
$ cd bm-server

# Start Bigemap server
$ ./bm-server.sh start

服务管理

# Restart Bigemap server
$ ./bm-server.sh restart

# Stop Bigemap server
$ ./bm-server.sh stop

# Show logs
$ ./bm-server.sh logs

离线安装

离线部署首先需手动下载并安装依赖项,才进行此离线安装步骤。按以下步骤进行,首先下载所需文件,然后将bm-server-installer以及下载目录bm-server-files一并拷贝到离线服务器上,最后执行setup命令安装。

下载Bigemap Server

download命令将Bigemap Server所需文件下载一个指定目录,后续将在setup命令中使用。

# Download Bigemap Server, 'bm-server-files/' is the directory where the downloaded files will be saved。
$ ./bm-server-installer download bm-server-files/
选项

安装Bigemap Server

在将运行Bigemap Server的服务器上执行setup命令。其中参数bm-server-files/download命令下载所需的文件;参数bm-server/是目标安装目录。

$ ./bm-server-installer setup bm-server-files/ bm-server/

安装完成后,执行bm-server.sh启动服务:

$ (cd bm-server && ./bm-server.sh start)

查看可用版本

list命令列出了所有可下载的Bigemap Server版本。 通过bm-server.sh查看当前安装的版本:

$ ./bm-server.sh version

查看所有可下载版本:

$ ./bm-server-installer list

通过download命令并指定--version参数下载指定的Bigemap Server版本。

$ ./bm-server-installer download bm-server-files/ --version <bm-server-version>

配置 Bigemap Server

Bigemap Server采用JSON文件配置,默认配置文件在bm-server-installer目录中。Linux默认配置如下:

{
  "Hostname": "localhost",
  "Port": 3000,
  "ServicePort": 3001,
  "Password": "password",
  "TilesetPath": "./tilesets"
}

配置选项

  1. Hostname服务主机名。
  1. Port服务端口,默认3000。
  1. ServicePort地图瓦片服务端口,默认3001;与服务端口不能相同。
  1. Password登录服务管理密码,远程访问服务管理需登录,建议修改密码
  1. TilesetPath地图瓦片服务根目录,添加离线地图服务可浏览该目录下文件。

配置命令

修改配置文件后,通过settings命令应用配置。

$ ./bm-server-installer settings <target> --config <path to JSON file>
参数

示例

# Update the server config
$ ./bm-server-installer settings bm-server/ --config ./config.json

# Restart Bigemap Server
$ (cd bm-server && ./bm-server.sh restart)

配置Https/Http

可以将BIgemap Server配置为使用Https进行通信以提高安全性。 在生产中,证书文件应由受信任的证书颁发机构签名。为了便于测试,提供了一个脚本来生成自签名证书。

配置证书文件

$ ./bm-server-installer settings <target> --ssl-key <path to pkey file> --ssl-cert <path to cert file>
参数

示例

# Use the certificate file
$ ./bm-server-installer settings bm-server/ --ssl-key ./cert/pri.key --ssl-cert ./cert/cert.crt

# Use self-signed certificate
$ ./bm-server-installer settings bm-server/ --self-signed

# Switch to HTTP
$ ./bm-server-installer settings bm-server/ --http

# Restart Bigemap Server
$ (cd bm-server && ./bm-server.sh restart)