PostgreSQL installation in Ubuntu 10.04

Warning: This blog post was written a long time ago and might be no longer relevant.

PostgreSQL is a powerful and reliable object-relational database system. It's a great alternative for MySQL. It is as easy to set up, performs better and offers far more features.

To install PostgreSQL server run:

sudo aptitude install postgresql

Database users can be created in command line with createuser tool. Running the following command will create user 'kuba' who is not a superuser, can create databases, cannot create new roles and his password is stored encrypted. You will be asked to give new user's password as '-P' option is passed.

sudo su postgres -c 'createuser -S -d -R -E -P kuba'

Note: Run createuser with --help switch to get an overview of available options.

There is a similar tool for database creation called createdb:

createdb mydatabase

Note: Read about MySQL in my another post: MySQL installation in Ubuntu 10.04.

Jakub Zalas

Jakub Zalas

Agile PHP Developer, addicted to BDD and Symfony