CentOS 7 Installation PostgreSQL

Source: Internet
Author: User
Tags postgresql psql postgresql client

Reference: http://blog.csdn.net/lk10207160511/article/details/50359549# #1

1. Check if PostgreSQL is installed on this machine

$ sudo rpm-aq | grep postgresql

2. Install Postgressql from the warehouse

Search Package Name:

$ Yum Search PostgreSQL

List the package names, for example, you might have:

Postgresql.i686:PostgreSQL Client Programs
Postgresql.x86_64:PostgreSQL Client Programs
Postgresql-server.x86_64:the programs needed to create and run a PostgreSQL server

Installation:

$ sudo yum install PostgreSQL postgresql-server

Verify:

$ Rpm-qa | grep postgresql

3. Initialize the database

Find command:

$ rpm-ql postgresql-server | grep setup

/usr/bin/postgresql-setup
/usr/share/man/man1/postgresql-setup.1.gz

$ sudo postgresql-setup initdb

Initializing database ... Ok

4. Start the service and set it to boot

$ sudo systemctl enable PostgreSQL

$ sudo systemctl start PostgreSQL

5. Open firewall port

$ sudo firewall-cmd--permanent --add-port=5432/tcp

$ sudo firewall-cmd--permanent --add-port=80/tcp

$ sudo firewall-cmd--reload

6. Change password for user Postgres

$ sudo passwd postgres

7. Log in with user Postgres and access the database

$ su-postgres

Last login:wed Mar 1 09:59:22 CST on PTS/1

-bash-4.2$ psql
Psql (9.2.18)
Type ' help ' for help.

postgres=#

At this point, PostgreSQL was installed successfully.

CentOS 7 Installation PostgreSQL

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.