Install Extensions for Self-compiled PostgresQL
If when installing Postgres, you choose to download the source code to compile and install it, and you didn't run
make world when you do the
make, you will get an installed pg without some extensions, such as
pg_stat_statements. So, this article will try to solve this problem: how to install extensions for pg after compiling and installing.
pg_stat_statements as an example and see how it works. Of course there is a prerequisite here - the directory used to compile pg in the first place is not deleted.
First, look at the pg source directory and you can see that there is a directory named
aclocal.m4 config config.log config.status configure configure.in contrib COPYRIGHT doc GNUmakefile GNUmakefile.in HISTORY INSTALL Makefile README src
In this directory, we can see the extension packages:
$ cd contrib $ ls
It's all here.
adminpack btree_gist dblink fuzzystrmatch intarray Makefile pgcrypto pg_stat_statements README start-scripts tsm_system_rows xml2 auth_delay chkpass dict_int hstore isn oid2name pg_freespacemap pgstattuple seg tablefunc tsm_system_time auto_explain citext dict_xsyn hstore_plperl lo pageinspect pg_prewarm pg_trgm sepgsql tcn unaccent bloom contrib-global.mk earthdistance hstore_plpython ltree passwordcheck pgrowlocks pg_visibility spi test_decoding uuid-ossp btree_gin cube file_fdw intagg ltree_plpython pg_buffercache pg_standby postgres_fdw sslinfo tsearch2 vacuumlo
Assuming we want to install pg_stat_statements, the steps are fairly simple, and the other extension packages are installed in a similar way:
$ cd pg_stat_statements $ make $ sudo make install
The official documentation is here, it doesn't specify where to execute make && make install at first so it's rather confusing.