在CentOS 6.3 安裝postgresql9.5

來源:互聯網
上載者:User

標籤:aries   ons   create   x86   系統   檔案   creating   rip   and   

一、安裝準備

需要安裝的包:

      yum install postgresql95-devel-9.5.5-1PGDG.rhel6.x86_64.rpm

     檔案可以從官網下載。http://yum.postgresql.org/repopackages.php

作業系統:

     CentOS release 6.3 (Final)

     安裝時如果提示yum源不對,注意調整rpm源如下:

          

[[email protected] yum.repos.d]# cat pgdg-95-redhat.repo
[pgdg95]
name=PostgreSQL 9.5 $releasever - $basearch
baseurl=https://download.postgresql.org/pub/repos/yum/9.5/redhat/rhel-$releasever-$basearch
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG-95

[pgdg95-source]
name=PostgreSQL 9.5 $releasever - $basearch - Source
failovermethod=priority
baseurl=https://download.postgresql.org/pub/repos/yum/srpms/9.5/redhat/rhel-$releasever-$basearch
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG-95

 

 

二、開始安裝:

      yum install postgresql95-devel-9.5.5-1PGDG.rhel6.x86_64.rpm

      yum install postgresql95-server postgresql95-contrib

三、初始化資料庫:

  mkdir -p /data/postgres/pgsql/data

  chown -R postgres.postgres /data/postgres/

   (1)先切換到postgres使用者

  [[email protected] yum.repos.d]# su - postgres


   (2)如果初始化成功,會有如下提示:

-bash-4.1$ /usr/pgsql-9.5/bin/initdb -D /data/postgres/pgsql/data
The files belonging to this database system will be owned by user "postgres".
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 /data/postgres/pgsql/data ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting dynamic shared memory implementation ... posix
creating configuration files ... ok
creating template1 database in /data/postgres/pgsql/data/base/1 ... ok
initializing pg_authid ... ok
initializing dependencies ... ok
creating system views ... ok
loading system objects‘ descriptions ... ok
creating collations ... ok
creating conversions ... ok
creating dictionaries ... ok
setting privileges on built-in objects ... ok
creating information schema ... ok
loading PL/pgSQL server-side language ... ok
vacuuming database template1 ... ok
copying template1 to template0 ... ok
copying template1 to postgres ... ok
syncing data to disk ... ok

WARNING: enabling "trust" authentication for local connections
You 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:

/usr/pgsql-9.5/bin/pg_ctl -D /data/postgres/pgsql/data -l logfile start

-bash-4.1$

四、啟動資料庫:

$ /usr/pgsql-9.5/bin/pg_ctl -D /data/postgres/pgsql/data -l /tmp/postrest.log start
server starting

 

五、建立db

createdb mysql2gp_sy

 

六、登入資料庫:

$ psql -h 127.0.0.1 -d mysql2gp_sy -U postgres
psql (9.5.6)
Type "help" for help.

mysql2gp_sy=#

 

至此,安裝成功。

    

     

 

在CentOS 6.3 安裝postgresql9.5

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.