首页 / 数据库 / MySQL / CentOS平台下安装PostgreSQL9.3
Linux系统:CentOS1 用root登入系统,下载postgresql9.3,解压缩,进入解压缩后的postgresql目录
2 编译、安装
#pwd
#./configure --profix=/usr/local/pgsql
(可能会报错,需安装gcc、readline、readline-devel、zlib等依赖包,用yum去装即可)
#make
#make install
3 创建用户及组
#groupadd postgres
#useradd -g postgres postgres
4 环境设置
#mkdir /usr/local/pgsql/data
#chown postgres:postgres -R /usr/local/pgsql/data
#su - postgres
$vim .bash_profile
添加:
PGHOME=/usr/local/pgsql
PGDATA=$PGHOME/data
PATH=$PATH:$HOME/bin:$PGHOME/bin
export PGHOME
export PGDATA
export PATH
$source .bash_profile
5 初始化数据库
$initdb -D $PGDATA
6 系统服务配置及开机自动启动
#cd /root/postgresql-9.3.1
#cp contrib/start-scripts/linux /etc/init.d/postgresql
#chmod +x /etc/init.d/postgresql
#service postgresql status--(start | stop)
#chkconfig --add postgresql
#chkconfig postgresql on
7 配置监听地址及端口
$vim $PGDATA/postgresql.conf
$vim $PGDATA/pg_hba.confPostgreSQL缓存详述 http://www.linuxidc.com/Linux/2013-07/87778.htmWindows平台编译 PostgreSQL http://www.linuxidc.com/Linux/2013-05/85114.htmUbuntu下LAPP(Linux+Apache+PostgreSQL+PHP)环境的配置与安装 http://www.linuxidc.com/Linux/2013-04/83564.htmUbuntu上的phppgAdmin安装及配置 http://www.linuxidc.com/Linux/2011-08/40520.htmPostgreSQL 的详细介绍:请点这里
PostgreSQL 的下载地址:请点这里更多CentOS相关信息见CentOS 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=14本文永久更新链接地址