Skip to content

Install Streaming (Ubuntu 16.04)

Jonathan Beliën edited this page Nov 9, 2018 · 5 revisions

The purpose to this server is to stream pre-rendered tiles.
The tiles for https://tile.osm.be/ are rendered on another server.

Requirements

  • Server with at least 4Go RAM
  • Ubuntu 16.04 (obviously)

Update operating system

Just to be sure everything is up to date :

sudo apt-get update
sudo apt-get dist-upgrade

And restart your server :

sudo reboot

Mount external drives

For https://tile.osm.be/ case, I use external drives to host the tiles. You can probably skip this step !

  1. List devices :

     sudo fdisk -l /dev/sd*
    
  2. Create new partition :

     sudo parted /dev/sdb
    

    And run following commands :

     mktable gpt
     mkpart primary ext4 512 100%
     quit
    
  3. Create ext4 filesystem :

     sudo mkfs.ext4 /dev/sdb1
    
  4. Mount new drive :

     sudo mkdir /mnt/osmbe
     sudo mount /dev/sdb1 /mnt/osmbe/
    
  5. Check if everything is good :

     sudo fdisk -l /dev/sd*
    
  6. Get drive UUID :

     sudo blkid
    
  7. Add the new drive to /etc/fstab by adding following line :

    UUID=##### /mnt/osmbe ext4 nofail 0 0
    
  8. Reboot :

     sudo reboot
    

Install

Install required softwares and libraries

sudo apt-get install git build-essential autoconf \
                     apache2 apache2-dev \
                     libtool libmapnik-dev \
                     munin

Install mod_tile

sudo mkdir /var/lib/mod_tile
sudo chown $USER /var/lib/mod_tile

git clone git://github.com/SomeoneElseOSM/mod_tile.git
cd mod_tile
./autogen.sh
./configure
make
sudo make install
sudo make install-mod_tile
sudo ldconfig

Create mod_tile module for Apache

Create /etc/apache2/mods-available/tile.load file :

LoadModule tile_module /usr/lib/apache2/modules/mod_tile.so

Create /etc/apache2/mods-available/tile.conf file :

<IfModule tile_module>
   LoadTileConfigFile /usr/local/etc/renderd.conf
   ModTileRenderdSocketName /var/run/renderd/renderd.sock
   # Timeout before giving up for a tile to be rendered
   ModTileRequestTimeout 0
   # Timeout before giving up for a tile to be rendered that is otherwise missing
   ModTileMissingRequestTimeout 30
</IfModule>

Update mod_tile configuration file :

Add following to file /usr/local/etc/renderd.conf :

[osmbe]
URI=/osmbe/
TILEDIR=/var/lib/mod_tile
XML=/home/ubuntu/src/openstreetmap-carto-be/mapnik.xml
HOST=localhost
TILESIZE=256
MAXZOOM=20
CORS=*

[osmbe-fr]
URI=/osmbe-fr/
TILEDIR=/var/lib/mod_tile
XML=/home/ubuntu/src/openstreetmap-carto-be/mapnik-fr.xml
HOST=localhost
TILESIZE=256
MAXZOOM=20
CORS=*

[osmbe-nl]
URI=/osmbe-nl/
TILEDIR=/var/lib/mod_tile
XML=/home/ubuntu/src/openstreetmap-carto-be/mapnik-nl.xml
HOST=localhost
TILESIZE=256
MAXZOOM=20
CORS=*

Enable mod_tile :

sudo a2enmod tile
sudo service apache2 restart