Software Environment
Operating System
PostgreSQL can run on Linux, Mac OS, and Windows platforms. The default port is 5432.
Software Version
SuperMap GIS servers support PostgreSQL version 8.3 and above.
Installing PostgreSQL on Windows
PostgreSQL provides a binary installation package for Windows. This article uses PostgreSQL 9.6.12 as an example to introduce the installation process briefly.
-
Go to the PostgreSQL official website and download the .exe installation file, making sure to select the version that matches your operating system's bit version.
-
Open the installation file and follow the prompts to set the PostgreSQL installation path, data storage path, initial administrator password, PostgreSQL service listening port, and runtime language environment to complete the installation.
Note:
- The initial administrator account for PostgreSQL is postgres.
- The default port used by PostgreSQL is 5432.
- When selecting the language environment, if you choose a Chinese character set, it may cause incorrect query and sorting results. It is recommended to select "C," which means no locale.
Installing PostgreSQL on Linux
PostgreSQL provides two installation methods for Linux: one based on binary installation packages and the other based on source code. This article uses PostgreSQL 9.6.12 and a 64-bit Linux operating system as an example to briefly introduce the installation process based on binary installation packages:
-
Go to the PostgreSQL official website and download the binary installation package postgresql-9.6.12-1-linux-x64.run.
-
Modify the installation package's permissions to be readable and writable:
chmod 755 postgresql-9.6.12-1-linux-x64.run
-
Go to the directory where the installation package is located and install the database using the following command:
./postgresql-9.6.12-1-linux-x64.run
-
Set the database installation directory, data storage path, and service port number. Here, use the default path and PostgreSQL's default port number 5432, and press Enter directly.
-
Select the database encoding format. You can choose "C," which means no locale.
Wait for the database installation to complete.
Using PostgreSQL
Enabling Remote Access
PostgreSQL prohibits non-local access by default. If the SuperMap GIS server and PostgreSQL are not on the same machine, you need to modify the PostgreSQL configuration file. Go to the %PostgreSQL_HOME%/data directory and change the listen_address value in the postgresql.conf file from 'localhost' to '*', as shown below:
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 above line:
host all all 0.0.0.0/0 md5
Save and restart PostgreSQL to enable remote access.
Logging into PostgreSQL
After configuring the PostgreSQL environment variables, use the following command to log in to PostgreSQL:
psql -h 127.0.0.1 -p 5432 -U postgres
- -h: The address of the PostgreSQL database. If PostgreSQL is installed on the local machine, it is 127.0.0.1. If connecting remotely, change it to the IP address of the machine where PostgreSQL is installed.
- -p: The port number of the PostgreSQL database, default is 5432.
- -U: The username of the PostgreSQL database user. postgres is the default administrator username.
Creating a Database
Use the following command to create a new database:
create database [DatabaseName];
For example:
create database iportal;
After creating the database, you can use it for security information storage and iPortal portal data storage.

1. Since some versions of PostgreSQL only listen to the Localhost address, when iServer and PostgreSQL are not on the same machine, iServer may fail to connect to the PostgreSQL service. You need to configure the PostgreSQL configuration file postgresql.conf and set:
listen_address='*'
This allows other machines to access the PostgreSQL database service via IP or domain name.
2. PostgreSQL's security policy only allows local users to access by default. When iServer and PostgreSQL are not on the same machine, iServer may not be able to access the PostgreSQL service using PostgreSQL's system user. You need to add an access policy in the pg_hba.conf file to allow hosts from a specified network segment to access, as shown below:
host all all 192.168.112.0/24 md5
-
host: The host where PostgreSQL is installed.
-
First all: All database instances on the host.
-
Second all: All users.
-
192.168.112.0/24: The network segment that can be accessed using valid user information. You can replace '192.168.112.0' with the desired network segment.
-
md5: Authentication method.