Software environment

Operating system

The PostgreSQL database runs on Linux, Mac OS and Windows platforms with a default port of 5432.

Software version

SuperMap GIS server supports PostgreSQL version 9.6 or higher.

Installing PostgreSQL on Windows systems

PostgreSQL provides a binary installer for Windows operating system. This article takes the PostgreSQL 9.6.12 version as an example to briefly introduce the installation process.

  1. Go to the PostgreSQL official website and download the .exe format installation file. Pay attention to choose the version with the same number of bits as your operating system.

  2. Open the installation file and follow the prompts to set the PostgreSQL installation path, data storage path, the password of the initial administrator user, the PostgreSQL service listening port and the runtime locale to complete the installation.

Note:

  • The initial administrator account for PostgreSQL is postgres.
  • The default port used by PostgreSQL is 5432.
  • When selecting a locale, if you select the Chinese character set, the query and sort results may be incorrect. It is recommended to select 'C', which indicates no region is used.

Installing PostgreSQL on Linux systems

PostgreSQL provides a binary installation package and a source-based installation for the Linux operating system. This article takes PostgreSQL 9.6.12 version, the 64-bit Linux operating system as an example to briefly introduce the installation process based on binary installation package.

  1. Go to the PostgreSQL official website and download the binary installation package postgresql-9.6.12-1-linux-x64.run

  2. Modify the permission of the installation package as readable and writable:

chmod 755 postgresql-9.6.12-1-linux-x64.run

  1. Go to the directory where the installation package is located and install the database by using the following command:

./postgresql-9.6.12-1-linux-x64.run

  1. Set the database installation directory, data storage path and service port number. Here use the default path and PostgreSQL's default port number 5432.

  2. Select the database encoding format, you can choose "C", which indicates no region.

Wait for the database installation to complete.

Using PostgreSQL

Enable remote access

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 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 in the following example:

listen_addresses = '*'

Then in the %PostgreSQL_HOME%/data/pg_hba.conf file, find line:

# IPv4 local connections:

host    all             all             127.0.0.1/32            md5

Add the following line at the end of it:

host    all             all             0.0.0.0/0                  md5

Save and restart PostgreSQL service, then you can access PostgreSQL remotely.

Log into PostgreSQL

After configuring the environment variables of PostgreSQL, log into PostgreSQL with the following command:

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 you are connecting to PostgreSQL remotely, you will need to change the IP address of the machine where PostgreSQL is located.
  • -p:Port number of the PostgreSQL database. The default is 5432.
  • -U:Username of the PostgreSQL database user. postgres is the default administrator username.

Create database

Use the following command to create a database:

create database [database name] ;

For example:

create database iportal ;

Once the database is created, it can be used for Secure information storage and iPortal's Portal data storage.