Original: http://lovewinner.iteye.com/blog/1490915
Installing PostgreSQL
[Plain]View PlainCopy
- sudo apt-get install postgresql-9.1 postgresql-contrib-9.1
Where postgresql-contrib-9.1 does not have to be installed, if you do not install it, you may be prompted to install it later using Pgadmin to open the database. If it's too much trouble, install it together.
If you want to install a different version of PostgreSQL, you can use
[Plain]View PlainCopy
- sudo apt-cache search PostgreSQL
Inquire
Installing PostGIS
[Plain]View PlainCopy
- sudo apt-get install Postgresql-9.1-postgis
The installation is installed, PostgreSQL is ready to use, if you want to build a PostGIS database, the following steps:
Build the PostGIS Template Library
Switch to Postgres user
[Plain]View PlainCopy
- sudo su postgres
New Library Postgis_template
[Plain]View PlainCopy
- Createdb postgis_template
Execute PostGIS scripts, these scripts are/usr/share/postgresql/9.1/contrib/postgis-1.5 by default
[Plain]View PlainCopy
- psql-d postgis_template-f/usr/share/postgresql/9.1/contrib/postgis-1.5/postgis.sql
- psql-d postgis_template-f/usr/share/postgresql/9.1/contrib/postgis-1.5/spatial_ref_sys.sql
Modify User Password
[Plain]View PlainCopy
- Psql
- ALTER USER postgres with PASSWORD ' 111111 ';
Installation of PostgreSQL database and installation of PostGIS (RPM)