[GIS] How to install PostGIS correctly with OpenGeo Suite 4.0 community edition on Ubuntu

boundless-suitepostgisUbuntu

I have installed the OpenGeo Suite community edition, version 3 and 4, onto Ubuntu Server 10.04 and 12.04 multiple times in the past, with virtually no problems. With the latest version of OpenGeo Suite (which includes PostGIS 2.1), I am able to install almost all of the components successfully, except PostGIS, on ubuntu 10.04 and 12.04. With earlier editions, PostGIS was installed as part of the full Opengeo installation process, but now, although PostGreSQL 9.3 is successfully installed, there are no PostGIS or opengeo database templates installed, nor are the spatial functions installed. According to apt-get, however, PostGIS 2.1 is installed.

I have also attempted to install OpenGeo v4 community edition on a local ubuntu server on a vm. Same issue… geoserver, geowebcache, the opengeo dashboard, PostGres 9.3, and PostGIS 2.1 all installed, but no opengeo or postgis databases, and no functions. I'm wondering if this is an issue with the Opengeo installation package?

Best Answer

OpenGeo Suite 4 no longer creates a default database or user account. You can create these using the following steps:

Run sudo su postgres -c psql to connect to the database. At the psql prompt enter CREATE ROLE opengeo PASSWORD 'opengeo' SUPERUSER CREATEDB CREATEROLE INHERIT LOGIN; to create the opengeo user with the password opengeo. Now quit psql with \q.

Next, open /etc/postgresql/9.3/main/pg_hba.conf in a text editor and change the line local all all peer to local all all md5. You will need to restart Postgres qith sudo service postgresql restart.

Once postgres has restarted run createdb -U opengeo -W -E UTF8 opengeo to create the opengeo database with the opengeo user. You should be prompted for your password. Now you can connect to the data base with psql -U opengeo -W (again you will be prompted for a password). You can install PostGIS by running create extension postgis;.

After this is done you should be able to add a PostGIS store in GeoServer using the opengeo user.

Related Question