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