Install and configure PostgreSQL in centos

Source: Internet
Author: User
Tags postgresql version
PostgreSQL is a very complex object-relational database management system (ORDBMS). It is also currently the most powerful, feature-rich and complex free software database system.

PostgreSQL is a very complex object-relational database management system (ORDBMS). It is also currently the most powerful, feature-rich and complex free software database system.

I. Introduction

PostgreSQL is a very complex object-relational database management system (ORDBMS). It is also currently the most powerful, feature-rich and complex free software database system. Some features are not even available in commercial databases. This database research program originated from Berkeley (BSD) has now been developed into an international development project and has a wide range of users.

Ii. System Environment

System Platform: CentOS release 6.3 (Final)

PostgreSQL version: PostgreSQL 9.2.4

Firewall disabled/iptables: Firewall is not running.

SELINUX = disabled

Iii. Installation Method

A. Install the RPM package

B. Install yum

C. Install the source code package

------------------------------------ Lili split line ------------------------------------

PostgreSQL cache details

Compiling PostgreSQL on Windows

Configuration and installation of LAPP (Linux + Apache + PostgreSQL + PHP) Environment in Ubuntu

Install and configure phppgAdmin on Ubuntu

Install PostgreSQL9.3 on CentOS

Configure a Streaming Replication cluster in PostgreSQL

------------------------------------ Lili split line ------------------------------------

Iv. Installation Process

A. Install the RPM package

1. Check whether PostgreSQL has been installed

# Rpm-qa | grep postgres

If it has been installed, run the rpm-e command to uninstall it.

2. Download the RPM package

# Wget

# Wget

# Wget

# Wget

3. Install PostgreSQL. Pay attention to the installation sequence.

# Rpm-ivh postgresql92-libs-9.2.4-1PGDG.rhel6.i686.rpm
# Rpm-ivh postgresql92-9.2.4-1PGDG.rhel6.i686.rpm
# Rpm-ivh postgresql92-server-9.2.4-1PGDG.rhel6.i686.rpm
# Rpm-ivh postgresql92-contrib-9.2.4-1PGDG.rhel6.i686.rpm

4. initialize the PostgreSQL database

Initialization is prompted when the PostgreSQL service is started for the first time.

Initialize Database

# Service postgresql-9.2 initdb

5. Start the service

# Service postgresql-9.2 start

6. Add the PostgreSQL service to the startup list.

# Chkconfig postgresql-9.2 on

# Chkconfig -- list | grep postgres

7. Modify the PostgreSQL database user's postgres password (note that it is not a linux Account)

By default, PostgreSQL creates an ipvs database user as the database administrator. The default password is blank. We need to change it to the specified password, which is set to 'ipvs '.

# Su-postgres

$ Psql

### Pg_shadow;

8. Test the database

8.1 create a Test Database

# Create database david;

8.2 switch to the david Database

# \ C david

8.3 create a test table

David = # create table test (id integer, name text );

8.4 insert Test Data

David); david = #

8.5 select data

David test; id | name david (1 row) david = #

The test is complete. The RPM package is successfully installed.

9. Modify the linux User's postgres Password

By default, PostgreSQL creates a linux user named ipvs and uses the passwd command to set the password of the System user to post123.

# Passwd ipvs

10. Modify the PostgreSQL database configuration for remote access

10.1 modify the postgresql. conf file

# Vi/var/lib/postgresql/9.2/data/postgresql. conf

If you want PostgreSQL to listen to the entire network, remove the # Before listen_addresses and change listen_addresses = 'localhost' to listen_addresses = '*'

10.2 modify the client authentication configuration file pg_apps.conf

Add the IP address or address segment that requires remote database access to the file.

# Vi/var/lib/pgsql/9.2/data/pg_assist.conf

11. Restart the service to make the settings take effect.

# Service postgresql-9.2 (restart)

12. Remote Test connection

Connection successful.

For more details, please continue to read the highlights on the next page:

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.