Installing PostgreSQL on Windows 2000, XP, and 2003

Một phần của tài liệu Beginning PHP and Postgre SQL 8 From Novice to Professional phần 7 pot (Trang 78 - 82)

Only as of version 8.0 has a native version of PostgreSQL been available for the Windows plat- form. However, despite being such a new addition, the installer is already very usable, making installation on the Windows platform quite trivial. Please note that PostgreSQL cannot be installed on the FAT file system; only NTFS is supported.

The following steps outline the installation process on Windows:

1. Installation Language and Log: Unzip the package, and then click the postgres-X.X.msi icon, found in the downloaded installer package, to begin the installation process. The first installer screen prompts you to choose a preferred language for the process. Presently the installer supports the Brazilian Portuguese, English, French, German, Russian, Swedish, and Turkish languages. At this stage you can also choose to write a log that details the installation process. Typically this is necessary only during troubleshooting situations, but feel free to check this box if you want to learn more about exactly what happens during installation. Choose the appropriate language and, if necessary, enable the log. Click the Start button to continue.

2. Installation Welcome and Notes: The next few screens offer a welcome message and information regarding installation issues, licensing terms, and various other pertinent bits of data. Feel free to peruse these screens, and then proceed by clicking Next.

3. Installation Options: Next you are presented with installation options. These options are broken into four categories:

1. Database Server: This category contains options for installing the data directory files, for enabling non-English support for status and error messages, and for supporting geographical data. If you don’t require the latter two options, feel free to leave both disabled. However, be sure to leave the data directory installation option enabled.

586 C H A P T E R 2 5 ■ I N S T A L L I N G P O S T G R E S Q L

2. User Interfaces: This category includes the psql and pgAdmin III GUI applications, both of which are scheduled for installation by default. Both applications are intro- duced in Chapter 27.

3. Database Drivers: This category includes the JDBC, Npgsql, ODBC, and OLEDB drivers, all of which are scheduled for installation by default. If you don’t plan to use PostgreSQL in conjunction with Java-, .NET-, ODBC-, or OLEDB-compatible tech- nologies, respectively, then cancel their installation to save some drive space.

4. Development: This category includes various development-related files and utilities, all of which are not scheduled for installation by default and are not required for the purposes of this book.

During this stage you also have the opportunity to change the installation directory, with the default being set to C:\Program Files\PostgreSQL\X.X\. Because spaces in pathnames can be somewhat of an annoyance when writing scripts, consider changing this to C:\pgsql\ or something similar. Once this is complete, click Next to continue.

4. Service Configuration: This step involves setting several very important parameters:

1. Install as a Service: You’re first prompted to install PostgreSQL as a service, which means it will turn on and off automatically along with the operating system. You’ll learn more about running PostgreSQL as a service in the later section, “Starting and Stopping PostgreSQL Automatically.” When running PostgreSQL as mission-critical applications, you’ll certainly want to leave this enabled; however, for testing envi- ronments, you may choose to start and stop it manually. Doing so is also covered in the aforementioned section. If you choose to not install PostgreSQL as a service, then the remaining five parameters are irrelevant, so you should continue to Step 5.

2. Service Name: If you do choose to install PostgreSQL as a service, this field repre- sents the name of the service; you can set this field to anything you please, although the default is just fine.

3. Account Name: This field specifies the name of the user who owns the PostgreSQL daemon process. Consider leaving this set to postgres (unless you have good reasons for doing otherwise), which causes this account to be created and used expressly for operating the PostgreSQL daemon. You’re also free to specify the name of an existing account; however, this account cannot be a privileged user, such as Administrator!

4. Account Domain: This field specifies the server’s commonly used network name.

This is set to your server’s specified domain name by default.

5. Daemon Account: Finally, you’re prompted to enter and verify a password via the Account password and Verify password fields, respectively. Be sure to choose a sufficiently difficult password, yet something you can remember. You also have the option of leaving this blank, which prompts PostgreSQL to create a random pass- word for you. If you allow PostgreSQL to choose the password, it will not communicate the password to you, because this account should be used for no purpose other than to operate the daemon account, and therefore there is no particular reason to know this password.

5. Initialize the Database Cluster: If you chose to install PostgreSQL as a service, you also have the option to further tweak the server’s default configuration. Pictured in Figure 25-1, this screen’s title may be a tad misleading to some readers, as cluster tends to be defined as a database or other server type consisting of more than one node. However, the PostgreSQL community defines this term as a collection of databases accessed through a particular daemon instance. With that in mind, you can see that there are several options presented on this screen:

