It provides multi-version parallel control, supports almost all SQL components (including subqueries, transactions, and user-defined types and functions), and provides a wide range of (Development) language binding (including C, C ++, Java, perl, tcl, and python ). This article describes the installation process in windows.
Generally, a modern Unix-compatible platform should be able to run PostgreSQL. If you install Cygwin and cygipc in windows. In addition, if you want to create a server-side programming language PL/Perl, you also need to complete Perl installation, including the libperl library and header files.
In terms of disk support, it takes about MB to store the source code during installation and about 15 MB to store the installation directory. An empty database requires about 25 MB; then, you need to store the same amount of data five times in a flat text file. If you want to run a regression test, you need an additional 90 MB space.
Step 1: Download the windows-based Cygwin installer from the Internet and double-click it.
Step 2: select the installation type. Because we have downloaded the installer to the local disk, select the third item and click "Next ".
Step 3: select the installation path. Generally, press the default value.
Step 4: select the local storage path for the downloaded package. Select according to your needs.
Next, you will be prompted to select the connection type, download the site, and select the installation package (you need to confirm the addition: cygrunsrv (category Admin), postgresql (category Database). Then you will start to download the package and install cygwin.
Step 1: Install cygserver as an NT Service and start
A. Run the Script: $/usr/bin/cygserver-config
B. Set the environment variable CYGWIN = server in win2003.
C. Restart win2003
Step 2: In the DOS Status of win2003, create a user account and password as shown in
Step 3: Create a folder in the partition where the system is located
Example: D: \ cygwin \ home \ postgres
Step 4: update the file:/etc/passwd
Run mkpasswd-l-u postgres>/etc/passwd
Explanation: add the user's s information to the/etc/passwd file.
Step 5: create a directory for storing data and set postgres as the owner of the Directory
Mkdir/usr/share/postgresql/data
Chown postgres/usr/share/postgresql
Chown postgres/usr/share/postgresql/data
Step 6: Configure user permissions
Enter "secpol. msc opens the "Local Security Settings" window, click "Local Policy"> "user permission allocation", find "Log on as a service" in the right window, and double-click it.
In the displayed window, click "add user or group" to add a user named "s.
Step 7: Initialize the data area
Log out of the original user, use postgres to enter win2003, and run the following command:
Initdb-d/var/postgresql/data
Note: The PostgreSQL installer can only initialize the database in the NTFS partition, while the PostgreSQL server program itself and some tool programs can be installed in any partition. But the security and reliability cannot be guaranteed. Creating a tablespace also fails.
Step 8: Install postmaster (PostgreSQL server) as an NT Service and start
Run cygrunsrv-I postmaster-p/usr/bin/postmaster-a "-d
/Usr/share/postgresql/data-I "-y cygserver-s int-u postgres-o
Command explanation:
Slave-I postmaster: create a service named postmaster.
Slave-p/usr/bin/postmaster: The Application Path is/usr/bin/postmaster.
Plugin-a "-D/usr/share/postgresql/data-I ":
Postmaster uses the directory/usr/share/postgresql/data as the data directory. The "-I" (TCP/IP connection) and "-D" parameters must be set.
Slave-y cygserver: indicates that postmaster depends on cygserver
Sending-s int: Sending signal INT when terminated is run by the user (-u) postgres
Slave-o: stops the service when the system exits.
Note: For more detailed parameter descriptions, run the following commands: "cygrunsrv-h" and "postmaster-help"
Then Cygrunsrv will ask you to enter the password twice.
OK. After the above configuration, you can use the command "psql-u postgres template1" to log on to the postgresql database.
Note: "template1" is the test database automatically created by Postgresql during initialization.