Install and configure PostgreSQL on Red Hat 7.0

Source: Internet
Author: User

Install and configure PostgreSQL on Red Hat 7.0
Wang linsong/(chinabyte)
PostgreSQL was initially a database management system developed by the Department of Computer Science at the University of California, Berkeley. It proposed many object-relational databases concepts, even earlier than today's many commercial databases. It supports features such as sql92/sql3 language, transaction integrity, and extensible types. PostgreSQL is an open source code successor developed based on the Berkeley code earlier.


PostgreSQL is a free database management system (DBMS) Widely used in the Unix world. Whether it supports features or its performance, it can compare with other commercial databases. Because it is written in C language, it is very convenient to transplant different Unix systems, so PostgreSQL can run on many platforms, including: solaris, Aix, sco unix, hp unix, Linux, and FreeBSD.

As the world's most widely used database system, PostgreSQL is becoming increasingly accepted by more and more people. Now, I will introduce how to apply PostgreSQL on Redhat Linux 7.0. I have read a lot of books about installing and configuring PostgreSQL. Note that there are many problems with some techniques. Now, I will introduce how to apply PostgreSQL on Redhat Linux 7.0.

Before installing and configuring PostgreSQL, your computer must meet the following requirements:

  • You have installed Red Hat 7.0.
  • PostgreSQL is not currently installed.
  • Gnome has been installed (I like gnome ).
  • You have installed linuxconf.
  • You have the root permission.

The following content includes:

  • Install the PostgreSQL server and client.
  • Postmaster configuration and option description.
  • Create users and databases.
  • Access the database from other computers.

1: Obtain PostgreSQL

1) required files:

    A postgresql-server-7.0.2-17.i386.rpm
    B postgresql-7.0.2-17.i386.rpm
    Php-pgsql-4.0.1pl2-9.i386.rpm C

2) Optional files:

    A postgresql-devel-7.0.2-17.i386.rpm
    B postgresql-jdbc-7.0.2-17.i386.rpm
    Postgresql-odbc-7.0.2-17.i386.rpm C
    D postgresql-perl-7.0.2-17.i386.rpm
    Postgresql-python-7.0.2-17.i386.rpm E
    F postgresql-tcl-7.0.2-17.i386.rpm (recommended)
    G postgresql-tk-7.0.2-17.i386.rpm (this is part of postgresql-tcl-7.0.2-17.i386.rpm)
    H phpPgAdmin_2-2-1-pl1.tar.gz (: http://www.greatbridge.org/project/phppgadmin/projdisplay.php)

2: Install PostgreSQL

    1) Use gnorpm In The GNOME desktop environment or command line rpm-IVH to install all. RPM files.
    2) Move the phppgamin file to a directory based on your own situation.
    3) decompress the tar-xzf phpPgAdmin_2-2-1-pl1.tar.gz in the directory of the phppgamin file with the command.

Step 3: Configure Postmaster and describe options

Postmaster has many configuration options. I will briefly describe the main configuration options.

    1)-B = set the value of the shared memory disk buffer (at least twice the number of server processes ).
    2)-D = specifies the database directory.
    3)-N = sets the maximum number of worker s server processes.
    4)-S = start postmaster in static mode (no debugging information ).
    5)-D = debugging level.
    6)-I = open the TCP/IP port of the remote connection.
    7)-L = enables SSL secure connections.
    8)-O = the option passed to the server process.
    9)-P = specifies the open TCP/IP Port through Option-I.

3: Start PostgreSQL

    1) type linuxconf on the command line.
    2) Click control.
    3) Expand the control panel and click control service activity (control service behavior ).
    4) Select PostgreSQL in the service list.
    5) Click Start ).
    6) if everything goes smoothly, it should be able to start normally.
    7) Disable linuxconf.

If you want to set PostgreSQL to be started by default when the system is started, the easiest way is to use the setup tool.

After PostgreSQL is started, enter/var/lib/pgsql/data. You will find a file named postmaster. opts. This file briefly describes the options currently used by Postmaster, as shown below:

/usr/bin/postmaster
-p 5432
-D /var/lib/pgsql/data
-B 64
-b /usr/bin/postgres
-i
-N 32

During the use, I found that 32 server processes are far from enough. Therefore, I increased the number of server processes to 128. At the same time, the buffer is also changed to 512 to provide a buffer space of 4 MB. Edit the postmaster. opts. default file. The directory is/var/lib/pgsql/data. The changed configuration file should include the following:

-B 512-I-n 128

Go back to step 4 and restart ipvs and check the postmaster. opts file. It should be as follows:

/ usr / bin / postmaster
-p 5432
-D / var / lib / pgsql / data
-B 512
-b / usr / bin / postgres
-I
-N 128
If other problems occur, I recommend not to change any other options. 

4: Allow Remote Computer Connection

    1) in the following example, I will allow all computer users from 192.168.0.1 to access all databases.
    2) to achieve this, we only need to edit the pg_cmd.conf file.
    3) The pg_cmd.conf file is in the/var/lib/pgsql/data directory.
    4) Open and edit the file, and add the following line at the end of the file:

Host All 192.168.0.1 255.255.255.0 Trust

For the sake of security, I strongly recommend that you set permissions for all databases and set whether users modify Database permissions. The most important thing is that you must know whether users with the maximum permissions exist, you have the right to create other users that can access the entire ipvs system.

All in all, the installation and configuration of postgresql are not very difficult, mainly to see how users apply the PostgreSQL database. For PostgreSQL database applications, please refer to other professional books.


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.