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'

postgresql 在linux上的源码安装的更多相关文章

  1. Linux平台下源码安装mysql多实例数据库

    Linux平台下源码安装mysql多实例数据库[root@linux-node1 ~]# netstat -tlunp | grep 330tcp6 0 0 :::3306 :::* LISTEN 6 ...

  2. 在 Ubuntu 上使用源码安装 OpenResty

    镜像下载.域名解析.时间同步请点击 阿里云开源镜像站 本文将介绍如何在 Ubuntu 上使用源码安装 OpenResty. 目标 Ubuntu 18.04 OpenResty 1.19.3.2 安装依 ...

  3. Linux 6.8 源码安装MySQL8.0

    搭建环境说明: 系统版本:Red Hat Enterprise Linux Server release 6.8 (Santiago) 内核版本:Linux 2.6.32-642.el6.x86_64 ...

  4. linux中的源码安装

    前两天自己在笔记本上装了CentOs版本的虚拟机,接着要装Python3,是源码安装的挺费劲,个人总结了一些源码安装的经验,今天在这里给大家分享一下. 1. 首先准备环境,安装必要的编译工具gcc g ...

  5. Linux环境下源码安装PostgreSQL

    1.下载PostgreSQL源码包,并保存到Linux操作系统的一个目录下 2.解压PostgreSQL源码包 :tar zxvf postgresql-9.2.4.tar.gz 或 tar jxvf ...

  6. linux下python3源码安装及卸载

    Linux下Python3的源码编译安装和卸载方法 [日期:2019-06-21] 来源:博客园  作者:wuli潇萧 [字体:大 中 小]     (一)Linux下软件的源码编译安装和卸载方法 L ...

  7. Linux MySQL5.5源码安装

    环境:CentOS7,MySQL5.5 1.MySQL5.5源码下载 Oracle的网站打开较慢,http://mirrors.sohu.com/mysql/这里提供了MySQL的镜像.一般的,Lin ...

  8. [整理]Linux下的源码安装步骤及其功能解释

    源码的安装一般由3个步骤组成:配置(./configure).编译(make).安装(make install). 这时最常用的命令就是这三个--./configure && make ...

  9. linux nginx+php源码安装

    PHP安装 1)下载 wget http://cn2.php.net/distributions/php-5.6.30.tar.gz 2)解压 tar –xf php-5.6.30 3)进入目录 cd ...

随机推荐

  1. 星语硬件检测专家 V4.3 官方版

    软件名称: 星语硬件检测专家 软件语言: 简体中文 授权方式: 免费软件 运行环境: Win 32位/64位 软件大小: 15.8MB 图片预览: 软件简介: 星语硬件检测专家是一款功能非常强大的硬件 ...

  2. C# 二维数组和集合

    本次课我主要学习了二维数组和集合的部分内容. 在二维数组的部分中,我主要学习了二维数组的定义方法:int [,] array=new int [4,2];做了一个小练习:用二维数组打印自己的姓氏. s ...

  3. 一个神奇SQL引发的故障【转】

    前几天一个客户数据库主实例告警,诊断过程中发现是由一个慢SQL导致的数据库故障,而在排查逐步深入之后却发现这个现象的不可思议. 问题描述 2016年12日09日,大概9点26分左右,一个客户的生产库主 ...

  4. Alyona and a tree

    Alyona and a tree time limit per test 2 seconds memory limit per test 256 megabytes input standard i ...

  5. JPA 系列教程12-复合主键-2个@Id+@IdClass

    复合主键 指多个主键联合形成一个主键组合 需求产生 比如航线一般是由出发地及目的地确定,如果要确定唯一的航线就可以用出发地和目的地一起来表示 ddl语句 同复合主键-2个@Id一样 Airline p ...

  6. mysql、sqlserver数据库常见数据类型对应java中的的类型探究

    由于本次测试表的结构不涉及到主键的自增长,所以mysql.sqlserver建表语句相同: CREATE TABLE testType ( id INT NOT NULL DEFAULT 0, gen ...

  7. 使用HttpClient工具类测试Http接口

    一.httpClient模拟客户端 import java.util.ArrayList;import java.util.Iterator;import java.util.List;import ...

  8. 11--Python 备份文件程序

    最近看了下<A Byte of Python>, 看见一个非常有意思的程序,用python进行文件行备份的练习程序, 自己在机器上敲代码运行了一遍,结果出现了一个小问题,路径出错--&qu ...

  9. hdu 1020

    //自信满满地交上去~~but...超时了 #include <iostream> #include <string.h> #include <stdio.h> u ...

  10. ECOS-认证地址

    ECOS系统授权认证,需要和Shopex认证中心互联.当服务器DNS无效时.需要绑定host强行解析服务器强行解析以下vim /etc/hosts 122.144.135.142 service.sh ...