Note: Transfer from saber7's blog
Installation environment windows7 32-bit systems
Before the first download a postgresql-8.4.2-1-windows version, this version is installed version, the installation process to continue to error, but barely finished loading, but can not connect to the database after Bahrain, reason should be win7 thing, in a virtual machine installation xpsp3 normal, but do not want to write the code every time the virtual machine when they are opened, they still want to find a way to install the win7 ... ...
And turn, finally succeeded in testing a lot of ways, and recorded:
1. First to http://www.enterprisedb.com/products/pgbindownload.do download postgreSQL program, I downloaded the win x86-32 version 9.0.1-1 because I think the newer version should be compatible with it a little better ;
2. Download compressed package in the pgsql after the unzipped folder, for convenience, I directly into the D: \ pgsql, Green Edition (in fact, is not especially green), no installation, but need to set some environment variables ... ...
3. Write a simple batch it, any name, I've called inst.bat:
set PGHOME = d: \ pgsql
set PATH =% PGHOME% \ bin;% path%
set PGHOST = localhost
set PGLIB =% PGHOME% \ lib
set PGDATA =% PGHOME% \ data
This batch file will be copied to D: \ pgsql
4. Open cmd, switch to your pgsql directory, and I was D: \ pgsql, run the inst
C: \ Users \ Administrator> d:
D: \> cd D: \ pgsql
D: \ pgsql> inst
D: \ pgsql> set PGHOME = d: \ pgsql
D: \ pgsql> set PATH = d: \ pgsql \ bin; D: \ Python26 \ Scripts; D: \ Python26 \; C: \ Windows \ syste
m32; C: \ Windows; C: \ Windows \ System32 \ Wbem; C: \ Windows \ System32 \ WindowsPowerShell \ v1
.0 \; C: \ Program Files \ Common Files \ Thunder Network \ KanKan \ Codecs; C: \ Users \ Adminis
trator \ AppData \ Roaming \ Python \ Scripts; D: \ Program Files \ Google \ google_appengine \
D: \ pgsql> set PGHOST = localhost
D: \ pgsql> set PGLIB = d: \ pgsql \ lib
D: \ pgsql> set PGDATA = d: \ pgsql \ data
5. Initialize the database
D: \ pgsql> initdb - locale = C
Documents belonging to this database system host as user "Administrator".
This user must also be a host for the server process.
The database cluster will be initialized with locale C.
The default database encoding has accordingly set to SQL_ASCII.
The default text search configuration will be set to "english"
Create the directory d: / pgsql / data ... success ... success is creating a subdirectory to select the default maximum number of connection (max_connections) ... 100
Select the default shared buffer size (shared_buffers) ... 32MB
Success in creating a profile ... d: / pgsql/data/base/1 create template1 database ... pg_authid ... successfully initialized successfully initialized successfully create a system view dependencies ... ... success is loading system successfully created the object description ... ... success of the character set conversion is ... create a dictionary object successfully set permissions on the built-in success ...
Creating a successful information model ...
loading PL / pgSQL server-side language ... successfully clean up the database template1 template1 ... successfully copied to the copy template1 template0 ... success to the success of template0 ...
Warning: Connect launched for local "trust" authentication.
You can change by editing pg_hba.conf or using the next time you run initdb-A option.
Success. You can now use the following command to run the database server:
"" Postmaster-D "d: / pgsql / data"
"" Pg_ctl-D "d: / pgsql / data"-l logfile start
D: \ pgsql> pg_ctl start
Starting the server process
D: \ pgsql> LOG: database system was shut down at 2010-12-13 13:41:20 HKT
LOG: autovacuum launcher started
LOG: database system is ready to accept connections
7. The cmd window instead of closing, and then open a cmd window
D: \ pgsql> D: \ pgsql \ bin \ createdb-h 127.0.0.1 mydb
D: \ pgsql> D: \ pgsql \ bin \ createuser-h 127.0.0.1 s7
Whether the new role be a superuser? (Y / n) y
D: \ pgsql>
8. Open the graphical user interface management database D: \ pgsql \ bin \ pgAdmin3.exe