Azure Linux Virtual machine openlogic_centos7.0 build PostgreSQL database

Source: Internet
Author: User
Tags postgresql psql

Recently, the PostgreSQL database needs to be used.

The environment I built is:

Azure platform, the operating system is the Openlogic centos7.0 that comes with the Azure platform.


Construction process:

1. Use the system to bring your own PostgreSQL package. If you build only the PostgreSQL database, just install the PostgreSQL server.

sudo yum install postgresql-server PostgreSQL

2, after the installation is complete, start the database, using root permissions.

--First need to initialize the database Postgresql-setup initdb--at boot auto start systemctl enable postgresql.service--start database Systemctl start Postgresql.service

3, when installing the PostgreSQL server package, 1 Postgres users will be created, the UID and GID of the user is 26, if you want to use the non-root user su to Postgres, you need to set its password. (This step is optional)

4, switch to Postgres user, set database user postgres password

#su postgres-bash-3.2$psql-u postgres postgres= #alter user postgres with password ' new password '; Postgres=#\q

5. Configure PostgreSQL so that it can connect remotely

The following two files default directory for/var/lib/pgsql/data--configuration postgresql.conf file modified to listen_addresses = ' * '--Configure pg_hba.conf Add host All 222.137.XXX.XXX/24 MD5 are: Host type, database, user, IP address allowing remote connection, access method

6. Open Firewall Port 5432

Firewall-cmd--permanent--add-port=5432/tcpsystemctl Restart Firewalld

7,azure Management platform Open 5432 port

8, you can now use the client to connect to the PostgreSQL database server.

[Email protected]:~$ psql-h dns-name.chinacloudapp.cn-u postgres-w


Azure Linux Virtual machine openlogic_centos7.0 build PostgreSQL database

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.