PostgreSQL 9.6.1源码安装

发布时间:2020-06-30 发布网站:脚本之家
价值2580元廖雪峰前端视频终终终于免费啦!
脚本之家收集整理的这篇文章主要介绍了PostgreSQL 9.6.1源码安装脚本之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

RHEL7.2+PostgreSQL9.6.1


Requirements softwares

1.GNU make version 3.80 or newer is required

[root@rhel7 ~]# make --version

GNU Make 3.82

Built for x86_64-redhat-linux-gnu

2.You need an ISO/ANSI C compiler (at least C89-compliant). Recent versions of GCC are recommended

[root@rhel7 ~]# gcc --version

gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-4)

3. tar is required to unpack the source distribution,in 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 -zxvfpostgresql-9.6.1.tar.gz


Install

cdpostgresql-9.6.1

./configure

默认安装目录/usr/local/pgsql,可以使用--prefix=path进行修改,./configure --help

make

The last line displayed should be:
All of PostgreSQL successfully made. Ready to install.

su (使用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

(使用pguser)

[pguser@rhel7~]$initdb-D/usr/local/pgsql/data
Thefilesbelongingtothisdatabasesystemwillbeownedbyuser"pguser".
Thisusermustalsoowntheserverprocess.

Thedatabaseclusterwillbeinitializedwithlocale"en_US.UTF-8".
Thedefaultdatabaseencodinghasaccordinglybeensetto"UTF8".
Thedefaulttextsearchconfigurationwillbesetto"english".

Datapagechecksumsaredisabled.

fixingpermissionsonexistingdirectory/usr/local/pgsql/data...ok
creatingsubdirectories...ok
selectingdefaultmax_connections...100
selectingdefaultshared_buffers...128MB
selectingdynamicsharedmemoryimplementation...posix
creatingconfigurationfiles...ok
runningbootstrapscript...ok
performingpost-bootstrapinitialization...ok
syncingdatatodisk...ok

WARNING:enabling"trust"authenticationforlocalconnections
Youcanchangethisbyeditingpg_hba.conforusingtheoption-A,or
--auth-localand--auth-host,thenexttimeyouruninitdb.

Success.Youcannowstartthedatabaseserverusing:

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

Start the DBServer

[pguser@rhel7~]$postgres-D/usr/local/pgsql/data>logfile2>&1&
[1]13799
[pguser@rhel7~]$ps-ef|greppostgre
pguser137994377012:37pts/000:00:00postgres-D/usr/local/pgsql/data
pguser1380113799012:37?00:00:00postgres:checkpointerprocess
pguser1380213799012:37?00:00:00postgres:writerprocess
pguser1380313799012:37?00:00:00postgres:walwriterprocess
pguser1380413799012:37?00:00:00postgres:autovacuumlauncherprocess
pguser1380513799012:37?00:00:00postgres:statscollectorprocess
pguser138074377012:37pts/000:00:00grep--color=autopostgre

连接测试

[pguser@rhel7~]$psql--list
Listofdatabases
Name|Owner|Encoding|Collate|Ctype|Accessprivileges
-----------+--------+----------+-------------+-------------+-------------------
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
(3rows)

[pguser@rhel7~]$psqlpostgres
psql(9.6.1)
Type"help"forhelp.

postgres=#selectversion();
version
---------------------------------------------------------------------------------------------------------
PostgreSQL9.6.1onx86_64-pc-linux-gnu,compiledbygcc(GCC)4.8.520150623(RedHat4.8.5-4),64-bit
(1row)

postgres=#selectcurrent_date;
date
------------
2016-12-01
(1row)

postgres=#\q

官方文档:https://www.postgresql.org/docs/9.6/static/installation.html

总结

以上是脚本之家为你收集整理的PostgreSQL 9.6.1源码安装全部内容,希望文章能够帮你解决PostgreSQL 9.6.1源码安装所遇到的程序开发问题。

如果觉得脚本之家网站内容还不错,欢迎将脚本之家网站推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您喜欢交流学习经验,点击链接加入脚本之家官方QQ群:1065694478