http://my.oschina.net/hippora/blog/375292

下载源码并解压

[root@fnddb ~]# wget https://ftp.postgresql.org/pub/source/v9.4.0/postgresql-9.4.0.tar.bz2
[root@fnddb ~]# tar -xjvf postgresql-9.4.0.tar.bz2
[root@fnddb ~]# cd postgresql-9.4.0

开始编译安装

[root@fnddb postgresql-9.4.0]# ./configure
……
checking for library containing shmget... none required
checking for library containing readline... no
configure: error: readline library not found
If you have readline already installed, see config.log for details on the
failure. It is possible the compiler isn't looking in the proper directory.
Use --without-readline to disable readline support.

按照错误提示依次安装依赖包

[root@fnddb postgresql-9.4.0]# yum install readline-devel
[root@fnddb postgresql-9.4.0]# yum install zlib-devel
...

继续

[root@fnddb postgresql-9.4.0]# ./configure
[root@fnddb postgresql-9.4.0]# make
……
All of PostgreSQL successfully made. Ready to install.
[root@fnddb postgresql-9.4.0]# make install
……
PostgreSQL installation complete.

添加用户

[root@fnddb postgresql-9.4.0]# useradd postgres
[root@fnddb postgresql-9.4.0]# passwd postgres
Changing password for user postgres.
New password:
BAD PASSWORD: it is based on a dictionary word
Retype new password:
passwd: all authentication tokens updated successfully.

建立好database cluster目标文件夹

[root@fnddb postgresql-9.4.0]# mkdir /var/lib/pgsql/data -p
[root@fnddb postgresql-9.4.0]# chown -R postgres /var/lib/pgsql

环境变量设置

[root@fnddb postgresql-9.4.0]# su - postgres
[postgres@fnddb ~]$ vi .bash_profile

# postgres
PGDATA=/var/lib/pgsql/data
PATH=/usr/local/pgsql/bin:$PATH
export PGDATA PATH [postgres@fnddb ~]$ . .bash_profile

创建database cluster

[postgres@fnddb ~]$ pg_ctl initdb
...... WARNING: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
--auth-local and --auth-host, the next time you run initdb. Success. You can now start the database server using: /usr/local/pgsql/bin/postgres -D /var/lib/pgsql/data
or
/usr/local/pgsql/bin/pg_ctl -D /var/lib/pgsql/data -l logfile start

启动数据库实例

设置好PGDATA环境变量后,可以不带-D选项

[postgres@fnddb ~]$ pg_ctl start -l /var/lib/pgsql/pgsql.log
server starting

关闭数据库实例

[postgres@fnddb ~]$ pg_ctl stop
waiting for server to shut down.... done
server stopped

开机自动启动设置

[root@fnddb postgresql-9.4.0]# vi /etc/rc.local

su - c '/usr/local/pgsql/bin/pg_ctl start -D /var/lib/pgsql/data -l /var/lib/pgsql/pgsql.log'

最新文章

  1. Linux学习笔记(13)-进程通信|命名管道
  2. ThinkPHP3快速入门教程三:查询语言
  3. Unbunt vi 编辑器键盘按键不正确的一次经历与解决方案
  4. Entity Framework 5.0系列之EF概览
  5. git初体验(二)基础git文件操作
  6. 【Office Word】论文排版有关技巧
  7. 深入理解C#泛型
  8. Cheatsheet: 2013 07.01 ~ 07.08
  9. Populating Tabular Data Block Manually Using Cursor in Oracle Forms
  10. 百度编辑器Ueditor自动换行,添加<p>的问题
  11. PopupWindow 问题集锦
  12. Core Data(数据持久化)
  13. [转] IPC之管道、FIFO、socketpair
  14. JSTL标签急速秒杀jsp页面中的java代码(一)---Core标签库
  15. sql 多个字段排序,头一个字段排序完,再对第二个字段进行排序(以此类推)
  16. Spring+SpringMvc+Mybatis 框架的搭建(二)
  17. 安装iis8
  18. jquery 选择器、筛选器、事件绑定与事件委派
  19. 设计模式七: 策略(Strategy)
  20. hihocoder #1044 : 状态压缩·一 状压DP

热门文章

  1. 网络模块(net, http)小解
  2. 转 精选37条强大的常用linux shell命令组合
  3. 利用xcopy命令实现本地文件复制到远程服务器的方法
  4. freemarker遍历list中的map
  5. HDU 5806 NanoApe Loves Sequence Ⅱ
  6. python+appium使用记录
  7. java中static关键字解析
  8. int与byte的区别
  9. (转) 三个nginx配置问题的解决方案
  10. permutation求全排列