PostgreSQL 9.6.1安裝

來源:互聯網
上載者:User

標籤:postgresql 安裝

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 an ISO/ANSI C compiler (at least C89-compliant). Recent versions of GCC are 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, 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 -zxvf postgresql-9.6.1.tar.gz


Install

  cd postgresql-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)

[[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 "english".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

串連測試

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


本文出自 “DBA Fighting!” 部落格,請務必保留此出處http://hbxztc.blog.51cto.com/1587495/1878425

PostgreSQL 9.6.1安裝

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.