36.2. The PostgreSQL Database Server Module

This module allows an administration to manage databases, tables, fields, and records in a PostgreSQL server. In many ways, it is very similar to the MySQL module covered in Chapter 35. When you click on its icon in the Servers category of Webmin, the main page displays a list of existing databases on your system, as shown in Figure 36.1.

Figure 36.1. The PostgreSQL module main page.


If Webmin detects that PostgreSQL is not installed, has not been initialized, or cannot be connected to, the main page will not appear as shown in Figure 36.1. Instead, some kind of error message will be displayed. The most common ones are covered in the next few paragraphs.

If the message PostgreSQL is not running on your system appears, you will need to start the database server before this module can be used to manage it. Just click the Start PostgreSQL Server button at the bottom of the page. If you want it to be started at boot time from now on, use the Bootup and Shutdown module (covered in Chapter 9) to create a new action to start it. On most Linux distributions, the PostgreSQL packages include a bootup action script called postgres, or postgresql, that is not enabled by default.

If PostgreSQL is running through Webmin, Webmin does not know the administration username and password needed to connect to it, and the PostgreSQL Login form will be displayed on the main page. You must enter valid login details for your database server, typically for the postgres user who has full access to all databases and features. Logging in as another less privileged user may work at first, but you will not be able to use all of the features of the module. Sometimes PostgreSQL is set up to authenticate users by their UNIX username, rather than by a separate login and password (the ident authentication mode). If this is the case on your system, you will need to check the Connect as same Unix user? box on the form.

If an error message like The PostgreSQL host configuration file hba.conf was not found appears, then either the module's configuration is incorrect or your server has not yet been initialized for the first time. Many packaged versions for Linux systems need to be initialized before they can be used, usually by running the initdb command. If the module knows how to do this on your system, an Initialize Database button will be displayed that you can click on to set up the server for the first time.

The error message The PostgreSQL client program psql was not found on your system indicates that PostgreSQL is not installed at all, or that it is in a different directory from the one Webmin expects. On Linux and FreeBSD systems, the module assumes that you have installed the packages for the database included with your distribution, while on other operating systems it assumes that a standard installation from the source code was done into /usr/local/pgsql. If you have installed it and the error message still appears, you will need to read Section 36.17 “Configuring the PostgreSQL Database Server Module” for details on how to adjust the paths that the module uses.

If you are running Linux, and PostgreSQL is not installed, use the Software Packages module (covered in Chapter 12) to install all packages starting with postgres from the distribution CD or website. Often there will be several, such as postgresql, postgresql-server, and postgresql-devel. For other operating systems, visit www.postgresql.org/ to download the source code distribution, then compile and install it.

The PostgreSQL module uses SQL commands to perform actions like creating tables, adding fields, and editing records. To execute these commands, Webmin must connect to the database server, which can be done in one of two ways. It can either run the psql command with the correct parameters and parse its output, or use the Perl DBI library to connect directly.

The former method is always available, because the psql command is always installed when the database server is. It is not totally reliable, however, as certain kinds of table data produce output that cannot always be parsed. For this reason, you should install the DBI and DBD::Pg Perl modules. If either is missing, a message will be displayed at the bottom of the main page prompting you to install one or both by clicking on a link. This will take you to a page in the Perl Modules module (covered in Chapter 27) where DBI and/or DBD::Pg are downloaded and installed for you.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.149.23.133