PostgreSQL installation Configuration

Source: Internet
Author: User

1. download the latest version of postgresql: http://www.postgresql.org/ftp/source/

2. decompress the file:
Tar zxvf postgresql-8.3.7.tar.gz
CD postgresql-8.3.7

3. Configuration:
./Configure -- prefix =/usr/local/pgsql

4. Compile:
Make

5. installation:
Make install

6. create user groups and users:
Groupadd Postgres
Useradd-G Postgres

7. Create a database file storage directory and grant permissions to ipvs:
Mkdir/usr/local/pgsql/Data
CD/usr/local/pgsql
Chown Postgres. Postgres data

8. initialize the database directory:
Switch user
Su-PostgreSQL

Initialize data
/Usr/local/pgsql/bin/initdb-D/usr/local/pgsql/Data

Start Database
/Usr/local/pgsql/bin/postmaster-D/usr/local/pgsql/Data

9. Configure the listening address and port:
VI/usr/local/pgsql/data/PostgreSQL. conf
Uncomment the following two rows
Listen_addresses = '*'

Port = 5432

10. Allow remote connection:
VI/usr/local/pgsql/data/pg_assist.conf
Add
Host All all 192.168.1.0/24 Trust

The specific meaning of each item is described in the configuration file.
Configure iptables for remote host access:
VI/etc/sysconfig
Add
-A RH-Firewall-1-INPUT-M state -- state new-m tcp-p tcp -- dport 5432-J accept
Service iptables restart

11. Enable the PostgreSQL database to start with the system startup:
Copy the startup script to the/etc/init. d/directory and execute the following command:
CD/etc/rc. d/init. d
CP (First Step unzipping the installation file directory)/postgresql-8.3.7/contrib/start-scripts/Linux PostgreSQL
Chmod + x PostgreSQL
VI PostgreSQL
Prefix =/usr/local/pgsql
Pgdata = "/usr/local/pgsql/Data"
Pguser = Postgres
Pglog = "/var/log/pgsql. log"

Chkconfig -- add PostgreSQL
Start the database:
Service PostgreSQL start

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.