PostgreSQL 9.1.2源码编译
来源:互联网 发布:jo2系列电机数据 编辑:程序博客网 时间:2024/06/08 15:45
刚要入门php,然后开始编译环境,先从PostgreSQL开始...
-----------------------------------------------------------
| System | CentOS 5.7
-----------------------------------------------------------
遇到的编译postgresql的依赖问题,请转文后补充.yum -y install readline-devel
参考: http://blog.92cto.com/blog/339.html
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
The files belonging to this database system will be owned by user "postgres".This user must also own the server process.The database cluster will be initialized with locale en_US.UTF-8.The default database encoding has accordingly been set to UTF8.The default text search configuration will be set to "english".fixing permissions on existing directory /opt/pgsql/data ... okcreating subdirectories ... okselecting default max_connections ... 100selecting default shared_buffers ... 32MBcreating configuration files ... okcreating template1 database in /opt/pgsql/data/base/1 ... okinitializing pg_authid ... okinitializing dependencies ... okcreating system views ... okloading system objects' descriptions ... okcreating collations ... okcreating conversions ... okcreating dictionaries ... oksetting privileges on built-in objects ... okcreating information schema ... okloading PL/pgSQL server-side language ... okvacuuming database template1 ... okcopying template1 to template0 ... okcopying template1 to postgres ... okWARNING: enabling "trust" authentication for local connectionsYou can change this by editing pg_hba.conf or using the -A option thenext time you run initdb.Success. You can now start the database server using:/opt/pgsql/bin/postgres -D /opt/pgsql/dataor/opt/pgsql/bin/pg_ctl -D /opt/pgsql/data -l logfile start
添加环境变量
#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
修改PostgreSQL脚本
#! /bin/sh# chkconfig: 2345 98 02# description: PostgreSQL RDBMS# This is an example of a start/stop script for SysV-style init, such# as is used on Linux systems. You should edit some of the variables# and maybe the 'echo' commands.## Place this file at /etc/init.d/postgresql (or# /etc/rc.d/init.d/postgresql) and make symlinks to# /etc/rc.d/rc0.d/K02postgresql# /etc/rc.d/rc1.d/K02postgresql# /etc/rc.d/rc2.d/K02postgresql# /etc/rc.d/rc3.d/S98postgresql# /etc/rc.d/rc4.d/S98postgresql# /etc/rc.d/rc5.d/S98postgresql# Or, if you have chkconfig, simply:# chkconfig --add postgresql## Proper init scripts on Linux systems normally require setting lock# and pid files under /var/run as well as reacting to network# settings, so you should treat this with care.# Original author: Ryan Kirkpatrick <pgsql@rkirkpat.net># contrib/start-scripts/linux## EDIT FROM HERE# Installation prefixprefix=/opt/pgsql# Data directoryPGDATA="/opt/pgsql/data"# Who to run the postmaster as, usually "postgres". (NOT "root")PGUSER=postgres# Where to keep a log filePGLOG="$prefix/logs/pgsql.log"# It's often a good idea to protect the postmaster from being killed by the# OOM killer (which will tend to preferentially kill the postmaster because# of the way it accounts for shared memory). Setting the OOM_ADJ value to# -17 will disable OOM kill altogether. If you enable this, you probably want# to compile PostgreSQL with "-DLINUX_OOM_ADJ=0", so that individual backends# can still be killed by the OOM killer.#OOM_ADJ=-17## STOP EDITING HERE# The path that is to be used for the scriptPATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin# What to use to start up the postmaster. (If you want the script to wait# until the server has started, you could use "pg_ctl start -w" here.# But without -w, pg_ctl adds no value.)DAEMON="$prefix/bin/postmaster"# What to use to shut down the postmasterPGCTL="$prefix/bin/pg_ctl"set -e# Only start if we can find the postmaster.test -x $DAEMON ||{echo "$DAEMON not found"if [ "$1" = "stop" ]then exit 0else exit 5fi}# Parse command line parameters.case $1 in start)echo -n "Starting PostgreSQL: "test x"$OOM_ADJ" != x && echo "$OOM_ADJ" > /proc/self/oom_adjsu $PGUSER -c "$DAEMON -D '$PGDATA' &" >>$PGLOG 2>&1echo "ok";; stop)echo -n "Stopping PostgreSQL: "#su - $PGUSER -c "$PGCTL stop -D '$PGDATA' -s -m fast"su $PGUSER -c "$PGCTL stop -D '$PGDATA' -m fast"echo "ok";; restart)echo -n "Restarting PostgreSQL: "su $PGUSER -c "$PGCTL stop -D '$PGDATA' -s -m fast -w"test x"$OOM_ADJ" != x && echo "$OOM_ADJ" > /proc/self/oom_adjsu $PGUSER -c "$DAEMON -D '$PGDATA' &" >>$PGLOG 2>&1echo "ok";; reload) echo -n "Reload PostgreSQL: " su $PGUSER -c "$PGCTL reload -D '$PGDATA' -s" echo "ok" ;; status)su $PGUSER -c "$PGCTL status -D '$PGDATA'";; *)# Print helpecho "Usage: $0 {start|stop|restart|reload|status}" 1>&2exit 1;;esacexit 0
#service postgresql-9.1.2 restart
PS: 我机子上本来编译环境已经弄好了,所以可能会有些东西缺了,比如gcc ,make 等,可以直接yum
以下是我从lnmp那里看来的依赖包安装(但我自己并没有测试):
yum -y install patch make gcc gcc-c++ gcc-g77 flex bison file libtool libtool-libs autoconf kernel-devel libjpeg libjpeg-devel libpng libpng-devel libpng10 libpng10-devel gd gd-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glib2 glib2-devel bzip2 bzip2-devel libevent libevent-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel vim-minimal nano fonts-chinese gettext gettext-devel ncurses-devel gmp-devel pspell-devel unzip
Reference :
<<Beginning PHP and PostgreSQL 8 from Novice to Professional>>
https://writer.zoho.com/public/6b6a49b6dcbb8205336873dd09e1b3517a451cd1e1176acb29ac6183f6c6c0976db04614eed231e5
- PostgreSQL 9.1.2源码编译
- php 5.3.10 + nginx1.0.12 + PostgreSQL 9.1.2 源码编译
- Postgresql源码编译(windows7)
- 从源码编译postgresql
- windows下编译postgresql源码
- windows下编译postgresql源码
- php 5.3.10 + nginx1.0.12 + PostgreSQL 9.1.2 源码编译自动化部署第一版
- php 5.3.10 + nginx1.0.12 + PostgreSQL 9.1.2 源码编译自动化部署第一版.续
- PostgreSQL学习笔记---1 源码编译安装PostgreSQL
- postgresql 8.4源码在windows下编译
- VS编译以及调试 PostgreSQL 源码工程
- Linux下源码编译安装PostgreSQL
- CentOS 7.0 下 源码编译安装PostgreSQL
- CentOS 7.0 下 源码编译安装PostgreSQL
- Linux环境PostgreSQL源码编译安装
- win10 源码编译安装postgresql数据库
- php 5.4.10 + nginx1.0.12 + PostgreSQL 9.1.3 源码编译自动化部署第二版
- php 5.4.10 + nginx1.0.15 + PostgreSQL 9.1.3 源码编译自动化部署第三版
- android学习网站
- Cache-control的说明
- HTTP/1.1 Cache-Control的理解
- MFC if(pApp!=NULL)很重要
- http 头 Cache-control
- PostgreSQL 9.1.2源码编译
- Android google map: 坐标与屏幕像素的大致比例关系
- 【经验总结】网站前端性能优化总结
- 移植 nand
- 【最大团模板】
- HTTP的请求和响应详解(转)
- 正则表达式的快速学习方法
- 关于信息工程一些新的理解
- HTML笔记(四)