-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.local
47 lines (37 loc) · 1.47 KB
/
install.local
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
## -- Copyright Johann Höchtl 2016 https://github.com/the42/bevaddress-dataload
##
## This script installs PostgreSQL including POSTGIS support on Ubuntu
# Documentation is available as
# - for PostgreSQL installation on Ubuntu https://help.ubuntu.com/community/PostgreSQL
# - for PostGIS http://postgis.net/install
# Install PostgreSQL
sudo apt-get install postgresql postgresql-contrib postgis
## Set a password for the PostgreSQL user. From now on it is assumed that
## PostgreSQL is running on the local host and accepting connections
# The following command fires up psql and will prompt for a password for the superuser
sudo -u postgres psql postgres<<SOURCE1
-- set password for superuser
\password <YOURPASSWORD>
-- quit to shell prompt
\q
SOURCE1
## Create a user which will be the owner of the BEVADDRESS database
sudo -u postgres createuser bevsu
# ... and give this user a password.
# !!!! You will be prompted interactively
sudo -u bevsu psql<<SOURCE2
\password
-- quit to shell prompt
\q
SOURCE2
## Create the BEVADDRESS database with bevsu as the owner of the database
createdb -O bevsu BEVADDRESS
# Activate postgis in the BEVADDRESS database
psql -U postgres -d BEVADDRESS -h localhost<<SOURCE3
CREATE EXTENSION postgis;
-- quit to shell prompt
\q
SOURCE3
# Later you likely want to create a less-privileged user with read-only access
# to the database to perform queries and the like.
# See http://www.dbrnd.com/2015/10/postgresql-script-to-create-a-read-only-database-user/