PostgreSQL database package with program instances

Source: Internet
Author: User
The Installation Process of postgresql in Windows is complicated (this article specifically refers to versions earlier than 8.0.3). PostgreSQL is officially used as an MSI package by pginstaller. It is not difficult to install it separately, but there are the following problems:

1. Poor compatibility of Remote Desktop installation (currently, the official statement is that there are problems in addition to win2003)
2. Unable to follow Program Package
3. After installation, the database creation will be affected by the partition format.
The following solutions are provided for the above problems:

A. Install pgsql on any machine, create a database, and export data.

B. Copy the installed directory of the entire pgsql to a temporary folder (for example, D: \ Temp), which should include:
Bin, Data, include, Lib, share, etc. You can consider adding pgadminiii as needed

C. Create a DLL directory in the Temporary Folder, including the following five files:
Libeay32.dll/libiconv-2.dll/libintl-2.dll/libpq. dll/ssleay32.dll
(Both can be found on the installed machine)

Dashboard searches for an ntright.exe file on the network and stores it in the bin directory (whatever you want, but it is best to delete it after installation)
-- Fixed: Find netuser.exe on the Internet and put it in the bin directory.
-- Thanks to Dr. canders for reminding me that the user account expiration was not taken into account before.

E. Create the setup. BAT file in the Temporary Folder. The content is as follows:

REM creates an ipvs user to manage the service.
net user ipvs [passwd]/Add/passwordchg: No
REM makes the ipvs user not in the Users Group, officially said it is not safe
net localgroup users Postgres/delete
REM sets Postgres user password to never expire. tips !!
. \ bin \ netuser Postgres/pwnexp: y
REM copy file, force
copy. \ dll \*. * % WINDIR % \ system32/Y
REM grants the Logon As Service permission to the S user. tips !!
This is not used in the parameter list of ntrights.exe in rem plug-in.
. \ bin \ ntrights.exe-u Postgres + R SeServiceLogonRight
REM is taken from the pginstaller source file. As shown in the following figure, the File Permission of ipvs users is mainly used for File Permission.
REM is actually used for NTFS, XP will report an error in FAT32 format, regardless!
cacls. /E/t/d Postgres
cacls. /E/T/g Postgres: r
cacls. \ data/e/T/P Postgres: C
REM creates a postgresql service. Do not add-l, note the usage of % Cd %
REM otherwise Event Viewer will become a place where windows writes a love letter to you
. \ bin \ pg_ctl register-N pgsql-u Postgres-P [passwd]-d "% Cd %/Data"
REM starts the service just created
Net start pgsql
F. Package and distribute the entire temporary directory, after decompression, run Setup. bat is complete.
G. Experienced friends can add conditional judgment or other signs to bat, so I am lazy.
note: pass the test in Win2000, WINXP, win2003 (NTFs, FAT32, remote desktop, and Chinese parent folder)

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.