postgresql安装包自带插件安装:
1.编译安装插件
# root用户 # postgresql安装过程省略 # 进入解压包的contrib目录 cd postgresql-10.6/contrib/ export PATH=$PATH:/usr/local/pgsql/bin make all make install
2.进入数据库,安装插件
su - postgres psql create extension tablefunc; dx
其他插件安装,基本大同小异,本利以pg_pathman为例:
1.找到适合的版本并下载
wget https://github.com/postgrespro/pg_pathman/archive/1.5.3.tar.gz
2.解压安装
# root用户 cd pg_extensions/ tar vxf pg_pathman-1.5.3.tar.gz cd pg_pathman-1.5.3 export PATH=$PATH:/usr/local/pgsql/bin/ make USE_PGXS=1 make USE_PGXS=1 install
3.修改参数文件
su - postgres vi $PGDATA/postgresql.conf # 添加如下语句 # shared_preload_libraries = 'pg_pathman,pg_stat_statements'
# 重启数据库,使参数生效
pg_ctl restart
4.进入数据库安装插件
su - postgres psql create extension pg_pathman; dx