PostgreSQL在Linux下的源码编译安装

前端之家收集整理的这篇文章主要介绍了PostgreSQL在Linux下的源码编译安装前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。


1.下载Postgresql源码安装包

官方下载地址;http://www.postgresql.org/download/

本文使用的: postgresql-9.4.4.tar.gz


2.编译安装:

tar-zxvfpostgresql-9.4.4.tar.gz
cdpostgresql-9.4.4
./configure--prefix=/opt/pgsql--with-pgport=5432
gmakeworld
gmakeinstall-world

cd/opt/pgsql
mkdirdata

useradd-mpostgres
passwdpostgres
chownpostgresdata

su-postgres
cd..
cdbin
./initdb-D../data--locale=C-Upostgres
./pg_ctlstart-D../data
./psql

备注:

报错: error while loading shared libraries: libpq.so.5:cannot open shared object file: No such file or directory。

解决: export LD_LIBRARY_PATH=/opt/pg944/lib/


3.添加环境变量:

vi/etc/profile

文件末尾添加

exportPG_HOME=/opt/pgsql

Esc 退出插入

:w 保存

:q 退出编辑

source/etc/profile


4.数据库访问控制

配置postgresql.conf的listen_address参数和pg_hba.conf的参数。

请参考:PostgreSQL的访问控制


5.设置防火墙

一般需要外部访问时可关闭防火墙。

请参考:Linux下关闭防火墙的方法


注意:

如果安装过程中,报告因为缺少xx包导致了错误

首先:

yum search all xx

然后确定包名后,安装该包

yum install xxlib

然后继续执行即可。

猜你在找的Postgre SQL相关文章