Install postgresql9.1 on centos

Source: Internet
Author: User

The following are related records for installing postgresql9.1 on centos5.5:

(1) download the postgresql9. 1 RPM installation package from the http://yum.pgrpms.org/repopackages.php
[Root @ server1 ~] # WGE Http://yum.pgrpms.org/9.1/redhat/rhel-5-i386/pgdg-centos91-9.1-4.noarch.rpm t
(2) install pgdg-centos91-9.1-4.noarch.rpm
[Root @ server1 ~] # Rpm-I pgdg-centos91-9.1-4.noarch.rpm
(3) Change CentOS-Base.repo
To facilitate the installation of related software for postgresql9.1 via yum, you need to change the CentOS-Base.repo so that Yum list PostgreSQL * can find related software packages for postgresql9.1
You only need to add 'exclude = PostgreSQL * 'in the [base] and [updates] of the CentOS-Base.repo.
The procedure is as follows:
[Root @ server1 ~] # Cd/etc/yum. Repos. d
[Root @ server1 yum. Repos. d] # vi CentOS-Base.repo
[Base]
Name = centos-$ releasever-Base
Using list = http://mirrorlist.centos.org /? Release = $ releasever & arch = $ basearch & repo = OS
# Baseurl = http://ftp.sjtu.edu.cn/centos/?releasever/ OS /?basearch/
Gpgcheck = 1
Gpgkey = file: // etc/pki/rpm-GPG/RPM-GPG-KEY-CentOS-5
Exclude = PostgreSQL *
# Released updates
[Updates]
Name = centos-$ releasever-Updates
Using list = http://mirrorlist.centos.org /? Release = $ releasever & arch = $ basearch & repo = updates
# Baseurl = http://ftp.sjtu.edu.cn/centos/?releasever/updates/?basearch/
Gpgcheck = 1
Gpgkey = file: // etc/pki/rpm-GPG/RPM-GPG-KEY-CentOS-5
Exclude = postgfesql *
# Packages used/produced in the build but not released
(4) Pass Yum list Postgres * To detect related installation packages
[Root @ server1 yum. Repos. d] # Yum list Postgres *
Available packages
Postgresql91.x86 _ 64 9.1.1-1pgdg. rhel6 pgdg91
Postgresql91-contrib.x86_64 9.1.1-1pgdg. rhel6 pgdg91
Postgresql91-debuginfo.x86_64 9.1.1-1pgdg. rhel6 pgdg91
Postgresql91-devel.i686 9.1.1-1pgdg. rhel6 pgdg91
Postgresql91-devel.x86_64 9.1.1-1pgdg. rhel6 pgdg91
Postgresql91-docs.x86_64 9.1.1-1pgdg. rhel6 pgdg91
Postgresql91-jdbc.x86_64 9.1.901-1pgdg. rhel6 pgdg91
Postgresql91-jdbc-debuginfo.x86_64 9.1.901-1pgdg. rhel6 pgdg91
Postgresql91-libs.i686 9.1.1-1pgdg. rhel6 pgdg91
Postgresql91-libs.x86_64 9.1.1-1pgdg. rhel6 pgdg91
Postgresql91-odbc.x86_64 09.000000200-1pgdg. rhel6 pgdg91
Postgresql91-odbc-debuginfo.x86_64 09.000000200-1pgdg. rhel6 pgdg91
Postgresql91-plperl.x86_64 9.1.1-1pgdg. rhel6 pgdg91
Postgresql91-plpython.x86_64 9.1.1-1pgdg. rhel6 pgdg91
Postgresql91-pltcl.x86_64 9.1.1-1pgdg. rhel6 pgdg91
Postgresql91-python.x86_64 4.0-2pgdg. rhel6 pgdg91
Postgresql91-python-debuginfo.x86_64 4.0-2pgdg. rhel6 pgdg91
Postgresql91-server.x86_64 9.1.1-1pgdg. rhel6 pgdg91
Postgresql91-tcl.x86_64 1.9.0-1. rhel6 pgdg91
Postgresql91-tcl-debuginfo.x86_64 1.9.0-1. rhel6 pgdg91
Postgresql91-test.x86_64 9.1.1-1pgdg. rhel6 pgdg91
Postgresql_autodoc.noarch 1.40-1. rhel6 pgdg91
[Root @ server1 yum. Repos. d] #
(6) Use Yum to install postgresql9.1 and related software packages
[Root @ server1 yum. Repos. d] # Yum install postgresql91 postgresql91-devel postgresql91-server postgresql91-libs postgresql91-contrib
(7) initialize and start PostgreSQL
[Root @ server1 yum. Repos. d] # service postgresql-9.1 (initdb)
Initializing Database: [OK]
[Root @ server1 yum. Repos. d] #
[Root @ server1 yum. Repos. d] # service postgresql-9.1 (initdb)
Initializing Database: [OK]
[Root @ server1 yum. Repos. d] #


Notes for installing PostgreSQL:
(1) If initdb fails, it is likely that the system's default character encoding is inconsistent with what PostgreSQL recognizes, in this case, you can use/var/lib/pgsql/9.1/pgstartup. log error information to confirm
If it is determined that the encoding problem causes initdb to fail, you can solve the problem by specifying -- no-locale in initdb. The specific method is as follows:
1.1 [root @ gjz bin] # Su-Postgres
1.2-Bash-3.2 $/usr/local/pgsql/bin/initdb -- no-locale
The files belonging to this database system will be owned by user "stored s ".
This user must also own the server process.
The database cluster will be initialized with locale C.
The default database encoding has accordingly been set to SQL _ascii.
The default text search configuration will be set to "English ".
Fixing permissions on existing Directory/var/lib/pgsql/9.1/data... OK
(2) modify the PostgreSQL. conf and pg_assist.conf files in/var/lib/pgsql/9.1/data and configure the relevant access policies as needed.

References:
(1) http://www.davidghedini.com/pg/entry/install_postgresql_9_on_centos
(2) http://www.linuxfly.org/post/88/
(3)



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.