# Postgresql install errors on Ubuntu 16.04

**URL:** <https://meta.discourse.org/t/postgresql-install-errors-on-ubuntu-16-04/70846>\
**Category:** Development\
**Created:** [27 سبتمبر 2017، 3:13ص UTC](https://meta.discourse.org/t/postgresql-install-errors-on-ubuntu-16-04/70846 "2017-09-27T03:13:00Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![j127](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/j127/32/79093_2.png) [@j127](https://meta.discourse.org/u/j127)\
**Post date:** [27 سبتمبر 2017، 3:13ص UTC](https://meta.discourse.org/t/postgresql-install-errors-on-ubuntu-16-04/70846/1 "2017-09-27T03:13:00Z")

</div>

While trying to install Discourse on my laptop (Ubuntu 16.04) using [this guide](https://github.com/discourse/discourse/blob/master/docs/DEVELOPER-ADVANCED.md), I got some errors like this:

```
PG::InsufficientPrivilege: ERROR: permission denied to create extension "hstore"

```

and:

```
rails aborted!
ActiveRecord::NoDatabaseError: FATAL: database "discourse_test_multisite" does not exist

```

I got rid of the errors by changing this:

```
# Postgresql
sudo su postgres
createuser --createdb --superuser -Upostgres $(cat /tmp/username)
psql -c "ALTER USER $(cat /tmp/username) WITH PASSWORD 'password';"
psql -c "create database discourse_development owner $(cat /tmp/username) encoding 'UTF8' TEMPLATE template0;"
psql -c "create database discourse_test owner $(cat /tmp/username) encoding 'UTF8' TEMPLATE template0;"
psql -d discourse_development -c "CREATE EXTENSION hstore;"
psql -d discourse_development -c "CREATE EXTENSION pg_trgm;"
exit

```

to this:

```
# Postgresql
sudo su - postgres
createuser --createdb --superuser -Upostgres $(cat /tmp/username)
psql -c "ALTER USER $(cat /tmp/username) WITH PASSWORD 'password';"
psql -c "create database discourse_development owner $(cat /tmp/username) encoding 'UTF8' TEMPLATE template0;"
psql -c "create database discourse_test owner $(cat /tmp/username) encoding 'UTF8' TEMPLATE template0;"
psql -c "create database discourse_test_multisite owner $(cat /tmp/username) encoding 'UTF8' TEMPLATE template0;"
psql -d discourse_development -c "CREATE EXTENSION hstore;"
psql -d discourse_development -c "CREATE EXTENSION pg_trgm;"
psql -d discourse_test -c "CREATE EXTENSION hstore;"
psql -d discourse_test -c "CREATE EXTENSION pg_trgm;"
psql -d discourse_test_multisite -c "CREATE EXTENSION hstore;"
psql -d discourse_test_multisite -c "CREATE EXTENSION pg_trgm;"
exit

```

Diff:

```
2c2
< sudo su postgres
---
> sudo su - postgres
6a7
> psql -c "create database discourse_test_multisite owner $(cat /tmp/username) encoding 'UTF8' TEMPLATE template0;"
8a10,13
> psql -d discourse_test -c "CREATE EXTENSION hstore;"
> psql -d discourse_test -c "CREATE EXTENSION pg_trgm;"
> psql -d discourse_test_multisite -c "CREATE EXTENSION hstore;"
> psql -d discourse_test_multisite -c "CREATE EXTENSION pg_trgm;"

```

I’m too new to Rails/Discourse to know if it’s just my laptop or if I should add them to the docs, but I’ll leave the fix here in case someone else finds it useful. 🙂

(If it’s something that should go in the docs, let me know and I could make a pull request.)

---

_[View the full topic](https://meta.discourse.org/t/postgresql-install-errors-on-ubuntu-16-04/70846)._
