Sunday, September 9, 2007

How to Install PostgreSQL easily on Windows Vista or XP?

PostgreSQL is an object-relational database management system (ORDBMS) and is distributed as a Open Source software under the BSD License. This is a very stable and useful database when you consider to use a DB free from license restrictions like SQL Server or Oracle.

In this post I will explain to you simple steps to Install PostgreSQL in a Windows Vista or XP machine with ease. To start-off, you will need to download the latest release of PostgreSQL direct from the official website.

Next, extract the file from the archive you have downloaded. Run postgresql-8.2.msi as an administrator user account in Vista or XP. You will then need to select your language and check "Write detailed installation log to postgresql-8.1.log in the current directory". Once you agree to the terms on the license, select what you want to install.

I would suggest that you check everything from Database server and also select the installation directory. If at all you want to install PostgreSQL as a windows service, check the option and type the account password if you have one. The "Account name" here refers to the Windows special user account that will be used to run the PostgreSQL database server whenever the service is started or re-started. Next, you will be asked if you want to create the special user account; select Yes. If you want to create a powerful password, let the installer create one for you.

From the following steps onwards, the database cluster will be initialized. At this stage you will have to create a new password for the internal database name. Next you will need to select procedural languages to enable in default database. Procedural languages allow you to write user-defined functions other than SQL and C (very important when you start exploring more).

Finally, you can select contrib modules that provides additional and specialized functionality. I would advice that you don’t enable any contrib module in the default database template. Click Next and then Finish.

Once done you can get your first glance of PostgreSQL using 2 methods: psql - which is a command line interface for PosgreSQL OR pgAdmin III - the graphical interface.

Using psql, you can connect to the database server using the following command:
psql -U postgres -h localhost
In the above command, -U postgres means that you connect to user postgres and -h localhost means that you connect to the local database server / you can also use the IP address of the server here.

I will blog more articles about PostgreSQL in the following days.

1 comment: