PostGIS Installation
1. Software download
Postgresql-9.6.1-1-windows-x64-binaries.zip
https://www.postgresql.org/download/windows/
Postgis-bundle-pg96-2.3.1x64.zip
http://download.osgeo.org/postgis/windows/pg96/
2. Unzip the Postgresql.zip
Unzip the postgresql-9.6.1-1-windows-x64-binaries.zip to the installation directory you want (D:\GreenSoftware\PostgreSQL961), it is best not to have Chinese or space,
3. Create a data storage directory (D:\GreenSoftware\PostgreSQL961\data)
4. Initializing the database
D:\GreenSoftware\PostgreSQL961\bin\initdb.exe-D D:\GreenSoftware\PostgreSQL961\data-E UTF8--locale=chinese
5. Start the database in one of two ways
5.1 First way: Registering as a Windows service mode
5.1.1 Registration Service
D:\GreenSoftware\PostgreSQL961\bin\pg_ctl.exe register-d D:\GreenSoftware\PostgreSQL961\data-Npgsql
-n indicates that the Windows service name is Pgsql;
5.1.2 Start Service
net start Pgsql
If your installation is not an error, you should be able to get up now.
5.1.3 Close Service
net stop Pgsql
5.1.4 Uninstall Service
D:\GreenSoftware\PostgreSQL961\bin\pg_ctl.exe unregister-d D:\GreenSoftware\PostgreSQL961\data-Npgsql
5.2 Second way: Direct start mode
5.2.1 Start
D:\GreenSoftware\PostgreSQL961\bin\pg_ctl.exe Start-w-D D:\GreenSoftware\PostgreSQL961\data
5.2.2 off
D:\GreenSoftware\PostgreSQL961\bin\pg_ctl.exe Stop-w-D D:\GreenSoftware\PostgreSQL961\data
6 Creating a Database
D:\GreenSoftware\PostgreSQL961\bin\createdb.exe-E UTF8 Geodb
D:\GreenSoftware\PostgreSQL961\bin\dropdb.exe Geodb
7 Creating a user
D:\GreenSoftware\PostgreSQL961\bin\createuser.exe-s-R Postgres
There will be an option to create a superuser, create a superuser named Postgres;
How to use:
CreateUser [Options] ... [User Name]
Options:
-C, connection limit for--connection-limit=n role (default: No Limit)
-D,--createdb this role can create a new database
-D,--no-createdb this role is not available to create a new database
-E,--echo Show commands sent to the server
-E,--encrypted password encrypted storage
-I, the--inherit role can inherit the permissions of the role it belongs to
(This is the default)
-I,--no-inherit role does not inherit permissions
-L,--login role can log on (this is the default)
-L,--no-login role cannot log on
-N,--unencrypted password unencrypted storage
-P,--pwprompt assigning a password to the new role
-R,--createrole This role can create a new role
-R,--no-createrole This role does not have permissions to create other roles
-S,--superuser role will be super user
-S, the--no-superuser role cannot be a super user
--HELP Display this help message, and then exit
--version output version information, and then exit
Join options:
-H, the host name or socket directory of the machine where the--host=hostnam database server resides
-p,--port=port database server port number
-U,--username=username join user (not the user name to be created)
-W,-no-password never prompt to enter a password
-W,--password Force prompt for password
If-D,-R,-R,-S,-S, and ROLENAME are not specified, an interactive prompt will be used
You.
Bug report to <[email Protected]>.
Example 1:>createuser-p-d-u postgres dan
Explanation:-P (uppercase) is to specify a password for the new user;-D says whether the role can create a database;-U (uppercase) The current operation is issued by which user; The last Dan is the name of the new user.
Add:
View users in the system: SELECT * from Pg_user;
Delete a User: Drop the user Dan, where Dan is the username
D:\GreenSoftware\PostgreSQL961\bin\dropuser.exe Postgres
7.1 Modifying user passwords
7.1.1 First way: Apply the Psql command
D:\GreenSoftware\PostgreSQL961\bin\psql.exe Postgres
postgres=# alter user postgres with password ' GIS ';
postgres-# \q
7.1.2 Second way: To modify with Pgadmin
With Pgadmin connection to the server, you can directly modify the password;
8 Unzip the Postgis-bundle-pg96-2.3.1x64.zip
Unzip the postgis-bundle-pg96-2.3.1x64.zip to a directory without Chinese or white space.
9 Modify Makepostgisdb_using_extensions.bat File
10 importing spatial data into PostGIS
11 displaying spatial data in PostGIS
12 Handling Extranet Access
1. Modify the D:\GreenSoftware\PostgreSQL961\data\pg_hba.conf file
Add the following text:
Host All 192.168.1.0/24 MD5
2. Modify the D:\GreenSoftware\PostgreSQL961\data\postgresql.conf file
Add the following text:
Will
#listen_addresses = ' 127.0.0.1 '
Switch
listen_addresses = ' * '
Problem:
1.
Compressed version of the PostgreSQL10.0 installation is complete, the pgadmin always error when opening the "the application server could not be contacted."
Because 1 empty files are missing:
Pgadmin 4/venv/lib/site-packages/backports/__init__.py
Create a pgadmin to work properly!
Windows PostGIS (compressed edition) installation