curl -ks https://gist.github.com/rnix/5929348/raw/up | bash - && cd mapnik && vagrant ssh
Last active
December 19, 2015 08:59
-
-
Save rnix/5929348 to your computer and use it in GitHub Desktop.
Vagrant mapnik : ubuntu precise64 virtualbox
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Sourced from bootstrap.sh. | |
nginx | |
i curl | |
i g++ | |
i git | |
i libspatialite-dev | |
i sqlite3 | |
i python2.7-dev | |
i python-pip | |
# for PIL | |
i libjpeg8 | |
i libjpeg62-dev | |
i libfreetype6 | |
i libfreetype6-dev | |
ppa ubuntugis/ppa | |
i libgdal-dev | |
i gdal-bin | |
i python-gdal | |
ppa mapnik/v2.2.0 | |
i libmapnik | |
i mapnik-utils | |
i python-mapnik | |
# Fix PIL. Ubuntu 11 but still seems to be a problem in 12.04 | |
# http://obroll.com/install-python-pil-python-image-library-on-ubuntu-11-10-oneiric/ | |
ln -s /usr/lib/x86_64-linux-gnu/libjpeg.so /usr/lib | |
ln -s /usr/lib/x86_64-linux-gnu/libfreetype.so /usr/lib | |
ln -s /usr/lib/x86_64-linux-gnu/libz.so /usr/lib | |
p PIL | |
p modestmaps | |
p simplejson | |
p werkzeug | |
p tilecache | |
p tilestache | |
p pyproj | |
p shapely | |
[ -d TileStache ] || git clone https://github.com/migurski/TileStache.git | |
export CPLUS_INCLUDE_PATH=/usr/include/gdal | |
p gdal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Sourced from bootstrap.sh. | |
# Verification of the installations: | |
mapnik-config -v | grep '^2[.]2' || exit ${LINENO} | |
for py in mapnik osgeo shapely pyproj; do | |
python -c "import ${py};print ${py}.__file__" || exit ${LINENO} | |
done | |
# Just some final reporting and linking. It's not part of the actual installation. | |
IP=$(awk -F'[ "]+' '(/private_network/ && !/^[ \t]+#/) {print $5}' /vagrant/Vagrantfile) | |
[ "${IP}" ] && ( | |
cd /vagrant | |
rm -f ${IP} | |
ln -s Vagrantfile ${IP} | |
curl -i http://${IP} | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
exec >/vagrant/$(basename ${0}).log 2>&1 | |
set -xv | |
NOWS=$(date +%s) | |
NOW=$(date +%Y%m%dt%H%M%S) | |
# Some setup. | |
g() { c=${1}; shift; apt-get ${c} -y ${*}; } | |
u() { g update; } | |
i() { g install ${*}; } | |
p() { pip install -U ${*}; } | |
# This is a hack. For some reason, grub compains during apt-get. | |
# Tried https://github.com/mitchellh/vagrant/issues/289#issuecomment-11073577 but it clearly doesn't solve the issue. | |
# Trying https://github.com/mitchellh/vagrant/issues/289#issuecomment-12408200 | |
fix-grub() { | |
g remove grub-pc | |
g install grub-pc </dev/null >/dev/null 2>&1 | |
grub-install /dev/sda | |
update-grub | |
DEBIAN_FRONTEND=noninteractive apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" dist-upgrade | |
} | |
init() { u; ${1:-true}; g upgrade; } | |
pyp() { i python-software-properties software-properties-common; } | |
ppa() { pyp; add-apt-repository -y ppa:${1} && u; } | |
nginx() { | |
i ${FUNCNAME} | |
rm -rf /usr/share/nginx/www /var/www | |
ln -fs /vagrant /usr/share/nginx/www | |
ln -s /usr/share/nginx/www /var/www | |
perl -pi -e 's/(sendfile o)n;/$1ff;/' /etc/nginx/nginx.conf | |
echo "Hello, Vagrant! Installed ${NOW}" >/vagrant/index.html | |
service nginx restart | |
} | |
init fix-grub | |
# Ensure VirtualBox Guest Additions is running, otherwise, rebuild it | |
lsmod | grep vboxsf || { | |
i build-essential | |
/etc/init.d/vboxadd setup | |
mount -t vboxsf -o uid=`id -u vagrant`,gid=`id -g vagrant` /vagrant /vagrant | |
} | |
source /vagrant/bootstrap-install.sh | |
source /vagrant/bootstrap-test.sh | |
g autoremove | |
echo boostrap completed in $[$(date +%s) - NOWS]s at $(date +%Y%m%dt%H%M%S) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
which vagrant >/dev/null 2>&1 || exit ${LINENO} | |
vboxwebsrv --version 2>&1 | grep "4.2.12" >/dev/null 2>&1|| exit ${LINENO} | |
[ $(basename ${PWD}) = 'mapnik' ] || [ -d .vagrant ] || { | |
git clone https://gist.github.com/5929348.git mapnik && { | |
cd mapnik || exit ${LINENO} | |
} | |
} | |
vagrant up |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
Vagrant.configure("2") do |config| | |
config.vm.box = "precise64" | |
config.vm.box_url = "http://files.vagrantup.com/precise64.box" | |
config.vm.provision :shell, :path => "bootstrap.sh" | |
config.vm.network :private_network, ip: "10.1.11.201", netmask: "255.255.0.0" | |
config.vm.provider :virtualbox do |vb| | |
vb.customize ["modifyvm", :id, "--memory", "2048"] | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment