Windows PostgreSQL Installation Graphics Tutorial _postgresql

Source: Internet
Author: User
Tags postgresql
It provides multiple versions of parallel control, supports almost all SQL artifacts (including subqueries, transactions, and user-defined types and functions), and can achieve very broad (development) language bindings (including C,C++,JAVA,PERL,TCL, and Python). This article describes the installation process under Windows systems.

Generally speaking, a modern Unix-compatible platform should be able to run PostgreSQL. And if installed under Windows system, you need Cygwin and CYGIPC packs. In addition, if you are making a server-side programming language Pl/perl, you will also need a complete Perl installation, including Libperl libraries and header files.

For disk support, it takes about 65MB to store the source code in the installation process and approximately MB of space for the installation directory; an empty database probably needs 25MB; Then in the course of use, it is necessary to store data five times times the same amount of data in a flat text file. If you're running a regression test, you'll need an extra 90MB of space temporarily.

Step one: Download the windows-based Cygwin installer from the Web, double-click to open it.

Step Two: Select the installation type. Because we have downloaded the installer to the local hard drive, select the third item, and then click Next.

Step Three: Select the installation path. Generally by its default can be.

Fourth step: Select the download package to store the path on the local machine. Please follow the actual selection.

You will then be prompted to select the connection type, download the site, select the installation package (you need to be sure to add: cygrunsrv (category Admin), PostgreSQL (category Database), and then download the package and install Cygwin.

First step:Install Cygserver to NT service and start

A. Run script: $/usr/bin/cygserver-config
B. Setting environment variables in Win2003: cygwin=server
C. Restart Win2003

Step Two: in the DOS state of Win2003, create a new user account and password as shown in the following image


Step Three: create a new folder on the partition where the system resides

For example: D:\cygwin\home\postgres

Fourth Step: update file:/etc/passwd

Using commands: Mkpasswd-l-u postgres >>/etc/passwd

Explanation: Add the user postgres information to the/etc/passwd file

Step Fifth: create a new directory that holds the 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 Sixth: Configure user rights

Enter "Secpol.msc" in the Run box to open the Local Security Settings window, click "Local Policy"-"User Rights Assignment", and in the right window, locate "Log on as a service" and double-click Open.


In the window that appears, click Add User or group to add a user named "Postgres".


Seventh Step:Initializing data regions

Log off the original user, and use Postgres to enter Win2003 to run the following command:
Initdb–d/var/postgresql/data

Note: The PostgreSQL installer can only complete initialization of the database in an NTFS partition, while the PostgreSQL server program itself and some utility programs may be installed in any partition. If the FAT partition format, you can normally install PostgreSQL, but do not do the initialization of the database, only to be installed in the FAT partition after the manual execution of the Initdb.exe program to do, but security and reliability can not be guaranteed, to create a tablespace will also fail.

Step Eighth: Install postmaster (PostgreSQL server) into NT service and start

Using the command: Cygrunsrv–i postmaster–p/usr/bin/postmaster–a "-D
/usr/share/postgresql/data–i "–y cygserver–s int–u Postgres-o

Command explanation:
-i Postmaster: Create a new service called postmaster.
-p/usr/bin/postmaster: The application path is/usr/bin/postmaster.
-a "-d/usr/share/postgresql/data-i":
Postmaster Directory/usr/share/postgresql/data as the data directory, you must set the "-I" (TCP/IP connection) and "D" parameters.
-y Cygserver: Indicates that postmaster relies on Cygserver
-s int: send signal int when terminated was run by the user (-u) postgres
-o: Stop service on system exit

Note: More detailed parameter descriptions can be used with commands: "Cygrunsrv-h" and "Postmaster–help"
Then Cygrunsrv will let you enter the password two times.

OK, after the above configuration, you can use the command "Psql–u postgres template1" login PostgreSQL database.

Note: "Template1" is a test database that PostgreSQL automatically created at initialization time.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.