安装过程:

1、configuration

--prefix=PREFIX

install all files under the directory PREFIX instead of usr/local/psql

--with-pgport=NUMBER

set NUMBER as the default port number for server and clients,the default is 5432.

--with-segsize=SEGSIZE(控制表的大小)

set the segment size,in gigabytes,large tables are divided into multiple operating-system files,each of size equal to the segment size.

--with-blocksize=BLOCKSIZE

set the block size,in kilobytes.this is the unit of starage and i/o within tables.the defaules,8 kilobytes,is susitable for most situnations;but other values may be usefulin special cases,the value must be a power of 2 between 1 and 32(jukobyrtes).

--with-wal-segsize=SEGSIZE

set the wal segment size,in megabytes,this is the size of each individaul file in the wal log.it may be useful to adjust this size to control the granularity of wal log shipping.the default size is 16 megabytes.the value must be a power of 2 between 1 and 64(megabytes).

--with-wal-blocksize=BLOCKSIZE

set the wal block size,in kilobytes.this is the unit of storage and i/o within the wal log,the default,8 kilobytes,is suitable for most situations;but other values may be useful in special cases.the value must be a power of w between 1 and 64(kilobytes).

2、build

gmake

gmake world

3、installing the files

gmake install

gmake install-world

4、add a os user account

#groupadd postgres

#useradd postgres

#passwd postgres

#chown -R postgres:postgres /pgdir

5、creating a database cluster(数据库初始化)

A database cluster is a collection of databases that is managed by a single instance of a running database server.

In file system terms,a database cluster will be a single directory under which all data will be stored.we call this the data direcotry or data area.

as an alternative to the -D option,you can set the environment variable PGDATA

initdb -D /usr/local/pgsql/data/ --locale=C --encoding=UTF8

pg_ctl -D /usr/local/pgsql/data initdb

6、starting the database server

postgres -D /usr/local/pgsql/data   --前台启动方式,退出终端即退出pg

postgres -D /usr/local/pgsql/data >logfile 2>&1 &            --后台启动方式

pg_ctl start -l logfile

安装文档1:

[root@node2 pg952]# tar -jxvf postgresql-9.5.2.tar.bz2

[root@node2 pg952]# cd postgresql-9.5.2

[root@node2 pg952]# cat INSTALL |more

[root@node2 pg952]# mkdir /pg952

[root@node2 pg952]# ./configure --prefix=/pg952/

[root@node2 pg952]# gmake world

[root@node2 pg952]# gmake install-world

[root@node2 pg952]# id postgres

[root@node2 pg952]# chown -R postgres:postgres /pg952/

[root@node2 pg952]# initdb -D /usr/local/pgsql/data/ --locale=C --encoding=UTF8

[root@node2 pg952]# pg_ctl start -l logfile

安装文档2:

linux系统依赖包:

[root@localhost ~]# gcc --version

gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-4)

Copyright (C) 2010 Free Software Foundation, Inc.

This is free software; see the source for copying conditions.  There is NO

warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

[root@localhost ~]# make --version

GNU Make 3.81

Copyright (C) 2006  Free Software Foundation, Inc.

This is free software; see the source for copying conditions.

There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A

PARTICULAR PURPOSE.

This program built for x86_64-redhat-linux-gnu

[root@localhost ~]# rpm -qa|grep readline

compat-readline5-5.2-17.1.el6.x86_64

readline-devel-6.0-4.el6.x86_64

readline-6.0-4.el6.x86_64

[root@localhost ~]# rpm -qa|grep zlib

zlib-1.2.3-29.el6.x86_64

zlib-devel-1.2.3-29.el6.x86_64

安装postgresql 5.2

[root@localhost mnt]# tar -jxvf postgresql-9.5.2.tar.bz2

[root@localhost mnt]# cd postgresql-9.5.2

[root@localhost postgresql-9.5.2]# ./configure --prefix=/pg952/

[root@localhost postgresql-9.5.2]# make world

[root@localhost postgresql-9.5.2]# make install-world

[root@localhost pg952]# cd /pg952/

[root@localhost pg952]# ll

总计 32

