PostgreSQL 8.3 on Debian sid mini-HOWTO

This mini-HOWTO will guide you though the installation of PostgreSQL 8.3 on Debian sid. After install initial packages, you will need to create and configure both user account and database, which Debian installation script will not do for you.

Before start I will assume you have a complete installed and functional Debian sid box on hand. If you have no idea about this, please refer to my other article for more details.

This document is a refine and trim down version of my legacy artical which target for Debian etch. Most procedure are shared so you may also able to apply them in case of Debian etch.

Install required packages

Just run the following command:

apt-get update
apt-get install postgresql-8.3 postgresql-client-8.3 postgresql-contrib-8.3 postgresql-common

Initialize superuser accounts

Only default user postgres with no password after install above packages, so let's initialize it:

localhost:~# su - postgres
postgres@localhost:~$ psql template1
Welcome to psql 8.3.3, the PostgreSQL interactive terminal.

Type:  \copyright for distribution terms
       \h for help with SQL commands
       \? for help with psql commands
       \g or terminate with semicolon to execute query
       \q to quit

template1=# ALTER USER postgres PASSWORD 'CHANGE';
ALTER ROLE
template1=# \q
postgres@localhost:~$ exit
logout
localhost:~#

You may also hope to have root account as like as case of MySQL, so create and configure with:

localhost:~# su - postgres
postgres@localhost:~$ createuser -DRS root
postgres@localhost:~$ psql template1
Welcome to psql 8.3.3, the PostgreSQL interactive terminal.

Type:  \copyright for distribution terms
       \h for help with SQL commands
       \? for help with psql commands
       \g or terminate with semicolon to execute query
       \q to quit

template1=# ALTER USER root PASSWORD 'CHANGE';
ALTER ROLE
template1=# \q
postgres@localhost:~$ exit
logout
localhost:~#

Create your first database

Now let's create a database called as AL32UTF8 for user root:

localhost:~# su - postgres
postgres@localhost:~$ createdb -O root AL32UTF8
postgres@localhost:~$ psql AL32UTF8
Welcome to psql 8.3.3, the PostgreSQL interactive terminal.

Type:  \copyright for distribution terms
       \h for help with SQL commands
       \? for help with psql commands
       \g or terminate with semicolon to execute query
       \q to quit

AL32UTF8=# \q
postgres@localhost:~$ exit
logout
localhost:~# psql AL32UTF8
Welcome to psql 8.3.3, the PostgreSQL interactive terminal.

Type:  \copyright for distribution terms
       \h for help with SQL commands
       \? for help with psql commands
       \g or terminate with semicolon to execute query
       \q to quit

AL32UTF8=> \q
localhost:~#

Ok so that's all about it. Enjoy with your PostgreSQL now :-)


Very thanks for the manual, I

David's picture

Very thanks for the manual, I have searched for hours and finally I could install and configure postgresql!

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <h1> <h2> <h3> <h4> <h5> <h6> <em> <strong> <code> <del> <blockquote> <q> <sub> <p> <br> <ul> <ol> <li> <dl> <dt> <dd> <a> <b> <u> <i> <sup> <acronym> <pre> <img>
  • Lines and paragraphs break automatically.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • Images can be added to this post.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.