15.2. Требования

В принципе, запустить PostgreSQL должно быть возможно на любой современной Unix-совместимой платформе. Платформы, прошедшие специальную проверку на совместимость к моменту выпуска версии, перечислены далее в Разделе 15.6. В подкаталоге doc дистрибутива PostgreSQL вы можете найти несколько документов FAQ по разным платформам, к которым следует обратиться в случае затруднений.

Для сборки PostgreSQL требуются следующие программные пакеты:

  • Требуется GNU make версии 3.80 или новее; другие программы make или ранние версии GNU make работать не будут. (Иногда GNU make устанавливается под именем gmake.) Чтобы проверить наличие и версию GNU make, введите:

    make --version

  • Вам потребуется компилятор C, соответствующий ISO/ANSI (как минимум, совместимый с C89). Рекомендуется использовать последние версии GCC, но известно, что PostgreSQL собирается самыми разными компиляторами и других производителей.

  • Для распаковки пакета исходного кода необходим tar, а также gzip или bzip2.

  • По умолчанию при сборке используется библиотека GNU Readline. Она позволяет запоминать все вводимые команды в psql (SQL-интерпретатор командной строки для PostgreSQL) и затем, пользуясь клавишами-стрелками, возвращаться к ним и редактировать их. Это очень удобно и мы настоятельно рекомендуем пользоваться этим. Если вы не желаете использовать эту возможность, вы должны добавить указание --without-readline для configure. В качестве альтернативы часто можно использовать библиотеку libedit с лицензией BSD, изначально разработанную для NetBSD. Библиотека libedit совместима с GNU Readline и подключается, если libreadline не найдена, или когда configure передаётся указание --with-libedit-preferred. Если вы используете систему на базе Linux с пакетами, учтите, что вам потребуются два пакета: readline и readline-devel, если в вашем дистрибутиве они разделены.

  • По умолчанию для сжатия данных используется библиотека zlib. Если вы не хотите её использовать, вы должны передать configure указание --without-zlib. Это указание отключает поддержку сжатых архивов в pg_dump и pg_restore.

Следующие пакеты не являются обязательными. Они не требуются в стандартной конфигурации, но они необходимы для определённых вариантов сборки, описанных ниже:

  • Чтобы сервер поддерживал язык программирования PL/Perl, вам потребуется полная инсталляция Perl, включая библиотеку libperl и заголовочные файлы. Так как PL/Perl будет разделяемой библиотекой, библиотека libperl так же должна быть разделяемой для большинства платформ. В последних версиях Perl это вариант по умолчанию, но в ранних версиях это было не так, и в любом случае это выбирает тот, кто устанавливает Perl в вашей системе. Если вы планируете отвести PL/Perl не второстепенную роль, следует убедиться в том, что инсталляция Perl была собрана с флагом usemultiplicity (так ли это, может показать команда perl -V).

    Если вам не хватает какой-то необходимой разделяемой библиотеки, при сборке PostgreSQL появится примерно такое сообщение об этом:

    *** Cannot build PL/Perl because libperl is not a shared library.
    *** You might have to rebuild your Perl installation.  Refer to
    *** the documentation for details.

    (Если вы проигнорируете это замечание, вы просто увидите, что объект библиотеки PL/Perl, plperl.so или подобный, не будет установлен.) Если вы получили это сообщение, вы должны пересобрать и установить Perl вручную, чтобы успешно собрать PL/Perl. При этом в процессе конфигурирования Perl выберите разделяемую библиотеку.

  • Чтобы собрать сервер с поддержкой языка программирования PL/Python, вам потребуется инсталляция Python с заголовочными файлами и модулем distutils. Версия Python должна быть не меньше 2.3. (Чтобы работать с аргументами функций типа numeric, в инсталляции 2.3.x должен быть включён отдельно устанавливаемый модуль cdecimal; заметьте, что регрессионные тесты PL/Python не будут пройдены, если он отсутствует.) Python 3 поддерживается, начиная с версии 3.1, но используя Python 3, следует учитывать написанное в Разделе 43.1.

    Так как PL/Python будет разделяемой библиотекой, библиотека libpython так же должна быть разделяемой для большинства платформ. По умолчанию в стандартной инсталляции Python это не так. Если вы собираете и устанавливаете PostgreSQL и вы получили файл plpython.so (возможно, с другим расширением), всё в порядке. В противном случае вы заметите при сборке пролетающее уведомление такого содержания:

    *** Cannot build PL/Python because libpython is not a shared library.
    *** You might have to rebuild your Python installation.  Refer to
    *** the documentation for details.

    Это значит, что вам придётся пересобрать (возможно, частично) вашу инсталляцию Python, чтобы получить эту разделяемую библиотеку.

    Если у вас возникли сложности, запустите для Python 2.3 или новее configure с флагом --enable-shared. В некоторых операционных системах компилировать разделяемую библиотеку не требуется, но вам нужно убедить в этом систему сборки PostgreSQL. За подробностями обратитесь к Makefile в каталоге src/pl/plpython.

  • Чтобы собрать поддержку процедурного языка PL/Tcl, вам конечно потребуется инсталляция Tcl. Если вы используете Tcl до версии 8.4, убедитесь в том, что она собрана без поддержки многопоточности.

  • Чтобы включить поддержку национальных языков (NLS, Native Language Support), то есть возможность выводить сообщения программы не только на английском языке, вам потребуется реализация API Gettext. В некоторых системах эта реализация встроена (например, в Linux, NetBSD, Solaris), а для других вы можете получить дополнительный пакет по адресу http://www.gnu.org/software/gettext/. Если вы используете реализацию Gettext в библиотеке GNU, вам понадобится ещё пакет GNU Gettext для некоторых утилит. Для любых других реализаций он не требуется.

  • Вам могут понадобиться пакеты Kerberos, OpenSSL, OpenLDAP и/или PAM, если вам нужна поддержка аутентификации или шифрования, которую они обеспечивают.

  • Для сборки документации PostgreSQL предъявляется отдельный набор требований; см. Раздел I.2.

Если вы хотите скомпилировать код из дерева Git, а не из специального пакета исходного кода, либо вы хотите работать с этим кодом, вам также понадобятся следующие пакеты:

  • GNU Flex и Bison потребуются для сборки из содержимого Git или если вы меняете собственно файлы определений анализа и разбора. Если они вам понадобятся, то версия Flex должна быть не меньше 2.5.31, а Bison — не меньше 1.875. Другие программы lex и yacc работать не будут.

  • Perl 5.8 или новее потребуется для сборки из содержимого Git, либо если вы меняете исходные файлы этапов сборки, построенных на скриптах Perl. Если вы выполняете сборку в Windows, вам потребуется Perl в любом случае. Perl также требуется для выполнения некоторых комплектов тестов.

Если вам понадобится какой-либо пакет GNU, вы можете найти его на вашем локальном зеркале GNU (список зеркал: http://www.gnu.org/order/ftp.html) или на сайте ftp://ftp.gnu.org/gnu/.

Также проверьте, достаточно ли места на диске. Вам потребуется около 100 Мб для исходного кода в процессе компиляции и около 20 Мб для каталога инсталляции. Пустой кластер баз данных занимает около 35 Мб; базы данных занимают примерно в пять раз больше места, чем те же данные в обычном текстовом файле. Если вы планируете запускать регрессионные тесты, вам может временно понадобиться ещё около 150 Мб. Проверить наличие свободного места можно с помощью команды df.

15.2. Requirements

In general, a modern Unix-compatible platform should be able to run PostgreSQL. The platforms that had received specific testing at the time of release are listed in Section 15.6 below. In the doc subdirectory of the distribution there are several platform-specific FAQ documents you might wish to consult if you are having trouble.

The following software packages are required for building PostgreSQL:

  • GNU make version 3.80 or newer is required; other make programs or older GNU make versions will not work. (GNU make is sometimes installed under the name gmake.) To test for GNU make enter:

    make --version

  • You need an ISO/ANSI C compiler (at least C89-compliant). Recent versions of GCC are recommended, but PostgreSQL is known to build using a wide variety of compilers from different vendors.

  • tar is required to unpack the source distribution, in addition to either gzip or bzip2.

  • The GNU Readline library is used by default. It allows psql (the PostgreSQL command line SQL interpreter) to remember each command you type, and allows you to use arrow keys to recall and edit previous commands. This is very helpful and is strongly recommended. If you don't want to use it then you must specify the --without-readline option to configure. As an alternative, you can often use the BSD-licensed libedit library, originally developed on NetBSD. The libedit library is GNU Readline-compatible and is used if libreadline is not found, or if --with-libedit-preferred is used as an option to configure. If you are using a package-based Linux distribution, be aware that you need both the readline and readline-devel packages, if those are separate in your distribution.

  • The zlib compression library is used by default. If you don't want to use it then you must specify the --without-zlib option to configure. Using this option disables support for compressed archives in pg_dump and pg_restore.

The following packages are optional. They are not required in the default configuration, but they are needed when certain build options are enabled, as explained below:

  • To build the server programming language PL/Perl you need a full Perl installation, including the libperl library and the header files. Since PL/Perl will be a shared library, the libperl library must be a shared library also on most platforms. This appears to be the default in recent Perl versions, but it was not in earlier versions, and in any case it is the choice of whomever installed Perl at your site. If you intend to make more than incidental use of PL/Perl, you should ensure that the Perl installation was built with the usemultiplicity option enabled (perl -V will show whether this is the case).

    If you don't have the shared library but you need one, a message like this will appear during the PostgreSQL build to point out this fact:

    *** Cannot build PL/Perl because libperl is not a shared library.
    *** You might have to rebuild your Perl installation.  Refer to
    *** the documentation for details.

    (If you don't follow the on-screen output you will merely notice that the PL/Perl library object, plperl.so or similar, will not be installed.) If you see this, you will have to rebuild and install Perl manually to be able to build PL/Perl. During the configuration process for Perl, request a shared library.

  • To build the PL/Python server programming language, you need a Python installation with the header files and the distutils module. The minimum required version is Python 2.3. (To work with function arguments of type numeric, a 2.3.x installation must include the separately-available cdecimal module; note the PL/Python regression tests will not pass if that is missing.) Python 3 is supported if it's version 3.1 or later; but see Section 43.1 when using Python 3.

    Since PL/Python will be a shared library, the libpython library must be a shared library also on most platforms. This is not the case in a default Python installation. If after building and installing PostgreSQL you have a file called plpython.so (possibly a different extension), then everything went well. Otherwise you should have seen a notice like this flying by:

    *** Cannot build PL/Python because libpython is not a shared library.
    *** You might have to rebuild your Python installation.  Refer to
    *** the documentation for details.

    That means you have to rebuild (part of) your Python installation to create this shared library.

    If you have problems, run Python 2.3 or later's configure using the --enable-shared flag. On some operating systems you don't have to build a shared library, but you will have to convince the PostgreSQL build system of this. Consult the Makefile in the src/pl/plpython directory for details.

  • To build the PL/Tcl procedural language, you of course need a Tcl installation. If you are using a pre-8.4 release of Tcl, ensure that it was built without multithreading support.

  • To enable Native Language Support (NLS), that is, the ability to display a program's messages in a language other than English, you need an implementation of the Gettext API. Some operating systems have this built-in (e.g., Linux, NetBSD, Solaris), for other systems you can download an add-on package from http://www.gnu.org/software/gettext/. If you are using the Gettext implementation in the GNU C library then you will additionally need the GNU Gettext package for some utility programs. For any of the other implementations you will not need it.

  • You need Kerberos, OpenSSL, OpenLDAP, and/or PAM, if you want to support authentication or encryption using those services.

  • To build the PostgreSQL documentation, there is a separate set of requirements; see Section J.2.

If you are building from a Git tree instead of using a released source package, or if you want to do server development, you also need the following packages:

  • GNU Flex and Bison are needed to build from a Git checkout, or if you changed the actual scanner and parser definition files. If you need them, be sure to get Flex 2.5.31 or later and Bison 1.875 or later. Other lex and yacc programs cannot be used.

  • Perl 5.8 or later is needed to build from a Git checkout, or if you changed the input files for any of the build steps that use Perl scripts. If building on Windows you will need Perl in any case. Perl is also required to run some test suites.

If you need to get a GNU package, you can find it at your local GNU mirror site (see http://www.gnu.org/order/ftp.html for a list) or at ftp://ftp.gnu.org/gnu/.

Also check that you have sufficient disk space. You will need about 100 MB for the source tree during compilation and about 20 MB for the installation directory. An empty database cluster takes about 35 MB; databases take about five times the amount of space that a flat text file with the same data would take. If you are going to run the regression tests you will temporarily need up to an extra 150 MB. Use the df command to check free disk space.

FAQ