rhel7.2+postgresql9.6.1
Requirements Softwares
1.GNU make version 3.80 or newer is required
[email protected] ~]# make--version
GNU make 3.82
Built for X86_64-redhat-linux-gnu
2.You need a iso/ansi C compiler (at least c89-compliant). Recent versions of GCC is recommended
[Email protected] ~]# gcc--version
GCC (gcc) 4.8.5 20150623 (Red Hat 4.8.5-4)
3. Tar is required to unpack the source distribution, with addition to either gzip or bzip2.
4.The GNU Readline Library is used by default.
ReadLine
Readline-devel
Libedit
Optional
Perl 5.8 or later
Python
Kerberos
Openssl
OpenLDAP
and/or PAM
Flex 2.5.31 or later
Bison 1.875 or later
Useradd Pguser
Su-pguser
TAR-ZXVF postgresql-9.6.1.tar.gz
Install
CD postgresql-9.6.1
./configure
The default installation directory /usr/local/pgsql, can be modified with --prefix=path ,./configure--help
Make
The last line displayed should is:
All of PostgreSQL successfully made. Ready to install.
SU (installed with root)
Make install
PostgreSQL installation complete.
Set the environment variables for Pguser
Mkdir/usr/local/pgsql/data #PostgreSQL数据存储目录
Chown Pguser:pguser/usr/local/pgsql/data
Export Ld_library_path=/usr/local/pgsql/lib
Export Pg_home=/usr/local/pgsql
Export path= $PG _home/bin/: $PATH
Export Pgdata=/usr/local/pgsql/data
Initilize the DBServer
(using Pguser)
[[Email protected] ~]$ initdb -d /usr/local/pgsql/datathe files belonging to this database system will be owned by user "Pguser". 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 "中文版". data page checksums are disabled.fixing permissions on existing Directory /usr/local/pgsql/data ... okcreating subdirectories ... okselecting default max_connections ... 100selecting default shared_buffers ... 128mbselecting dynamic shared memory implemEntation ... posixcreating configuration files ... okrunning bootstrap script ... okperforming post-bootstrap initialization ... oksyncing data to disk ... okwarning: enabling "Trust" authentication for local connectionsyou 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: pg_ctl -d /usr/local/pgsql/data -l logfile start
Start the dbserver
[[email protected] ~]$ postgres -d /usr/local/pgsql/data >logfile 2> &1 &[1] 13799[[email protected] ~]$ ps -ef |grep postgrepguser 13799 4377 0 12:37 pts/0 00:00:00 postgres -D /usr/local/pgsql/datapguser 13801 13799 0 12:37 ? 00:00:00 postgres: checkpointer process pguser 13802 13799 0 12:37 ? 00:00:00 postgres: writer process pguser 13803 13799 0 12:37 ? 00:00:00 postgres: wal writer process pguser 13804 13799 0 12:37 ? 00:00:00 postgres: autovacuum launcher process pguser 13805 13799 0 12:37 ? 00:00:00 postgres: stats collector process pguser 13807 4377 0 12:37 pts/0 00:00:00 grep --color=auto postgre
Connection Test
[[email protected] ~]$ psql --list list of databases name | owner | encoding | collate | ctype | Access privileges -----------+--------+----------+-------------+----- --------+------------------- postgres | pguser | UTF8 | en_us. Utf-8 | en_us. Utf-8 | template0 | pguser | utf8 | en_ US. Utf-8 | en_us. utf-8 | =c/pguser + | | | | | pguser=CTc/pguser template1 | pguser | UTF8 | en_us. Utf-8 | en_us. utf-8 | =c/pguser + | | | | | pguser=ctc/pguser ( 3 rows) [[email protected] ~]$ psql postgrespsql (9.6.1) Type "Help" for help.postgres=# select version (); version -------------------------------------------------------------------------------- ------------------------- postgresql 9.6.1 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (red hat 4.8.5-4), 64-bit (1 row) postgres=# select current_date; date ------------  2016-12-01 (1 row) postgrEs=# \q
This article is from the "DBA fighting!" blog, so be sure to keep this source http://hbxztc.blog.51cto.com/1587495/1878425
PostgreSQL 9.6.1 Installation