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: 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 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |