PostgreSQL源码编译安装
author: [email protected]
date: 2014-05-12
本文的编译安装与 PostgreSQL 9.3.4 为准,操作系统为Ubuntu12.04 LTS server版,以非root用户进行安装到自己的home目录下。
前期所需组件安装:
sudo apt-get install build-essential automake autoconf libreadline-dev libxml2-dev libxslt1-dev
解压从官网下载回来后的压缩包,进入解压目录,运行以下参数编译:
./configure --prefix=/home/work/postgresql/postgresql-9.3.4 --with-python --with-openssl --with-libxml --with-libxslt --enable-debug
运行以下命令,解决ubuntu下找不到gmake命令的错误:
sudo ln -s /usr/bin/make /usr/bin/gmake
configure完后,没出啥错的话,下面开始安装
gmake
gmake install
cd /home/work/postgresql
ln -s postgresql-9.3.4 default
将 /home/work/postgresql/default/bin 放到 ~/.profile 的PATH定义中,然后再
source ~/.profile
新建data目录,并初始化
cd /home/work/postgresql
mkdir data
initdb -D /home/work/postgresql/data
启动数据库:
/home/work/postgresql/postgresql-9.3.4/bin/postgres -D /home/work/postgresql/data -l /home/work/postgresql/logfile start
新建一个测试库:
createdb test
连接上test数据库
psql test
后面就自己折腾了吧 ....