drwxr-xr-x 2 root root 4096 05-26 05:41 bin

drwxr-xr-x 4 root root 4096 05-26 05:40 include

drwxr-xr-x 4 root root 4096 05-26 05:40 lib

drwxr-xr-x 5 root root 4096 05-26 05:40 share

[root@localhost pg952]# id postgres

uid=26(postgres) gid=26(postgres) groups=26(postgres) context=root:system_r:unconfined_t:SystemLow-SystemHigh

[root@localhost pg952]# chown -R postgres:postgres /pg952/

[root@localhost pg952]# ll /pg952/

总计 32

drwxr-xr-x 2 postgres postgres 4096 05-26 05:41 bin

drwxr-xr-x 4 postgres postgres 4096 05-26 05:40 include

drwxr-xr-x 4 postgres postgres 4096 05-26 05:40 lib

drwxr-xr-x 5 postgres postgres 4096 05-26 05:40 share

[root@localhost pg952]# su - postgres

-bash-3.2$ vim .bash_profile    --添加如下环境变量

[ -f /etc/profile ] && source /etc/profile

export PGHOME=/pg952

export PGDATA=/pg952/data

export LD_LIBRARY_PATH=$PGHOME/lib:$LD_LIBRARY_PATH

PATH=$PGHOME/bin:$PATH

-bash-3.2$ pg_ctl init        --初始化数据库

-bash-3.2$ vim postgresql.conf        --修改配置文件

#listen_addresses = 'localhost'         # what IP address(es) to listen on;

listen_addresses = '*'

-bash-3.2$ vim pg_hba.conf           --修改配置文件

# IPv4 local connections:

host    all             all             127.0.0.1/32            trust

host    all             all             192.168.72.0/24          md5

-bash-3.2$ pg_ctl start -l $PGHOME/logfile 2>&1 >/dev/null   --启动数据库

注意:pg_ctl start|status|stop|restart进行数据库启动

-bash-3.2$ ps -ef|grep post                   --查看数据库状态

-bash-3.2$ cat logfile

-bash-3.2$ ps -f -U postgres

连接数据库:

-bash-3.2$ psql                  --本地连接

psql (9.5.2)

Type "help" for help.

postgres=# \l

..........

postgres-# \password            --修改pg口令

Enter new password:

Enter it again:

C:\Users\wangwc>psql -h 192.168.72.130 -U postgres -d oracle    --远程连接

Postgresql shared memory usage:

Usage

Approximate shared memory bytes required(as of 8.3)

commections

(1800+270*max_locks_per_transaction)*max_connections

Autovacuum workers

(1800+270*max_locks_per_transaction)*autovacuum_max_workers

Prepared transactions

(770+270*max_locks_per_transaction)*max_prepared_transcctions

Shared disk buffers

(blocks_size+208)*shared_buffers

Wal buffers

(wal_blocks_size+208)*wal_buffers

Fixd space requiremenrs

770kb

