-
Notifications
You must be signed in to change notification settings - Fork 74
PostgreSQL setup
First you need to install PostgreSQL with PostGIS. On Debian derivatives these can be installed with a single command (version numbers might change):
apt-get install postgresql postgis postgresql-9.5-postgis-scripts pgadmin3
Next you need to set up a password for the postgres
admin account, and set up a user and database for the SensorThingsServer to use.
-
First set a password for the
postgres
user.- Run the psql command from the postgres user account:
sudo -u postgres psql postgres
- Set the password:
\password postgres
- Enter a password.
- Close psql.
- Run the psql command from the postgres user account:
-
Open pgadmin3 (postgres admin userinterface) and connect using user postgres
-
Create a user for the SensorThingsServer (user
sensorthings
)- Right-click Login Roles -> New Login Role
- Enter a name (
sensorthings
) - Enter a password (twice)
- Click OK
-
Create a new database (database sensorthings)
- Right-click Databases -> new Database
- Give a name (
sensorthings
) - Set owner to "
sensorthings
" (if that's what you called the user in step 3.2) - Do not set a Template
- Click ok
-
Navigate to database sensorthings as user postgres
-
Initialise PostGIS on the newly created database
- With the database sensorthings selected, click the SQL button in the menu bar
- Enter the query
CREATE EXTENSION postgis;
- Click the green "run" button
-
(Optional) If you want to use UUIDs as ID, initialise the uuid-ossp extension
- Enter the query
CREATE EXTENSION "uuid-ossp";
- Click the green "run" button
- Enter the query
You now have PostgreSQL installed, with an empty database ready for use by the SensorThingsServer.