diff --git a/docs/installation.rst b/docs/installation.rst index d157aec..259c0d1 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -9,13 +9,15 @@ When running docker image, no special installation is needed -- the docker will Just run ``docker run -it -v $(pwd):/data -p 8080:80 klokantech/tileserver-gl``. -Additional options (see :doc:`/usage`) can be passed to the TileServer GL by appending them to the end of this command. You can, for example, do the following: +Additional options (see usage_) can be passed to the TileServer GL by appending them to the end of this command. You can, for example, do the following: + +.. _usage: https://github.com/klokantech/tileserver-gl/blob/master/docs/usage.rst * ``docker run ... klokantech/tileserver-gl my-tiles.mbtiles`` -- explicitly specify which mbtiles to use (if you have more in the folder) * ``docker run ... klokantech/tileserver-gl --verbose`` -- to see the default config created automatically -npm -=== +Using npm +============= Just run ``npm install -g tileserver-gl``. @@ -31,28 +33,57 @@ These are required on Debian 9: * ``libcairo2-dev`` * ``libprotobuf-dev`` +Installing on CentOS +---------------------- + +CentOS requires additional alterations, since dependencies like mapbox-gl-native require the a more recent version of gcc/g++ libraries than what CentOS upgrades provide. Detailed instructions for installing Tileserver-GL on CentOS can be found here_. + +.. _here: https://github.com/klokantech/tileserver-gl/blob/master/docs/installation_centos.rst + + ``tileserver-gl-light`` on npm -============================== +----------------------------------- Alternatively, you can use ``tileserver-gl-light`` package instead, which is pure javascript (does not have any native dependencies) and can run anywhere, but does not contain rasterization features. +Build from source +======================= -From source -=========== - -Make sure you have Node v4 (nvm install 4) and run:: +Make sure you have Node v4 (nvm_ install 4) and run:: npm install node . +.. _nvm: + +On Ubuntu +------------ +Tested on Ubuntu 16.04 with node v4.2.6:: + + + sudo apt-get install -y software-properties-common protobuf-compiler pkg-config libcairo2-dev libjpeg-dev libgif-dev git libgl1-mesa-glx build-essential g++ curl + + curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash - + sudo apt-get install -y nodejs xvfb + + sudo mkdir /var/cache/npm + sudo npm config set cache /var/cache/npm --global + + cd /tmp + git clone https://github.com/klokantech/tileserver-gl.git + cd tileserver-gl/ + + sudo npm install -g --unsafe-perm + + On OSX -====== +------- Make sure to have dependencies of canvas_ package installed:: brew install pkg-config cairo libpng jpeg giflib - .. _canvas: https://www.npmjs.com/package/canvas + diff --git a/docs/installation_centos.rst b/docs/installation_centos.rst new file mode 100644 index 0000000..3cfa546 --- /dev/null +++ b/docs/installation_centos.rst @@ -0,0 +1,101 @@ +====================================== +Installing Tileserver-GL on CentOS 7 +====================================== + +Mapbox-GL-native requires a more recent version of gcc/g++ libraries than is packaged with CentOS7 updates, so installation needs to be done a little differently. This assumes you're working on a fresh CentOS instance. + +--------- + +First Add EPEL repo for extra packages:: + + #!/usr/bin/env bash + sudo yum -y install epel-release + +Update and upgrade your system:: + + sudo yum -q -y update + sudo yum -q -y upgrade + + +Now install Node v4.X. This can be done through nvm, but if you are starting on a fresh instance, this will do the trick to setup the NodeJsv4.X repo:: + + curl -sL https://rpm.nodesource.com/setup_4.x | sudo bash - + +Install necessary dependencies. +NOTE: We probably dont need all of these. There are a few left over from the initial Centos testing.:: + + sudo yum -y -q install \ + autoconf \ + automake \ + cairo \ + cairo-devel \ + cairomm-devel \ + cmake3 \ + curl \ + gcc \ + gcc-c++ \ + giflib-devel \ + git \ + git-core \ + libcurl \ + libjpeg-turbo-devel \ + mesa-dri-drivers \ + nodejs-4.2.5 \ + nodejs-devel-4.2.5 \ + pango \ + pango-devel \ + pangomm \ + pangomm-devel \ + protobuf \ + protobuf-compiler \ + protobuf-devel \ + xorg-x11-server-Xvfb + +Add the fedora repo to get updated versions of gcc & g++ + +**IMPORTANT NOTE: Don't do a system update after enableing this repo. It will get UGLY really fast.**:: + + echo "[warning:fedora]" | sudo tee /etc/yum.repos.d/FedoraRepo.repo + echo "name=fedora" | sudo tee -a /etc/yum.repos.d/FedoraRepo.repo + echo "mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=fedora-23&arch=\$basearch" | sudo tee -a /etc/yum.repos.d/FedoraRepo.repo + echo "enabled=1" | sudo tee -a /etc/yum.repos.d/FedoraRepo.repo + echo "gpgcheck=1" | sudo tee -a /etc/yum.repos.d/FedoraRepo.repo + echo "gpgkey=https://getfedora.org/static/34EC9CBA.txt" | sudo tee -a /etc/yum.repos.d/FedoraRepo.repo + + +Get new versions of gcc & g++:: + + sudo yum -y update gcc g++ + +Potentially unnecessary step:: + + sudo alternatives --install /usr/bin/cmake qmake /usr/bin/cmake3 500 + +This stops tileserver-gl complaining about a missing library:: + + sudo ln -s /lib64/libcurl.so.4.3.0 /lib64/libcurl-gnutls.so.4.3.0 + sudo ln -s /lib64/libcurl.so.4.3.0 /lib64/libcurl-gnutls.so.4 + + +Change permissions blocking tileserver from accessing dependencies... + +*This is seriously UGLY and a security problem but it gets around errors with "npm -g"*:: + + sudo chmod -R 777 /usr/lib/node_modules/ + sudo chmod o+w /usr/bin + + +Install tileserver from npm:: + + npm install -g tileserver-gl + + +Grab the tileserver demo data:: + + curl -o zurich_switzerland.mbtiles https://openmaptiles.os.zhdk.cloud.switch.ch/v3.3/extracts/zurich_switzerland.mbtiles + + +Use xvfb to run the tile server manually:: + + xvfb-run -s "-screen 0 1024x768x24 +extension GLX" /usr/bin/tileserver-gl --verbose +