PostgreSQL 9 Source Installation

Source: Internet
Author: User
Tags bz2 locale postgresql psql readline

Installation process:

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(Size of control table)

Set the segment Size,in gigabytes,large tables is 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 fo R most Situnations;but other values is Usefulin special cases,the value must be a power of 2 between 1 and (Jukobyrt ES).

--with-wal-segsize=segsize

Set the WAL segment Size,in Megabytes,this is the size of each Individaul file in the the Wal log.it could be useful to adjust T His size to control the granularity of Wal log shipping.the default size is megabytes.the value must being a power of 2 be Tween 1 and (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 suit Able for more situations;but other values is useful in special cases.the value must be a power of W between 1 and (K Ilobytes).

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 (DB initialization)

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

In file system Terms,a database cluster is a single directory under which all data would be stored.we call the The DA Ta direcotry or data area.

As a 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 --front-end startup mode, exit PG

postgres-d/usr/local/pgsql/data >logfile 2>&1 & --Background start mode

Pg_ctl start-l LogFile

Installation Document 1:

[[email protected] pg952]# tar-jxvf postgresql-9.5 .2.tar.bz2

[[email protected] pg952]# cd postgresql-9.5.2

[[email]  protected] pg952]# cat INSTALL |more

[[email protected] pg952]# mkdir/pg952

[[email protected] pg952]#./configure--prefix=/pg952/

[[email  Protected] pg952]# gmake world

[[email protected] pg952]# gmake install-world

[[email protected] pg952]# ID postgres

[[email protected] pg952]# chown-r postgres:postgres/pg952/

[[email protected] pg952]# initdb-d/usr/local/pgsql/ data/--locale=c--encoding=utf8

[[email protected] pg952]# pg_ctl start-l logfile

Installation Document 2:

Linux system dependent packages:

[Email protected] ~]# gcc--version

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

Copyright (C) Free Software Foundation, Inc.

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

Warranty Not even to merchantability or FITNESS for A particular PURPOSE.

[email protected] ~]# make --version

GNU make 3.81

Copyright (C) 2006 free Software Foundation, Inc.

This was free software; See the source for copying conditions.

There is NO warranty; Not even to merchantability or FITNESS for A

Particular PURPOSE.

This program built for X86_64-REDHAT-LINUX-GNU

[Email protected] ~]# 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

[Email protected] ~]# Rpm-qa|grep zlib

Zlib-1.2.3-29.el6.x86_64

zlib-devel-1.2.3-29.el6.x86_64

Installing PostgreSQL 5.2

[Email protected] mnt]# TAR-JXVF postgresql-9.5.2.tar.bz2

[Email protected] mnt]# CD postgresql-9.5.2

[Email protected] postgresql-9.5.2]#/configure--prefix=/pg952/

[email protected] postgresql-9.5.2]# make world

[email protected] postgresql-9.5.2]# make Install-world

[Email protected] pg952]# cd/pg952/

[email protected] pg952]# LL

Total 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

[[email protected] pg952]# ID postgres

Uid=26 (Postgres) gid=26 (postgres) groups=26 (postgres) Context=root:system_r:unconfined_t:systemlow-systemhigh

[Email protected] pg952]# chown-r postgres:postgres/pg952/

[Email protected] pg952]# ll/pg952/

Total 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

[Email protected] pg952]# Su-postgres

-bash-3.2$ vim. Bash_profile--Add the following environment variables

[-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 --Initialize database

-bash-3.2$ Vim postgresql.conf--Modify the configuration file

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

listen_addresses = ' * '

-bash-3.2$ Vim pg_hba.conf--Modify the configuration file

# IPV4 Local connections:

Host All 127.0.0.1/32 Trust

Host all 192.168.72.0/24 MD5

-bash-3.2$ pg_ctl start-l $PGHOME/logfile 2>&1 >/dev/null --Start the database

Note: Pg_ctl Start|status|stop|restart for database startup

-bash-3.2$ Ps-ef|grep Post--View database status

-bash-3.2$ Cat LogFile

-bash-3.2$ ps-f-U postgres

To connect to a database:

-bash-3.2$ Psql--Local connection

Psql (9.5.2)

Type ' help ' for help.

postgres=# \l

..........

postgres-# \password--Modify PG Password

Enter New Password:

Enter It again:

C:\users\wangwc>psql-h 192.168.72.130-u postgres-d Oracle-Remote Connection

Postgresql Shared Memory Usage:

U Sage

A pproximate 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 Source Installation

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.