Postgresql源码安装
groupadd postgres
useradd -g postgres postgres
mkdir -p /pgsql/data
mkdir /usr/local/pgsql
chown postgres:postgres /usr/local/pgsql
chown postgres:postgres /pgsql
chown postgres:postgres /pgsql/data
vi /home/postgres/.bash_porfile
export PATH="$PATH":/usr/local/pgsql/bin
export POSTGRES_HOME=/usr/local/pgsql
export PGLIB=$POSTGRES_HOME/lib
export PGDATA=/pgsql/data
export MANPATH="$MANPATH":$POSTGRES_HOME/man
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH":"$PGLIB"
解包
yum -y install gcc readline-devel zlib-devel make
./configure –prefix=/usr/local/pgsql
make && make install
执行数据库初始化脚本
/usr/local/pgsql/bin/initdb –encoding=utf8 -D /pgsql/data
/usr/local/pgsql/bin/pg_ctl -D /pgsql/data -l logfile start
[postgres@master ~]$ psql
psql (8.4.13,服务器 9.4.4)
警告:psql 版本8.4, 服务器版本9.4.
一些psql功能可能无法工作.
输入 “help” 来获取帮助信息.
更改密码 postgres=# alter user postgres password ‘postgres’; ALTER ROLE postgres=# \q [postgres@master ~]$