postgresql 9源码安装的更多相关文章

  1. PostGreSQL(1)-源码安装

    目录 简述 一.格式化磁盘 二.源码安装 PostGreSql 1. 安装 readline-devel 2. 安装 PostGresql 3. 设置环境变量 三. 初始化 1. 设置运行用户 2. ...

  2. CentOS7 源码安装 PostgreSQL 12

    PostgreSQL 12 源码安装 Table of Contents 1. 下载 2. 准备环境 3. 编译安装 4. 设置环境变量 5. 初始化数据库 6. 配置参数文件 6.1. postgr ...

  3. Postgresql源码安装

    以在64位CentOS6.5操作系统上源码安装postgresql-9.6beta1为例 一.进入官网下载代码(postgresql-9.6beta1.tar.gz) https://www.post ...

  4. 国产龙芯服务器源码安装PostgreSQL数据库的方法

    1. 公司最近有一些国产化项目的需求, 要求在国产CPU的服务器上面安装pg数据库等. 2.. 但是差查了下中标麒麟的官网,在龙芯MIPS的操作系统包源里面仅有 postgreSQL 9.2 版本的r ...

  5. Greenplum 源码安装教程 —— 以 CentOS 平台为例

    Greenplum 源码安装教程 作者:Arthur_Qin 禾众 Greenplum 主体以及orca ( 新一代优化器 ) 的代码以可以从 Github 上下载.如果不打算查看代码,想下载编译好的 ...

  6. centos环境源码安装postgresql9.4

    源码安装简要步骤 下载PostgreSQL 源码包  下载根目录地址:http://ftp.postgresql.org/  本人选择的是当前最新版本v9.4.1:http://ftp.postgre ...

  7. RedHat7下PostGIS源码安装

    本文介绍在RedHat7环境下安装使用PostGIS的流程. 1. PostgreSQL 1.1 yum安装PostgreSQL 这个比较简单,直接使用yum安装即可. $ sudo yum inst ...

  8. zabbix源码安装实例

    环境 系统                 Centos7 zabbix版本      Zabbix 3.4.15 (revision 86739) zabbix源码安装 .tar.gz cd zab ...

  9. gitlab 源码安装=》rpm安装横向迁移(version 9.0)

    准备: 下载版本地址: https://packages.gitlab.com/gitlab/gitlab-ce 迁移环境: 源码安装的gitlab9.0.13 目标迁移至9.0.13 RPM安装的环 ...

随机推荐

  1. Unix环境高级编程-阻塞访问原理——等待队列

    有些时候,一个系统调用可能无法马上取到或者送出数据:一个温度采集器如果没有采用中断或者轮询的策略,而是在用户发出请求时才进行采集,并在一定的时间后返回结果.如果用户程序希望调用read或write并且 ...

  2. R语言|数据特征分析

    对数据进行质量分析以后,接下来可通过绘制图表.计算某些特征量等手段进行数据的特征分析. 主要通过分布分析.对比分析.统计量分析.周期性分析.贡献度分析.相关性分析等角度进行展开. 2.1 分布分析 分 ...

  3. linux内核剖析(七)Linux进程间通信的几种方式总结

    进程间通信概述 进程通信的目的 数据传输 一个进程需要将它的数据发送给另一个进程,发送的数据量在一个字节到几M字节之间 共享数据 多个进程想要操作共享数据,一个进程对共享数据 通知事 一个进程需要向另 ...

  4. Elasticsearch模糊查询

    前缀查询 匹配包含具有指定前缀的项(not analyzed)的字段的文档.前缀查询对应 Lucene 的 PrefixQuery . 案例 GET /_search { "query&qu ...

  5. 初尝 nginx

    第一次尝试用 nginx,记录下几个简单命令: // 启动 start nginx // 测试并设置配置文件 nginx -t -c conf\nginx.conf // 修改配置文件后重载 ngin ...

  6. Django Rest Framework(认证、权限、限制访问频率)

    阅读原文Django Rest Framework(认证.权限.限制访问频率) django_rest_framework doc django_redis cache doc

  7. 【将门创投】AI 往期技术分享

    计算机视觉 1. 嘉宾:商汤科技CEO 徐立 文章回顾:计算机视觉的完整链条,从成像到早期视觉再到识别理解 2. 嘉宾:格灵深瞳CTO 赵勇 文章回顾:计算机视觉在安防.交通.机器人.无人车等领域的应 ...

  8. C语言 · 积分之迷

    标题:积分之迷 小明开了个网上商店,卖风铃.共有3个品牌:A,B,C. 为了促销,每件商品都会返固定的积分. 小明开业第一天收到了三笔订单: 第一笔:3个A + 7个B + 1个C,共返积分:315 ...

  9. 了解cron以及使用cron定时备份MySQL

    cron是一个linux下的定时执行工具,可以在无需人工干预的情况下运行作业.由于Cron 是Linux的内置服务,但它不自动起来,可以用以下的方法启动.关闭这个服务: /sbin/service c ...

  10. BarTender 2016如何导出模板为pdf文件?

    最近有小伙伴来问,BarTender 2016能不能导出模板为pdf文件?这个是可以的,之前针对BarTender 10.1就介绍过一种方法了.本文,小编再针对BarTender 2016给大家讲下如 ...