Red Hat Database: Getting Started / Installation Guide | ||
---|---|---|
Prev | Appendix A. Building and Installing the Red Hat Database | Next |
![]() | Before installing the Red Hat Database from source, be certain to uninstall the RPM packages for Red Hat Database. See your Red Hat Linux documentation for information on how to use GnoRPM to uninstall packages. |
You can find the PostgreSQL software in /usr/src/redhat/SOURCES/postgresql-7.1.2.tar.gz after you install the source package.
Log in as root and copy the tarball to a temporary directory. Change to that directory and uncompress the package. Enter:
tar -xzvf postgresql-7.1.2.tar.gz |
cd postgresql-7.1.2 |
The next step of the installation procedure is to configure the source tree for your system. You do this by running the configure script, either with or without command-line options. For a default installation, enter:
./configure |
The script runs a number of tests to guess values for various system-dependent variables and to detect the characteristics of your operating system. When the tests are completed, the script creates several files in the build tree to record the variables it found and the values it used.
The default configuration builds the server, the utilities, and all client applications and interfaces that require only a C compiler. All files are installed under /usr/local/pgsql by default. However, you can customize the build and installation process by supplying one or more of the following command-line options to the configure script. If you choose to change where files are installed, ensure that you have the appropriate permissions to write into those areas.
To install all files under the directory PREFIX instead of /usr/local/pgsql, use the option --prefix=PREFIX. The actual files are installed into various subdirectories; no files are installed directly into the PREFIX directory.
If you have special needs, you can also customize the individual subdirectories with the following options.
To install architecture-dependent files under a different directory (EXEC-PREFIX) rather than PREFIX, use the option --exec-prefix=EXEC-PREFIX. This can be useful to share architecture-independent files between hosts. If you omit this, then EXEC-PREFIX is set to PREFIX and both architecture-dependent and architecture-independent files are installed under the same tree, which is probably what you want.
To install the executable programs under a different directory, use the option --bindir=DIRECTORY. The default is EXEC-PREFIX/bin, which normally resolves to /usr/local/pgsql/bin.
To install the read-only data files used by the installed programs under a different directory, use the option --datadir=DIRECTORY. The default is PREFIX/share. Note that this has nothing to do with where your database files will be placed.
To install the various configuration files under a different directory, use the option --sysconfdir=DIRECTORY. The default is PREFIX/etc.
To install libraries and dynamically loadable modules under a different directory, use the option --libdir=DIRECTORY. The default is EXEC-PREFIX/lib.
To install C and C++ header files under a different directory, use the option --includedir=DIRECTORY. The default is PREFIX/include.
To install documentation files, except for "man" pages, under a different directory, use the option --docdir=DIRECTORY. The default is PREFIX/doc.
To install the man pages that come with PostgreSQL under a different directory, use the option --mandir=DIRECTORY. By default, man pages are installed in their respective manx subdirectories under PREFIX/man.
![]() | To reduce the pollution of shared installation locations (such as /usr/local/include), the string "/postgresql" is automatically appended to datadir, sysconfdir, includedir, and docdir, unless the fully expanded directory name already contains the string "postgres" or "pgsql". For example, if you choose /usr/local as prefix, the C header files will be installed in /usr/local/include/postgresql. If the prefix is /opt/postgres, then the files will be installed in /opt/postgres/include. |
To add a list of directories to the list the compiler searches for header files, use --with-includes=DIRECTORIES where DIRECTORIES is a colon-separated list of directories. If you have optional packages (such as GNU Readline) installed in a non-standard location, you have to use this option and probably the corresponding --with-libraries option.
Example: --with-includes=/opt/gnu/include:/usr/sup/include.
To add a list of directories to the list the compiler searches for libraries, use --with-libraries=DIRECTORIES where DIRECTORIES is a colon-separated list of directories. You will probably have to use this option (and the corresponding --with-includes option) if you have packages installed in non-standard locations.
Example: --with-libraries=/opt/gnu/lib:/usr/sup/lib.
To enable locale support, use --enable-locale. There is a performance penalty associated with locale support, but if you are not in an English-speaking environment, you will most likely need this.
To enable single-byte character set recode support, use --enable-recode. See the Administrator and User's Guide for details.
To enable the use of multibyte-character encodings, use --enable-multibyte. This is primarily for languages such as Japanese, Korean, and Chinese. See the Administrator and User's Guide for details.
To set NUMBER as the default port number for server and clients, use --with-pgport=NUMBER. The default is 5432. The port can always be changed later on, but if you specify it here then both server and clients will have the same default compiled in, which can be very convenient.
To build the C++ interface library, use --with-CXX.
To build the Perl interface module, use --with-perl. The Perl interface will be installed at the usual place for Perl modules (typically under /usr/lib/perl), so you must have root access to perform the installation step (see Red Hat Database). You need to have Perl 5 installed to use this option.
To build the Python interface module, use --with-python. You need to have root access to be able to install the Python module at its default place (/usr/lib/pythonx.y). To be able to use this option, you must have Python installed and your system needs to support shared libraries. If you instead want to build a new complete interpreter binary, you will have to do it manually.
To build components that require Tcl/Tk, which are libpgtcl, pgtclsh, pgtksh, pgaccess, and PL/Tcl, use --with-tcl, but see below about the option --without-tk.
If you specify --with-tcl and --without-tk, programs that require Tk (that is, pgtksh and pgaccess) will be excluded.
The files tclConfig.sh and tkConfig.sh contain certain configuration information that is needed to build modules interfacing to Tcl or Tk. These files are normally found automatically at their well-known location, but if you want to use a different version of Tcl or Tk, you can specify the directory where to find them. Use --with-tclconfig=DIRECTORY and --with-tkconfig=DIRECTORY.
To build the ODBC driver package, use --enable-odbc.
To specify the directory where the ODBC driver searches for its odbcinst.ini configuration file, use --with-odbcinst=DIRECTORY. The default is /usr/local/pgsql/etc (or whatever you specified as --sysconfdir). A default file will be installed there. If you intend to share the odbcinst.ini file between several ODBC drivers, you may want to use this option.
To build with support for Kerberos authentication, use --with-krb4=DIRECTORY or --with-krb5=DIRECTORY. You can use either Kerberos version 4 or 5, but not both. The DIRECTORY argument specifies the root directory of the Kerberos installation; /usr/athena is the default. If the relevant headers files and libraries are not under a common parent directory, then you must use the --with-includes and --with-libraries options in addition to this option. If, on the other hand, the required files are in a location that is searched by default (for example, /usr/lib), you can omit the argument.
configure will check for the required header files and libraries to make sure that your Kerberos installation is sufficient before proceeding.
To set the name of the Kerberos service principal, use --with-krb-srvnam=NAME. The default is "postgres". There is probably no reason to change this.
To build with support for SSL (encrypted) connections, use --with-openssl=DIRECTORY. This requires that the OpenSSL package be installed. The DIRECTORY argument specifies the root directory of the OpenSSL installation; the default is /usr/local/ssl.
configure will check for the required header files and libraries to make sure that your OpenSSL installation is sufficient before proceeding.
To build the JDBC driver and associated Java packages, use --with-java. This option requires Ant to be installed (as well as a JDK, of course).
To enables the PostgreSQL server to use the syslog logging facility, use --enable-syslog. (Using this option does not mean that you must log with syslog or even that it will be done by default, it simply makes it possible to turn this option on at run time.)
To compile all programs and libraries with debugging symbols, use --enable-debug. This means that you can run the programs through a debugger to analyze problems. This enlarges the size of the installed executables considerably, and on non-gcc compilers it usually also disables compiler optimization, causing slowdowns. However, having the symbols available is extremely helpful for dealing with any problems that may arise. Currently, this option is considered of marginal value for production installations, but you should have it on if you are doing development work. You should not use this option on production systems.
To enable assertion checks in the server, which test for many "cannot happen" conditions, use --enable-cassert. This is invaluable for code development purposes, but the tests slow performance a little. Also, having the tests turned on may decrease the stability of your server! The assertion checks are not categorized for severity, and so what might be a relatively harmless bug will still lead to postmaster restarts if it triggers an assertion failure. Currently, this option is not recommended for production use, but you should have it on for development work.
If you prefer a C or C++ compiler different from the one configure picks, you can set the environment variables CC and CXX, respectively, to the program of your choice. Similarly, you can override the default compiler flags with the CFLAGS and CXXFLAGS variables. For example:
env CC=/opt/bin/gcc CFLAGS='-02 -pipe' ./configure |
To start the build, enter:
make |
All of PostgreSQL is successfully made. Ready to install. |
To enable specifying absolute paths directly to the CREATE DATABASE commands without defining environment variables, you must compile PostgreSQL with the C preprocessor macro ALLOW_ABSOLUTE_DBPATHS defined. One way to do this is:
make CPPFLAGS=-DALLOW_ABSOLUTE_DBPATHS all |
If you want to test the newly built server before you install it, you can run the regression tests at this point. The regression test suite verifies that PostgreSQL runs on your machine in the way the developers expected it to. Enter:
cd src/test/regress make check |
![]() | If you are upgrading an existing system and are going to install the new files over the old ones, you should have backed up your data and shut down the old server by now, as explained in the section called Step 6 – Are You Already Using PostgreSQL? in Chapter 1 above. |
To install the Red Hat Database, as root, enter:
make install |
If you built the Perl or Python interfaces and you were not the root user when you executed the above command, then that part of the installation probably failed. In that case, become the root user and enter:
make -C src/interfaces/perl5 install make -C src/interfaces/python install |
The standard install installs only the header files needed for client application development. If you plan to do any server-side program development (such as custom functions or datatypes written in C), then you may want to install the entire Red Hat Database include tree into your target include directory. To do that, enter
make install-all-headers |
Client-only installation. If you want to install only the client applications and interface libraries, use these commands:
make -C src/bin install make -C src/interfaces install make -C doc install |
To undo the installation, use the command make uninstall. However, this will not remove the Perl and Python interfaces and it will not remove any directories.
After the installation you can make room by removing the built files from the source tree with the make clean command. This will preserve the choices made by the configure program, so that you can rebuild everything with make later on. To reset the source tree to the state in which it was distributed, use make distclean. If you are going to build for several platforms from the same source tree, you must do this and re-configure for each build.