[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [DebianGIS] Where is the postgis in etch documentation?



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi all.
I think it's better to create a template_gis to have the possibility to
create a new geo_db without the need of repeating this procedure every time.
So we suggest two procedures: one without the template and the second
with template creation.

1. Creating a new geo_db:

As root:

  # Install the needed packages
  aptitude install postgresql-8.1-postgis postgis

  # Become a postgresql superuser
  su - postgres

  # Create the user (allowed to log in and with password)

  createuser <username> -l -W

  # Shall the new role be a superuser? (y/n) n
  # Shall the new role be allowed to create databases? (y/n) n
  # Shall the new role be allowed to create more new roles? (y/n) n
  # Password: <type the user password>

  # create database ownered by user
  createdb <databasename> --o <username>

  # Need to enable plpgsql for the database before loading the functions
  createlang plpgsql -d <databasename>

  # Finally, load the functions and reference system tables
  psql <databasename> -f /usr/share/postgresql-8.1-postgis/lwpostgis.sql
  psql <databasename> -f
/usr/share/postgresql-8.1-postgis/spatial_ref_sys.sql

  # login in new database (still as superuser postgres)
  psql <databasename>

  # grant privilege on standard ogc tables to user
  grant all on geometry_columns to <username>;
  grant select on spatial_ref_sys to <username>;

  # exit from postgres
  \q

  # log out from unix user postgres and from root. As normal user, enter
in your new db:
  psql -h <host> -U <username> -d <databasename>

  # you are in your new geodb
  # have a look of tables
  \dt
  # have a look of functions
  \df
  # have a look of spatial_ref_sys
  select * from spatial_ref_sys;

2. If you want to create a template_gis to use as template for every new
geodatabase:
As root:

  # Install the needed packages
  aptitude install postgresql-8.1-postgis postgis

  # Become a postgresql superuser
  su - postgres

  # create database (owner:postgres)
  createdb template_gis

  # Need to enable plpgsql for the database beforeloading the functions
  createlang plpgsql -d template_gis

  # Finally, load the functions and reference system tables
  psql template_gis -f /usr/share/postgresql-8.1-postgis/lwpostgis.sql
  psql template_gis -f /usr/share/postgresql-8.1-postgis/spatial_ref_sys.sql

  # login in new database (still as superuser postgres)
  psql template_gis

  # transform new db in template
  update pg_database SET datistemplate='true' where datname='template_gis';

  # exit from postgres
  \q

  # now you have your template. *To create every new geodatabase start
from here*:

  # Become a postgresql superuser (or another superuser if there is)
  su - postgres

  # Create the user  (allowed to log in and with password, wich must be
owner of new db) skip if you still have your user
  createuser <username> -l -W

  # Shall the new role be a superuser? (y/n) n
  # Shall the new role be allowed to create databases? (y/n) n
  # Shall the new role be allowed to create more new roles? (y/n) n
  # Password: <type the user password>

  # create database (from template_gis) ownered by user
  createdb <databasename> --o <username> - T template_gis

  # login in new database (still as superuser postgres)
  psql <databasename>

  # grant privilege on standard ogc tables to user
  grant all on geometry_columns to <username>;
  grant select on spatial_ref_sys to <username>;

  # exit from postgres
  \q

  # log out from unix user postgres and from root. As normal user, enter
in your new db:
  psql -h <host> -U <username> -d <databasename>

  # you are in your new geodb
  # have a look of tables
  \dt

  # have a look of functions
  \df
  # have a look of spatial_ref_sys
  select * from spatial_ref_sys;

Petter Reinholdtsen ha scritto:
> I sent this message via gmane yesterday, but it did not show up on the
> list yet.  I try again directly to the list address.
> 
> I tried to set up a postgis database in Debian/etch the other day, and
> ran into a few problems with lack of documentation.  Is there an howto
> somewhere?  I had a look in the files included in the packages, like
> /usr/share/doc/postgresql-8.1-postgis/README.Debian,
> /usr/share/doc/postgis/README.postgis.gz and
> /usr/share/doc/postgis/postgis.html, but no-one had specific
> instructions for etch.  The HTML file was closest.
> 
> At the end, I made the following notes on how to get it working.
> Should something like this be added to
> /usr/share/doc/postgresql-8.1-postgis/README.Debian?
> 
> 
> How to create a postgis database in Debian/etch
> ===============================================
> 
> Short intro on how to set up a postgis database in Debian/etch.  All
> the packages are there, but the wrapper script handling it all is
> missing.  These are the steps I took to get it working.
> 
> As root:
> 
>   # Install the needed packages
>   aptitude install postgresql-8.1-postgis postgis
> 
>   # Become a postgresql superuser (needed to load the postgis features?)
>   su - postgres
> 
>   # Create the user and her database
>   createuser <username>
>   createdb <username>
> 
>   # Need to enable plpgsql for the database beforeloading the functions
>   createlang plpgsql -d <databasename>
> 
>   # Finally, load the functions and reference system tables
>   psql <databasename> -f /usr/share/postgresql-8.1-postgis/lwpostgis.sql
>   psql <databasename> -f /usr/share/postgresql-8.1-postgis/spatial_ref_sys.sql
> 
> _______________________________________________
> Pkg-grass-general mailing list
> Pkg-grass-general@lists.alioth.debian.org
> http://lists.alioth.debian.org/mailman/listinfo/pkg-grass-general
> 

- --
Paolo Cavallini
email+jabber: cavallini@faunalia.it
www.faunalia.it
Piazza Garibaldi 5 - 56025 Pontedera (PI), Italy   Tel: (+39)348-3801953
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFhlSt/NedwLUzIr4RAlkxAJsGTgDBQta3aKgGYTSuH7O/AG7RzgCcDXg4
eBDfqWB7gG3VeR12vu3dZx0=
=uno2
-----END PGP SIGNATURE-----



Reply to: