Sunday, October 20, 2013

Installing PostgreSQL using Binary Zip Distribution on Windows 8 64 Bit

In previous version of windows (let's say windows Xp, Vista, and 7) i was install my pgsql with no problem at all using installer. But i got a problem when my laptop upgraded to windows 8 (64 bit), my installation was failed with error below :

After searching for many forums and sources, i got no suitable solution because my problem still occurred like above. I had several problems with the one click installer and after the installation process was finished, we could not start the PostgreSQL database. Since i could not solve this problem in a reasonable amount of time, so i decided to switch my installation using zip binary distribution of PostgreSQL.

Let start to begin PostgreSQL installation using Zip Binary Distribution. Just follow my step :

1. Download and install the latest of the Microsoft Visual C++ 2008 redistributable package or depend on your windows version
2. Download the latest PostgreSQL zip distribution here
3. Create folder PostgreSQL inside 'C:\Program Files' and extract zip files to 'C:\Program Files\PostgreSQL'
4. Create folder 'data' and 'log' in folder 'C:\Program Files\PostgreSQL' so your installation folder should like below :
 
5. Now is configuring the PostgreSQL installation. The next step is to create a new PostgreSQL database cluster. Open command prompt using (Run As Administrator) and go to pgsql directory and run initdb command :
initdb -U postgres -A password -E utf8 -W -D "C:\Program Files\PostgreSQL\data"
 
 
After you have successfully created the database cluster, your PostgreSQL installation is ready to be used. You can start and stop your database instance by using the following commands. Always go to directory 'C:\Program Files\PostgreSQL\pgsql\bin' to run this command :
 
Start command :

pg_ctl -D "C:/Program Files/PostgreSQL/data" -l "C:/Program Files/PostgreSQL/log/pgsql.log" start
Stop command :
 
pg_ctl -D "C:/Program Files/PostgreSQL/data" -l "C:/Program Files/PostgreSQL/log/pgsql.log" stop
 
 
To make the above step more easy, you can add to System Services using this command :
pg_ctl.exe register -N "postgresql" -U "NT AUTHORITY\NetworkService" -D "C:/Program Files/PostgreSQL/data" -w
After you have done this, you can start the postgresql service by using the Services panel at Administrator Tools. To unregister it from System Services just replace 'register' option with 'unregister' instead.
 
Goog Luck!



0 Comments: