PostgreSQL is usually referred to as Postgres. It is a relational database management system, suitable for various Linux operating systems, Windows, Solaris, BSD and Mac OS X. PostgreSQL is an open source software under the PostgreSQL license. PostgreSQL is developed by the PostgreSQL Global Development Group, and is composed and supervised by a very small number of companies, such as Red Hat and EnterpriseDB.
PostgreSQL's popularity is getting bigger and bigger, and this is a matter of course: it is so reliable and efficient. Compared with traditional enterprise-level relational databases, PostgreSQL is completely based on community-driven, with rich tools and documents, and forms a complete ecosystem.
The following is the process of installing PostgreSQL 9.1 on CentOS:
[ 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
100 %[======================================>] 5,124 18.7K/s in 0.3s
2012- 08- 25 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 19:47 nginx-1.2.1
Modify the original yum warehouse configuration, add exclude=postgresql* at the end of the [base] and [updates] sections to cancel the installation and update of PostgreSQL from the default warehouse.
[ 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
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
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
Running transaction check
Package postgresql91-server.x86_64 0:9.1.5-1PGDG.rhel6 will be installed
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 postgresql91.x86_64 0:9.1.5-1PGDG.rhel6 will be installed
Package postgresql91-libs.x86_64 0:9.1.5-1PGDG.rhel6 will be installed
Finished Dependency Resolution
Dependencies Resolved
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
Install 3 Package(s)
Total 90 kB/s | 4.7 MB 00:54
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 0:9.1.5-1PGDG.rhel6
Dependency Installed:
postgresql91.x86_64 0:9.1.5-1PGDG.rhel6
postgresql91-libs.x86_64 0:9.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 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_hba.conf
[ root@SNDA-192-168-15-161 yum.repos.d]# psql -U postgres
psql: FATAL: Peer authentication failed for user "postgres"
Restart service
[ root@SNDA-192-168-15-161 yum.repos.d]# service postgresql-9.1 restart
Stopping postgresql-9.1 service: [ OK ]
Starting postgresql-9.1 service: [ OK ]
( Here you need to modify the configuration file /var/lib/pgsql/9.1/data/pg_hba.conf first to change the peer or other to trust, otherwise it will prompt the error Peer authentication failed for user “postgres”), modify the client authentication configuration file, Change 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.
postgres=# ALTER USER postgres WITH PASSWORD 'admin'
postgres-# \q
Engine Yard: PostgreSQL is our first choice
PostgreSQL interface programming 2: .NetDataProvider-Npgsql driver
http://blog.csdn.net/beiigang/article/details/7051625
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/
Recommended Posts