Install and configure postgresql and phppgadmin in CentOS7

Source: Internet
Author: User

Install and configure postgresql and phppgadmin in CentOS7

I. Installation

1. install apache

Run the command yum-y install httpd

Start systemctl start httpd. service

Add systemctl enable httpd. service

2. install php

Run the command yum-y install php

Install yum-y installphp-pgsql that supports postgresql. You may need to install yum-y according to your needs.

3. Install postgresql

Run the command yum-y installpostgresql-server postgresql-contrib

Start service systemctl start postgresql. service

Add systemctl enable postgresql. service

4. Install phppgadmin

Download phppgadmin, http://sourceforge.net/projects/phppgadmin/files/phpPgAdmin%20%5Bstable%5D/phpPgAdmin-5.1/phpPgAdmin-5.1.tar.gz

Run wgethttp: // configure (if wget cannot be found, run yum install wget to install it)

Decompress the package in/var/www/html and unzip the command tar -zxvfphpPgAdmin-5.1.tar.gz to generate a directory of the phpPgAdmin-5.1, and rename it phpPgAdmin with the mv command

Ii. Configuration

1. Configure postgresql

Edit vi/var/lib/pgsql/data/pg_cmd.conf

Find # IPv4 local connections: Convert the following host line to host all 127.0.0.1/32 md5, which allows users to connect to tools such as phppgadmin and pass md5 authentication through TCP connections, log on to the Postgre server to operate all databases. You can add multiple rows and add the IP address you want to connect.

Modify postgresql username's postgres password. Run the "su S" command to press Enter. bash-4.2 $ will appear. Enter "psql" at the back, and "postgres = #" will appear #, enter the command alter user Login s with password 'password you want to change '. Then, OK, and enter \ q to exit.

Modify the postgres SYSTEM account password. After postgresql is installed, a postgres SYSTEM account is generated and passwd postgres is used.

2. Configure phppgadmin

Edit vi/var/www/html/phpPgAdmin/conf/config. inc. php

Find $ conf ['servers'] [0] ['host'] and change it to $ conf ['servers'] [0] ['host'] = '2017. 0.0.1 ';

Find $ conf ['extra _ login_security '] and change it to $ conf ['extra _ login_security'] = false; // phppgadmin cannot log on to postgre by default.

: Wq save and exit

3. configure the firewall

Edit vi/etc/sysconfig/iptables

Add-a input-p tcp-m state -- state NEW-m tcp -- dport 5432-j ACCEPT // postgresql port is 5432
-A input-p tcp-m state -- state NEW-m tcp -- dport 80-j ACCEPT

: Wq save and exit

Restart the service: systemctl restart iptables. service

Systemctl restart httpd. service

Systemctl restart postgresql. service

Now, you can enter http: // IP/phpPgAdmin in your browser.

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.