14 Dec 2011, 04:43
Generic-user-small

Michael Sergio (1 post)

I figured I’d share getting setup on my Ubuntu machine.

Installing

sudo apt-get install postgresql

Creating User

createdb book
createuser: could not connect to database postgres: FATAL:  role "myusername" does not exist

</code>

The bit above can be resolved with the following (replacing myusername for yours)

sudo -u postgres createuser myusername
Shall the new role be a superuser? (y/n) y

</code>

Then this should work

createdb book

</code>

Installing Extensions There should be more problems when trying to create the 5 extensions

psql book -c "CREATE EXTENSION tablefunc"
ERROR:  could not open extension control file "/usr/share/postgresql/9.1/extension/tablefunc.control": No such file or directory

</code>

You can fix it by just downloading a package.

sudo apt-get install postgresql-contrib 

</code>

Downloading the postgresql-contrib packages will give the ability to use the following five commands:

psql book -c "CREATE EXTENSION tablefunc"
psql book -c "CREATE EXTENSION fuzzystrmatch"
psql book -c "CREATE EXTENSION pg_trgm"
psql book -c "CREATE EXTENSION cube"
psql book -c "CREATE EXTENSION dict_xsyn"

</code>

And now you should be good to go!

Thanks to the post by Tanner Watson for the CREATE EXTENSION command

29 Dec 2011, 03:55
Generic-user-small

Sam McEwan (1 post)

Just wanted to hit you with a massive thank you. After hours of no joy this post was a godsend.

05 Aug 2012, 20:22
Generic-user-small

James Richardson (1 post)

Create post. Thank you.

10 Aug 2012, 03:34
Generic-user-small

James Summerford (1 post)

…..

10 Oct 2012, 15:15
Generic-user-small

Arun Rangarajan (2 posts)

Thanks a ton, Michael! It works great for postgres 9.1!

Unfortunately I had to remove postgres 9.1 and install 8.4 for another project. 8.4 does not have CREATE EXTENSION.

Used

sudo apt-get install postgresql-contrib-8.4

and then:

cd /usr/share/postgresql/8.4/contrib
psql -d book -f cube.sql
psql -d book -f tablefunc.sql
psql -d book -f fuzzystrmatch.sql
psql -d book -f pg_trgm.sql
psql -d book -f dict_xsyn.sql

Thanks to depesz’s answer here: http://stackoverflow.com/questions/1564056/how-do-i-import-modules-or-install-extensions-in-postgres-8-4

  You must be logged in to comment