About 4 years ago we wrote a post about setting up a map server with Mapnik and PostGIS. It's still one of the most popular posts on the site but it's VERY OLD. I wanted to update it with a slightly easier install method and some newer software. What's in the stack? I'm glad you asked!
Unlike the previous guide, this one won't cover basics of Linux and the command line. It's also written for a Red Hat Enterprise Linux (RHEL) 7.2 server instead of Ubuntu. Let's do it.
Provision the server
The first thing we need to do is provision a Red Hat Enterprise Linux server. Amazon EC2 is as good a place as any to do this, but feel free to use any server you'd like. A few things to keep in mind:
You need at least 2GB of memory. On EC2, that's a medium instance
Make sure you open up at least port 22 so you can access the server via SSH. If you'd like, you can also open up port 5432 for remote Postgres access and 8000 (or anything you'd like) to access services you create via the web.
If you are running this on EC2 and you create your PEM key to log into the server, don't forget to chmod 400 to allow you to use it to login. Also, your username on EC2 is going to be ec2-user.
Login to the server via SSH
nce you're all logged in, run a quick software update to make sure everything is up to date:
sudo yum update
Great. We're like 20% of the way there now. I told you this was going to be easy. Next step is to install Git and clone the install script:
While the install script was running, I hope you walked away to get a coffee and a snack. If so, you missed any error messages that might have appeared. Just in case there were some problems, let’s run a quick test.
If you did stick around, you may have noticed that the vector tile tests for node-mapnik failed so this installation won’t support vector tiles generation from Mapnik. If you’d like to investigate / fix the problem, please fork the Gist and I’ll update the post to point to yours. If you’d like to see the results of that test again run npm-test from the node-mapnik directory.
For the tests, we’ll use the node-mapnik-sample-code. There are lots of tests and sample code, so it’s a good place to poke around once you’re up and running. First, clone the code onto the server: