Install PostgreSQL 9.1 On centos

Source: Internet
Author: User
Tags psql


PostgreSQL, also known as Postgres, is a relational database management system applicable to various Linux operating systems, windows, Solaris, BSD, and Mac OS X. PostgreSQL follows the PostgreSQL license and is an open source software. PostgreSQL is developed by the PostgreSQL Global Development Group and consists of a small number of companies that volunteer to supervise and manage these companies, including RedHat and enterprisedb.



PostgreSQL is becoming more and more popular, so it is taken for granted that it is so reliable and efficient. Compared with traditional enterprise-level relational databases, PostgreSQL is fully based onCommunityDriven by a variety of tools and documents, forming a complete ecosystem.






The following describes how to install PostgreSQL 9.1 On centos:



1. Add posgresql Yum repository to access ingress,postgresql vs mysql.



[Root @ SNDA-192-168-15-161 SRC] # wget http://yum.pgrpms.org/9.1/redhat/rhel-6-x86_64/pgdg-centos91-9.1-4.noarch.rpm
-- 16:56:19 -- http://yum.pgrpms.org/9.1/redhat/rhel-6-x86_64/pgdg-centos91-9.1-4.noarch.rpm
Resolving yum.pkgms.org... 98.129.198.114
Connecting to yum.pkgms.org | 98.129.198.114 |: 80... connected,postgresql download.
HTTP request sent, awaiting response... 200 OK
Length: 5124 (5.0 K) [application/X-RedHat-package-manager]
Saving to: â €20.pgdg-centos91-9.1-4.noarch.rpm â €



100% [============================================== >] 5,124 18.7 K/s in 0.3 s



16:56:19 (18.7 kb/s)-â € pgdg-centos91-9.1-4.noarch.rpm â €


[Root @ SNDA-192-168-15-161 SRC] # ls-l
Total 17644
Drwxr-XR-x 9 1001 1001 4096 Aug 18 nginx-1.2.1
-RW-r -- 1 Root 718161 Jun 5 nginx-1.2.1.tar.gz
Drwxr-XR-x 8 Root 4096 Aug 18 nginx_tcp_proxy_module postgresql update
-RW-r -- 1 Root 4164 Dec 19 2011 nodejs-stable-release.noarch.rpm
-RW-r -- 1 Root 1484480 Aug 18 node-v0.9.0.tar.gz
Drwxr-XR-x 7 1169 1169 4096 Aug 18 pcre-8.20
Drwxr-XR-x 8 1169 1169 12288 Aug 18 pcre-8.30
-RW-r -- 1 Root 1635262 Aug 18 pcre-8.30.tar.gz
-RW-r -- 1 Root 5124 Sep 26 2011 pgdg-centos91-9.1-4.noarch.rpm
Drwxr-x --- 18 1000 1002 4096 Aug 18 Python-2.7.3
-RW-r -- 1 Root 14135620 Apr 10 Python-2.7.3.tgz
-RW-r -- 1 Root 539 Aug 18 21:37 wget-Log
[Root @ SNDA-192-168-15-161 SRC] # rpm-uvh pgdg-centos91-9.1-4.noarch.rpm
Warning: pgdg-centos91-9.1-4.noarch.rpm: Header V4 DSA/sha1 signature, key ID 442df0f8: nokey
Preparing... ######################################## ### [100%]
1: pgdg-centos91 ####################################### #### [100%]


Modify the original Yum repository configuration and append exclude = PostgreSQL * at the end of [base] and [updates] to cancel the installation and update of postgresql from the default repository.
[Root @ SNDA-192-168-15-161 SRC] # cd/etc/yum. Repos. d
[Root @ SNDA-192-168-15-161 yum. Repos. d] # vi CentOS-Base.repo


Install or upgrade postgresql-libs
[Root @ SNDA-192-168-15-161 yum. Repos. d] # Yum upgrade postgresql-libs install postgresql
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
* Base: mirrors.grandcloud.cn
* Extras: mirrors.grandcloud.cn
* Updates: mirrors.grandcloud.cn
Base | 3.7 KB
Extras | 3.0 kb: 00
Nodejs-stable | 2.9 KB: 00
Pgdg91 | 2.8 kb: 00
Pgdg91/primary_db | 119 KB
Updates | 3.5 kb: 00
Updates/primary_db | 2.3 MB
Setting up upgrade process
No match for argument: postgresql-libs
No package postgresql-libs available.
No packages marked for update


install PostgreSQL server
[root @ SNDA-192-168-15-161 yum. repos. d] # Yum install postgresql91-server
loaded plugins: fastestmirror, security
loading mirror speeds from cached hostfile
* base: mirrors.grandcloud.cn
* extras: mirrors.grandcloud.cn
* updates: mirrors.grandcloud.cn
setting up install Process
resolving dependencies
--> running transaction check
---> package postgresql91-server.x86_64 0: 9. 1.5-1pgdg. rhel6 will be installed install postgresql ubuntu
--> processing dependency: postgresql91 = 9.1.5-1pgdg. rhel6 for package: postgresql91-server-9.1.5-1PGDG.rhel6.x86_64
--> processing dependency: libpq. so.5 () (64bit) for package: postgresql91-server-9.1.5-1PGDG.rhel6.x86_64
--> running transaction check
---> package restart sql91.x86 _ 64. 1.5-1pgdg. rhel6 will be installed
---> package postgresql91-libs.x86_64. 1.5-1pgdg. rhel6 will be installed
--> finished dependency resolution



Dependencies resolved


========================================================== ==========================================================
Package arch version repository size
========================================================== ==========================================================
Installing:
Postgresql91-server x86_64 9.1.5-1pgdg. rhel6 pgdg91 3.6 m
Installing for dependencies:
Postgresql91 x86_64 9.1.5-1pgdg. rhel6 pgdg91 990 K
Postgresql91-libs x86_64 9.1.5-1pgdg. rhel6 pgdg91 188 K


Transaction Summary
========================================================== ==========================================================
Install 3 package (s)


Total download size: 4.7 m
Installed size: 20 m
Is this OK [Y/n]: Y
Downloading packages:
(1/3): postgresql91-9.1.5-1PGDG.rhel6.x86_64.rpm | 990 KB
(2/3): postgresql91-libs-9.1.5-1PGDG.rhel6.x86_64.rpm | 188 KB
(3/3): postgresql91-server-9.1.5-1PGDG.rhel6.x86_64.rpm | 3.6 MB
--------------------------------------------------------------------------------
Total 90 kb/s | 4.7 MB
Running rpm_check_debug
Running transaction Test
Transaction test succeeded
Running transaction
Warning: rpmdb altered outside of yum.
Installing: postgresql91-libs-9.1.5-1PGDG.rhel6.x86_64 1/3
Installing: postgresql91-9.1.5-1PGDG.rhel6.x86_64 2/3
Installing: postgresql91-server-9.1.5-1PGDG.rhel6.x86_64 3/3
Verifying: postgresql91-libs-9.1.5-1PGDG.rhel6.x86_64 1/3
Verifying: postgresql91-server-9.1.5-1PGDG.rhel6.x86_64 2/3
Verifying: postgresql91-9.1.5-1PGDG.rhel6.x86_64 3/3


Installed:
Postgresql91-server.x86_64. 1.5-1pgdg. rhel6



Dependency installed:
Postgresql91.x86 _ 64. 1.5-1pgdg. rhel6
Postgresql91-libs.x86_64. 1.5-1pgdg. rhel6



Complete!



Initialize the database. The default path is/var/lib/pgsql/9.1/data.
[Root @ SNDA-192-168-15-161 yum. Repos. d] # service postgresql-9.1 (initdb)
Initializing Database: [OK]



Start the service
[Root @ SNDA-192-168-15-161 yum. Repos. d] # service postgresql-9.1 start
Starting postgresql-9.1 service: [OK]



[Root @ SNDA-192-168-15-161 yum. Repos. d] # vi/var/lib/pgsql/9.1/data/pg_cmd.conf
[Root @ SNDA-192-168-15-161 yum. Repos. d] # Psql-u Postgres
Psql: Fatal: Peer authentication failed for user "s"



Restart service
[Root @ SNDA-192-168-15-161 yum. Repos. d] # service postgresql-9.1 restart
Stop Ping postgresql-9.1 service: [OK]
Starting postgresql-9.1 service: [OK]



(Modify the configuration file/var/lib/pgsql/9.1/data/pg_assist.conf to change peer or other information to trust. Otherwise, the error "peer authentication failed for user" will be prompted "), modify the client authentication configuration file and change the method from the default ident to MD5.
[Root @ SNDA-192-168-15-161 yum. Repos. d] # Psql-u Postgres
Psql (9.1.5)
Type "help" for help.



S = # alter User Login s with password 'admin'
Postgres-# \ q



 



Engine Yard: PostgreSQL is our first choice



PostgreSQL interface programming 2:. netdataprovider -- npgsql driver



Http://www.codeproject.com/Articles/30989/Using-PostgreSQL-in-your-C-NET-application-An-intr



Http://datachomp.com/archives/getting-started-with-postgres-and-mvc3/



Http://www.pgadmin.org/


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.