Installation and configuration of PostgreSQL under Linux

Source: Internet
Author: User
Tags postgresql postgres database postgresql backup postgresql version

First, Introduction

PostgreSQL is a very complex object-relational database management system (ORDBMS), and is currently the most powerful, feature richest and most complex free software database system. Some features don't even have a commercial database. The Berkeley-based database research program has now become an international development project and has a very wide range of users.

Second, the system environment

System platform: CentOS release 6.3 (Final)

PostgreSQL version: PostgreSQL 9.2.4

The firewall is turned off/iptables:firewall is not running.

Selinux=disabled

Three, installation method

A. Download RPM Package Installation

B. Yum Installation

C. Source Package Installation

Iv. installation Process

A. RPM Package Installation

1. Check if PostgreSQL is installed

If it is already installed, uninstall it using the RPM-E command.

2. Download RPM Package

#wget Http://yum.postgresql.org/9.2/RedHat/rhel-6-i386/postgresql92-server-9.2.4-1PGDG.rhel6.i686.rpm#wget http ://yum.postgresql.org/9.2/redhat/rhel-6-i386/postgresql92-contrib-9.2.4-1pgdg.rhel6.i686.rpm#wget/HTTP/ Yum.postgresql.org/9.2/redhat/rhel-6-i386/postgresql92-libs-9.2.4-1pgdg.rhel6.i686.rpm#wget/HTTP yum.postgresql.org/9.2/redhat/rhel-6-i386/postgresql92-9.2.4-1pgdg.rhel6.i686.rpm

3. Install PostgreSQL, pay attention to the installation sequence


# RPM-IVH postgresql92-9.2.4-1pgdg.rhel6.i686.rpm

# RPM-IVH postgresql92-contrib-9.2.4-1pgdg.rhel6.i686.rpm

4. Initializing the PostgreSQL library

The PostgreSQL service will prompt for initialization when it first starts.

# 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 password of the PostgreSQL database user Postgres (note that it is not a Linux system account)

The PostgreSQL database is created by default to create a Postgres database user as the administrator of the database, the default password is empty, we need to change to the specified password, which is set to ' Postgres '.

# su-postgres$ psql# ALTER USER postgres with PASSWORD ' Postgres '; # select * from Pg_shadow;

8. Testing the Database

8.1 Creating a test database

# CREATE DATABASE David;

8.2 Switch to the David database

# \c David

8.3 Creating a Test table

david=# CREATE TABLE Test (ID integer,name text);

8.4 Inserting test data

8.5 Select data

david=# select * from test; ID | Name  ----+-------  

The test was successful.

for more details, please read on to the next page. Highlights : http://www.linuxidc.com/Linux/2013-10/92111p2.htm

Related reading :

PostgreSQL Delete duplicate data rows in table http://www.linuxidc.com/Linux/2013-07/87780.htm

PostgreSQL database Connection pool Pgbouncer build http://www.linuxidc.com/Linux/2013-06/85928.htm

Windows platform compiled PostgreSQL http://www.linuxidc.com/Linux/2013-05/85114.htm

PostgreSQL Backup Experience Note http://www.linuxidc.com/Linux/2013-04/82812.htm

Installation and configuration of PostgreSQL under Linux

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.