User:Mac

From OpenStreetMap Wiki
Jump to: navigation, search

Creating an applicance

Install VMWare Server

Get a registration key

Get a (free) registration key on [VMWare's website]

Get and install VMWare server

Download VMWare server from [VMWare] Installation is not covered in this document

Create an empty VMWare image

  • Start VMWare:
sudo vmware
  • Connect to localhost
  • Create a new virtual machine
  • Start a typical creation - all the options are the default options, except:
    • Guest OS is Linux, Version is Other Linux 2.6 kernel
    • Select an installation path where you have at least 10 GB of free space
    • Do NOT allocate all disk space now

Install Debian

Get the netboot iso

Download the netboot image from Debian's website (total size is about 6 MB):

wget http://people.debian.org/~joeyh/d-i/images/daily/netboot/mini.iso

Boot on the iso

Edit the setting of the VM you just created - for the CDROM, select use ISO image and select your mini.iso file. At the same time, you can increase the memory settings of your VM to 1024 MB. You can now click on "Power on this image" Do the regular installation... all default options, except:

  • At the Boot: prompt, use the following boot option: "install fb=false". This will disabled the frame buffer, which is much more efficient (in my case at least)
  • Select your own keyboard layout
  • Hostname is osm
  • Select a Debian mirror close to you
  • Create a first user named osm
  • Install NO software
  • Install GRUB
  • Once the installation is over, do a minimal cleanup with:
apt-get clean
apt-get install sudo
visudosu

Add the following line at the end of the file:

osm ALL=(ALL) ALL

The result is available [here]. Root's password is osm and there is a osm user with password osm.

Populate the PostgreSQL DB

# Install the basic packages:
sudo apt-get install postgresql-postgis subversion
# Install the OpenStreetmap source tree
svn co http://svn.openstreetmap.org
# Create the DB, grant access to the osm user, install the PostGIS extensions and fill up the DB
sudo su
sudo su postgres
createdb -EUNICODE osm
createuser -S -D -R osm
echo "GRANT ALL ON SCHEMA PUBLIC TO osm;" | psql osm 
echo "create language plpgsql;" | psql osm
psql osm < /home/osm/svn.openstreetmap.org/utils/mapnik/lwpostgis.sql
echo "grant all on geometry_columns to osm;" | psql osm
echo "grant all on spatial_ref_sys to osm;" | psql osm
exit
exit
# Download a planet.osm dump (as user "osm")
cd; mkdir planet.osm; cd $_
wget http://www.zimmerheimer.de/planet.osm/planet-070221.osm.bz2
# Compile the Sanitizer
sudo apt-get install build-essential
cd /home/osm/svn.openstreetmap.org/utils/planet.osm/C/ && make
# Sanitize the dump
sudo apt-get install bzip2
bzcat /home/osm/planet.osm/planet-070221.osm.bz2 | ./UTF8sanitizer > /home/osm/planet.osm/planet-070221-sanitzied.osm
# Compile osm2psql
sudo apt-get install libxml2-dev libgeos-dev libgeos2c2a
cd /home/osm/svn.openstreetmap.org/utils/osm2pgsql

Edit the Makefile and remove all references to /opt/geos

make
# Generate the .sql
cd /home/osm/planet.osm
/home/osm/svn.openstreetmap.org/utils/osm2pgsql/osm2pgsql planet-070221-sanitzied.osm > planet-070221-sanitzied.sql
echo "commit;" >> planet-070221-sanitzied.sql
cat planet-070221-sanitzied.sql | psql osm

At this point, the DB is filled with OSM data and ready to be used for rendering.

Install tilesGen.pl

sudo apt-get install libwww-perl libgd-gd2-perl inkscape xmlstarlet
cd /home/osm/svn.openstreetmap.org/utils/tilesAtHome
cp tilesAtHome.conf.linux tilesAtHome.conf
cp authentication.conf.example authentication.conf

Edit authentication.conf to reflect your username / password

./tilesGen.pl loop

Cleaning up and reclaiming space

sudo apt-get clean
rm -rf /home/osm/planet.osm/*

Then poweroff the VM:

sudo /sbin/shutdown -h now