PostgreSQL installation and configuration |
The PostgreSQL database runs on Linux, Mac OS, and Windows platforms with a default port of 5432.
The SuperMap GIS server supports PostgreSQL 8.3 and above.
PostgreSQL provides a binary-package-based installation method for Windows operating systems. This article is based on PostgreSQL. Take version 9.6.12 as an example to briefly introduce the installation process:
Go to the official website of PostgreSQL to download the installation file in .exe format. Be careful to select the version with the same number of digits as your operating system.
Open the installation file and follow the prompts to set the PostgreSQL installation path, data storage path, initial administrator user password, PostgreSQL service listening port and runtime language environment to complete the installation.
Notice
PostgreSQL provides two installation methods for Linux operating system: based on binary installation package and based on source code. This article is based on Linux operating system. Taking PostgreSQL version 9.6.12 and 64-bit as an example, briefly introduce the installation process based on binary installation package:
Go to the PostgreSQL official website to download the binary installation package postgresql-9.6.12-1-linux-x64.run.
Modify the permissions of the installation package to read and write:
chmod 755 postgresql-9.6.12-1-linux-x64.run
Enter the directory where the installation package is located, and install the database through the following command:
./postgresql-9.6.12-1-linux-x64.run
Set the database installation directory, data store path, and service port number. Default path and PostgreSQL are used here. The default port number is 5432. Just press Enter.
Select the database encoding format. You can select "C", that is, do not use the region.
Just wait for the database installation to complete.
PostgreSQL disables non-native access by default if the SuperMap GIS server and PostgreSQL are not on the same machine. You need to modify the config file of PostgreSQL. Go to the %PostgreSQL _ HOME%/data directory and modify the listen_address value in the file PostgreSQL.conf from 'localhost' to '*', as shown in the following example:
listen_addresses = '*'
Then in the %PostgreSQL_HOME%/data/pg_hba.conf file
# IPv4 local connections:
host all all 127.0.0.1/32 md5
Add the following line after the line:
host all all 0.0.0.0/0 md5
After saving and restarting PostgreSQL, remote access to PostgreSQL is possible.
After configuring the environment variables for PostgreSQL, log in to PostgreSQL with the following command:
psql -h 127.0.0.1 -p 5432 -U postgres
Create a new database with the following command:
Create database [database name];
For example:
create database iportal ;
Once the database is created, you can use it for security info storage and the portal data of iPortal is stored.
Note:
1. Due to partial versions of PostgreSQL database service only listens on the Localhost address, when iServer and PostgreSQL are not on the same machine, iServer may fail to connect to PostgreSQL. You need to configure the config file PostgreSQL.conf of PostgreSQL, setting:
listen_address='*'
Allows other machines to access PostgreSQL database service by IP or domain name.
2. The security policy of PostgreSQL allows only local users to access by default. When iServer and PostgreSQL are not on the same machine, the system user of iServer using PostgreSQL may not be able to access the PostgreSQL service. You need to add an access policy in the pg_hba.conf file to allow hosts in the specified network segment to access. The settings are as follows:
host all all 192.168.112.0/24 md5
host: indicates installation Host for PostgreSQL
The first All: All database instances on the host
The second All: all users
192.168.112.0/24 : Indicates a network segment that can be accessed using legitimate user information. You can replace '192.168.112.0' with the network segment you want.
MD5: Authentication method