CentOS installs Custom installation PostgreSQL and PostGIS extensions with Yum already phppgadmin

Source: Internet
Author: User
Tags postgresql psql postgis

1. system message;

#head -1 / etc / issue

CentOS release 6.5 (Final)

2. Install postgresql 9.3 version;

#rpm -ivh http://yum.postgresql.org/9.3/redhat/rhel-6-x86_64/pgdg-centos93-9.3-1.noarch.rpm

# yum install postgresql93 postgresql93-server postgresql93-libs postgresql93-contrib postgresql93-devel

3. Custom database data path;

Because the local hard disk storage is unreliable, put the data in an existing nfs storage in this environment. This machine has already mounted the nfs in the / storage directory. If there is no such requirement, it can be defaulted.

#vim /etc/init.d/postgresql-9.3

PGDATA = / var / lib / pgsql / 9.3 / data

PGLOG = / var / lib / pgsql / 9.3 / pgstartup.log

PGUPLOG = / var / lib / pgsql / $ PGMAJORVERSION / pgupgrade.log

Modify the above three paths into custom paths as follows: (Actually only need to modify the PGDATA parameter)

PGDATA = / storage / pgsql / 9.3 / data

PGLOG = / storage / pgsql / 9.3 / pgstartup.log

PGUPLOG = / storage / pgsql / $ PGMAJORVERSION / pgupgrade.log

4. Initialize & start the database & join the auto start & check the database status;

#service postgresql-9.3 initdb #initialize

! After the initialization is successful, all the database configuration files are in the custom directory /storage/pgsql/9.3/data

#service postgresql-9.3 start #Start

#chkconfig postgresql-9.3 on #

#service postgresql-9.3 status #View the current running status of postgresql, as follows

postgresql-9.3 (pid 5093) is running ...

5. The configuration database can be connected using the pgAdmin tool under windows or other tools;

#cd /storage/pgsql/9.3/data

#vim postgresql.conf

Uncomment #listen_addresses = ‘localhost’ and comment to listen_addresses = ‘*’

#vim pg_hba.conf

Add "host all all 0.0.0.0/0 md5" at the end of the line to allow all hosts to connect

#su postgres

$ psql -p 5432

$ alter user postgres with password ‘123456’ #Set postgres user password

$ \ q

$ \ exit

# service postgresql-9.3 restart

# service postgresql-9.3 reload

The postgresql database is installed and can be used normally, such as:



6. Install postgis extension & use postgis extension;

#yum install postgis2_93

#su postgres

$ psql -p 5432

$ CREATE EXTENSION postgis;

CREATE EXTENSION

$ \ q

$ \ exit

7. Database changes after installing postgis-;


8. Install phpPgAdmin-easy to manage postgresql database from web pages (similar to phpmyadmin);

#yum list | grep phpPgAdmin # (check that your source has this package)

phpPgAdmin.noarch 5.1-1.rhel6 @ pgdg93

#yum install phpPgAdmin httpd

#vim /etc/httpd/conf.d/phpPgAdmin.conf Make the following changes:

    ‘‘ ‘

    Alias / phpPgAdmin / usr / share / phpPgAdmin

    <Location / phpPgAdmin>

        Order deny, allow

        #Deny from all

        #Allow from 192.168.0.0/16

        Allow from all

        #Allow from :: 1

        # Allow from .example.com

    </ Location>

    ‘‘ ‘

    service httpd restart

    chkconfig httpd on

 9. You can now access the administration page using http: //x.x.x.x/phpPgAdmin:

     #Login may fail because SELLinux may restrict users from connecting to PostgreSQL, just enter the following command to change

     #Execute this command "setsebool -P httpd_can_network_connect_db 1" After successful, you can log in



This article comes from "Yunzhongshan" blog, please keep this source http://jiapeng.blog.51cto.com/6706171/1603590

centos uses yum to install custom install postgresql and postgis extensions already phpPgAdmin


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.