PostgreSQL Install centos6.x

Source: Internet
Author: User

System: centos6.4 Installation postgresql9.3

(firewall needs to open port 5432)

Add Yum Source
Yum Install-y http://yum.postgresql.org/9.3/redhat/rhel-6-x86_64/pgdg-redhat93-9.3-1.noarch.rpm
Installing PostgreSQL
Yum install-y postgresql93-server Postgresql93-contrib

Change the default installation directory to/data/pgsql (optional, default to/var/lib/postgres)

vim/etc/init.d/postgresql-9.3

Change

Pgdata=/data/pgsql/9.3/data
Pglog=/data/pgsql/9.3/pgstartup.log
pguplog=/data/pgsql/$PGMAJORVERSION/pgupgrade.log
Initializing the database
Service postgresql-9.3 Initdb


Chown Postgres.postgres/data/pgsql

VIM/ETC/PASSWD (change postgres user home directory)

Change

Postgres:x:26:26:postgresqlserver:/data/pgsql:/bin/bash


Add an accessible network segment

#vim/data/pgsql/9.3/data/pg_hba.conf (allow the following network segment IP login)

Host all 192.168.1.0/24 Md5host all 192.168.2.0/24 MD5
Change the Listening address

#vim/data/pgsql/9.3/data/postgresql.conf (monitor changed to *)

listen_addresses = ' * '

#service postgresql-9.3 Start (Start database)

#su-postgres

$createuser--help (view new user help) $createuser-s root create Superuser root (optional)-bash-4.1$ psqlpsql (9.3.2) Type "Help" for Help.pos tgres=# \du List of roles Role name | Attributes | Member of-----------+------------------------------------------------+-----------Postgres | Superuser, create role, create DB, Replication | {} root | Superuser, create role, create DB | {}

Create a mydb library and give normal user test all permissions to MyDB

$createdb mydb (Create a database named MyDB) $createuser test (Create a normal user test) $psqlpostgres =# ALTER user test with password ' test '; (Change the password for the test user is test) postgres= #grante all on the database mydb to test;postgres=# \q


Reference:

http://jianlee.ylinux.org/Computer/Server/postgresql%E6%95%B0%E6%8D%AE%E5%BA%93%E5%85%A5%E9%97%A8.html


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.