1. Initialize Database Cluster: This option determines whether the database cluster should be initialized (created). Of course, you want to leave this enabled.

2. Port Number: By default, the PostgreSQL server accepts connections on port 5432.

Unless you have specific reasons for changing this value, using port 5432 is fine.

3. Addresses: Left unchecked, this setting disallows any PostgreSQL connections other than those originating from the local server. If you plan to run PostgreSQL and the application on the same server (for instance, run a Web site in which both the Web and database server reside on the same machine), leave this unchecked.

Otherwise, enable this feature. If you require the ability to connect from remote locations, keep in mind that this isn’t the only required step. You also need to modify the pg_hba.conf file, introduced in Chapter 29.

4. Locale: This setting determines PostgreSQL’s default locale, which defines settings specific to a particular culture, such as character, number, and monetary format- ting and character ordering. Over 150 locales are presently supported, including locales targeting areas as far flung as Greece, Finland, Ecuador, and Thailand. If you’re in the United States, set this value to English, United States.

5. Encoding: Because of the disparity of characters, accent marks, and character ordering among languages, you want to make sure that PostgreSQL properly handles encoding according to your specific needs. You do so by choosing the proper encoding with this option. By default this is set to SQL_ASCII.

6. PostgreSQL Administrator Account: Next up are the administrator (Superuser) name and corresponding Password fields. Note that this is different from the previ- ously created account used to operate the service daemon—it’s the PostgreSQL account that you’ll use to administer the internal server workings such as user and database creation. For security reasons, the chosen password should in no circum- stances be the same as that used for the service daemon user, assuming that you specified one rather than allowing PostgreSQL to choose one for you. By default, this username is set to postgres, although you’re free to choose any name you please.

588 C H A P T E R 2 5 ■ I N S T A L L I N G P O S T G R E S Q L

Figure 25-1. Initializing the database cluster

6. Enable Procedural Languages: If you chose to install PostgreSQL as a service, you also have the option to enable one or several procedural languages, which can be used to write user-defined functions (introduced in Chapter 32). At present, seven choices are available for Windows: PL/pgSQL (enabled by default), PL/Perl, PL/Perl (untrusted), PL/Python (untrusted), PL/Tcl, PL/Tcl (untrusted), and PL/Java (trusted and untrusted).

PL/pgSQL is a procedural language that allows you to integrate a series of SQL statements and procedural programming logic together to accomplish a more complex task than what is accomplished with SQL statements alone. PL/Perl offers the same capabilities as PL/pgSQL, but the code is written using the Perl language. The difference between the trusted and untrusted versions of PL/Perl is that in the trusted version, some of Perl’s features are disabled (file handle operations and use of USE and REQUIRE, in par- ticular) to ensure a higher level of security, whereas in the untrusted version, you have complete autonomy to use these features. PL/Python allows for the creation of user- defined functions using the Python language, PL/Tcl with the Tcl language, and PL/Java with the Java language. Choose which languages you think might be of use to you and then click Next to continue.

Some of these options may be disabled depending upon whether the necessary software is installed on your system. For instance, to activate Perl and Tcl support, you need to install ActiveState (http://www.activestate.com/), ActivePerl, and ActiveTcl packages, respectively.

7. Enable Contrib Modules: This step, shown in Figure 25-2, allows you to enable addi- tional, nonstandard functionality that may be useful depending upon your particular environment. Introducing each of the modules listed in Figure 25-2 is beyond the scope of this chapter, because most will be of no use to the typical reader. However, should you require the use of, for instance, a data structure or some special behavior not otherwise available in the default distribution, be sure to consult these modules before endeavoring to implement the feature. For instance, enabling the ISBN and ISSN module results in the addition of a datatype capable of representing ISBN and ISSN numbers used to identify books and serial publications, respectively.

Figure 25-2. Enabling contributed modules

8. Ready to Install: PostgreSQL is ready to be installed. Go ahead and click Next to install the software. Once completed, you’ll be notified of a successful installation and invited to join the pgsql-announce mailing list, which offers information regarding new releases and bug fixes. If you’d like to subscribe, click the button, which takes you to a corresponding Web page. In any case, click Finish to exit the installer. Congratulations, PostgreSQL is now installed!

Một phần của tài liệu Beginning PHP and Postgre SQL 8 From Novice to Professional phần 7 pot (Trang 78 - 82)

Tải bản đầy đủ (PDF)

(90 trang)