How do I import modules or install extensions in Postgres 8.4?
To install PostgreSQL contrib
modules on Ubuntu or Kubuntu (or similar Linux distributions):
- Install the contrib package:
sudo apt-get install postgresql-contrib
- Restart the database:
sudo /etc/init.d/postgresql-8.4 restart
- Change to the database owner account (e.g.,
postgres
). - Change to the contrib modules' directory:
/usr/share/postgresql/8.4/contrib/
Use
ls
to see a list of the following modules:adminpack autoincbtree_gin btree_gistchkpass citextcube dblinkdict_int dict_xsynearthdistance fuzzystrmatchhstore insert_usernameint_aggregate isnlo ltreemoddatetime pageinspectpg_buffercache pgcryptopg_freespacemap pgrowlockspg_stat_statements pgstattuplepg_trgm pgxmlrefint segsslinfo tablefunctest_parser timetraveltsearch2 uuid-ossp
Load the SQL files using:
psql -U user_name -d database_name -f module_name.sql
For example, if your administrative user was named postgres
and your database was named storage
and the module you wanted was cube
, you would type:
psql -U postgres -d storage -f cube.sql
PostgreSQL 9.1:
After step #1 above, do:
sudo /etc/init.d/postgresql restart
- (same as #3 above)
cd /usr/share/postgresql/9.1/extension
(has extensions)- open
psql
CREATE EXTENSION "uuid-ossp";
- login as postgres user
- use create extension to load it
I have a database named 'book' for example,
psql -U postgres bookcreate extension cube
Repeat for each extension required, then \q to logouy