You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Scroll down until you see something like this, by default:
35
+
--Scroll down until you see something like this, by default:
32
36
33
37
# TYPE DATABASE USER ADDRESS METHOD
34
38
@@ -39,7 +43,7 @@ host all all 127.0.0.1/32 ident
39
43
# IPv6 local connections:
40
44
host all all ::1/128 ident
41
45
42
-
Change it to read like this:
46
+
--Change it to read like this:
43
47
# TYPE DATABASE USER ADDRESS METHOD
44
48
45
49
# "local" is for Unix domain socket connections only
@@ -50,89 +54,90 @@ host all other_username 0.0.0.0/0 md5
50
54
# IPv6 local connections:
51
55
host all all ::1/128 md5
52
56
53
-
Enter username for each user and associate IPs or make it open to all 0.0.0.0/0
54
-
Enter a specific IP X.X.X.X/32 to only allow connection from the exact IP
57
+
--Enter username for each user and associate IPs or make it open to all 0.0.0.0/0
58
+
--Enter a specific IP X.X.X.X/32 to only allow connection from the exact IP
55
59
56
-
Now, we need to update PostgreSQL to enable remote connections to the database.
60
+
--Now, we need to update PostgreSQL to enable remote connections to the database.
57
61
58
62
sudo vim /var/lib/pgsql96/data/postgresql.conf
59
63
60
-
Uncomment line:
64
+
--Uncomment line:
61
65
#listen_addresses = 'localhost' # what IP address(es) to listen on;
62
66
63
-
Update that line to enable connections from any IP addresses:
67
+
--Update that line to enable connections from any IP addresses:
64
68
listen_addresses='*'
65
69
66
-
Uncomment line:
70
+
--Uncomment line:
67
71
#port = 5432
68
72
69
-
To read like this:
73
+
--To read like this:
70
74
port = 5432
71
75
72
-
Start the postgresql service:
76
+
--Start the postgresql service:
73
77
sudo service postgresql start
74
78
75
-
Log into the postgresql
79
+
--Log into the postgresql
76
80
77
81
sudo su - postgres
78
82
psql -U postgres
79
83
80
-
Add a password for your PostgreSQL admin
84
+
--Add a password for your PostgreSQL admin
81
85
82
86
ALTER USER postgres WITH PASSWORD '$password';
83
87
84
-
Create user credentials for different users.
85
-
Replace username with the username you want. Replace $password with the password you want.
88
+
--Create user credentials for different users.
89
+
--Replace username with the username you want. Replace $password with the password you want.
86
90
CREATE USER username SUPERUSER;
87
91
ALTER USER username WITH PASSWORD '$password';
88
92
89
93
CREATE USER username NOSUPERUSER;
90
94
ALTER USER username WITH PASSWORD '$otheruserpassword';
91
95
92
-
Exit from Postgres with \q. Your setup is complete now and is ready to be connected remotely.
93
-
Postgresql96 install done
96
+
--Exit from Postgres with \q. Your setup is complete now and is ready to be connected remotely.
97
+
--Postgresql96 install done
94
98
```
95
99
### PostGIS installation
96
100
97
101
First, we install some build tools and the GEOS and PROJ libraries. Then we install PostGIS. Once installed, we will update our libraries, so the server knows where to find them. Finally, we create a temp database for PostGIS.
98
102
99
103
```
100
-
Install build tools
104
+
--Install build tools
101
105
sudo yum install gcc make gcc-c++ libtool libxml2-devel
Once everything is installed, open your choice of Postgresql software and login or login via CLI (Command Line Interface).
183
+
184
+
### Enabling PostGIS
185
+
PostGIS is an optional extension that must be enabled in each database you want to use it in before you can use it. Installing the software is just the first step. DO NOT INSTALL it in the database called postgres.
186
+
187
+
Connect to your database with psql or PgAdmin. Run the following SQL. You need only install the features you want:
0 commit comments