PostgreSQL 9.1.2源码编译

2014-11-24 18:49:14 · 作者: · 浏览: 0

刚要入门php,然后开始编译环境,先从PostgreSQL开始...


-----------------------------------------------------------


-----------------------------------------------------------


yum -y install readline-devel


PostgreSQL 下载页面 http://www.postgresql.org/ftp/source/

#mkdir /usr/local/src/postgresql && cd /usr/local/src/postgresql


#wget http://ftp.postgresql.org/pub/source/v9.1.2/postgresql-9.1.2.tar.gz

解压缩


#tar -zxvf postgresql-9.1.2.tar.gz


#su - -c "useradd -M postgres"


#chown -R postgres:postgres postgresql-9.1.2



配置编译
#./configure --help


#./configure --prefix=/opt/pgsql--sysconfdir=/opt/pgsql/etc


#mkdir/opt/pgsql/data


#chown postgres:postgres /opt/pgsql/data

初始化


# su postgres


bash-3.2$ /opt/pgsql/bin/initdb -D /opt/pgsql/data




添加环境变量


#vi /etc/profile


PATH=/opt/pgsql/bin:$PATH


export PATH


#source /etc/profile


启动:


#mkdir /opt/pgsql/logs/


#chown postgres:postgres /opt/pgsql/logs/


#su postgres


bash-3.2$ /opt/pgsql/bin/pg_ctl -D /opt/pgsql/data -l /opt/pgsql/logs/pgsql.log start


设置启动脚本:


#su -c "cp /usr/local/src/postgresql/postgresql-9.1.2/contrib/start-scripts/linux /etc/rc.d/init.d/postgresql-9.1.2"


#su -c "chmod a+x /etc/rc.d/init.d/postgresql-9.1.2"


#vi /etc/rc.d/init.d/postgresql-9.1.2