17.1. Требования #

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

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

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

    make --version
    
  • В качестве альтернативы PostgreSQL можно собирать, используя Meson. Это единственный вариант для сборки PostgreSQL на Windows с помощью Visual Studio. Сборка с Meson для других платформ на данный момент носит экспериментальный характер. При использовании Meson не требуется GNU make, но применяются остальные требования, указанные ниже.

    Требуется версия Meson не ниже 0.54.

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

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

  • Для сборки потребуются Flex и Bison. Другие программы lex и yacc работать не будут. Версия Bison должна быть 2.3 или выше.

  • В процессе сборки и для запуска некоторых пакетов тестов требуется Perl версии 5.14 или выше. (Это отдельное требование, не зависящее от требований для сборки PL/Perl; см. ниже.)

  • По умолчанию при сборке используется библиотека 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.

  • По умолчанию используется библиотека ICU. Если вы не хотите её использовать, передайте configure указание --without-icu, которое отключает поддержку правил сортировки ICU (см. Раздел 23.2).

    Для поддержки библиотеки ICU необходим пакет ICU4C. В настоящее время требуется ICU4C версии не ниже 4.2.

    По умолчанию для определения нужных параметров компиляции будет использоваться pkg-config. Этот вариант работает для ICU4C версии 4.6 и новее. Для более старых версий или в отсутствие pkg-config соответствующие параметры для configure можно задать в переменных ICU_CFLAGS и ICU_LIBS, как в этом примере:

    ./configure ... ICU_CFLAGS='-I/some/where/include' ICU_LIBS='-L/some/where/lib -licui18n -licuuc -licudata'

    (Даже если ICU4C находится в пути поиска, который использует компилятор, тем не менее нужно задать непустые значения, чтобы избежать обращения к pkg-config, например, ICU_CFLAGS=' '.)

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

  • Чтобы собрать поддержку языка программирования PL/Perl, вам потребуется полная инсталляция Perl, включая библиотеку libperl и заголовочные файлы. Версия Perl должна быть не старее 5.14. Так как PL/Perl будет разделяемой библиотекой, библиотека libperl тоже должна быть разделяемой для большинства платформ. В последних версиях Perl это вариант по умолчанию, но в ранних версиях это было не так, и в любом случае это выбирает тот, кто устанавливает Perl в вашей системе. Скрипт configure выдаст ошибку, если не сможет найти разделяемую libperl, когда выбрана сборка PL/Perl. В этом случае, чтобы собрать PL/Perl, вам придётся пересобрать и переустановить Perl. В процессе конфигурирования Perl выберите сборку разделяемой библиотеки.

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

  • Чтобы собрать сервер с поддержкой языка программирования PL/Python, вам потребуется инсталляция Python с заголовочными файлами и модулем sysconfig. Версия Python должна быть не ниже 3.6.8.

    Так как PL/Python будет разделяемой библиотекой, библиотека libpython тоже должна быть разделяемой для большинства платформ. По умолчанию при сборке инсталляции Python из пакета исходного кода это не так, но во многих дистрибутивах имеется нужная разделяемая библиотека. Скрипт configure выдаст ошибку, если не сможет найти разделяемую libpython, когда выбрана сборка PL/Python. Это может означать, что вам нужно либо установить дополнительные пакеты, либо пересобрать (частично) вашу инсталляцию Python, чтобы получить эту библиотеку. При сборке Python из исходного кода выполните configure с флагом --enable-shared.

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

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

  • Если вам нужна поддержка зашифрованных клиентских соединений, вам потребуется OpenSSL. OpenSSL также необходим для генерации случайных чисел на платформах, где отсутствует /dev/urandom (это не относится к Windows). Версия OpenSSL должна быть не ниже 1.1.1.

    Дополнительно поддерживается LibreSSL с использованием оболочки совместимости OpenSSL. Требуется версия не ниже 3.4 (от OpenBSD версии 7.0).

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

  • Вам понадобится Curl для сборки необязательного модуля, который реализует поток авторизации устройства OAuth для клиентских приложений.

  • Если вам нужна поддержка сжатия данных методом LZ4, вам потребуется собственно библиотека LZ4; см. default_toast_compression и wal_compression.

  • Если вам нужна поддержка сжатия данных методом Zstandard, вам потребуется собственно библиотека Zstandard версии не ниже 1.4.0; см. wal_compression.

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

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

17.1. 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 described in Section 17.6 below.

The following software packages are required for building PostgreSQL:

  • GNU make version 3.81 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
    

  • Alternatively, PostgreSQL can be built using Meson. This is the only option for building PostgreSQL on Windows using Visual Studio. For other platforms, using Meson is currently experimental. If you choose to use Meson, then you don't need GNU make, but the other requirements below still apply.

    The minimum required version of Meson is 0.54.

  • You need an ISO/ANSI C compiler (at least C99-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.

  • Flex and Bison are required. Other lex and yacc programs cannot be used. Bison needs to be at least version 2.3.

  • Perl 5.14 or later is needed during the build process and to run some test suites. (This requirement is separate from the requirements for building PL/Perl; see below.)

  • 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 ICU library is used by default. If you don't want to use it then you must specify the --without-icu option to configure. Using this option disables support for ICU collation features (see Section 23.2).

    ICU support requires the ICU4C package to be installed. The minimum required version of ICU4C is currently 4.2.

    By default, pkg-config will be used to find the required compilation options. This is supported for ICU4C version 4.6 and later. For older versions, or if pkg-config is not available, the variables ICU_CFLAGS and ICU_LIBS can be specified to configure, like in this example:

    ./configure ... ICU_CFLAGS='-I/some/where/include' ICU_LIBS='-L/some/where/lib -licui18n -licuuc -licudata'
    

    (If ICU4C is in the default search path for the compiler, then you still need to specify nonempty strings in order to avoid use of pkg-config, for example, ICU_CFLAGS=' '.)

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. The minimum required version is Perl 5.14. 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. configure will fail if building PL/Perl is selected but it cannot find a shared libperl. In that case, 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.

    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).

  • To build the PL/Python server programming language, you need a Python installation with the header files and the sysconfig module. The minimum supported version is Python 3.6.8.

    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 built from source, but a shared library is available in many operating system distributions. configure will fail if building PL/Python is selected but it cannot find a shared libpython. That might mean that you either have to install additional packages or rebuild (part of) your Python installation to provide this shared library. When building from source, run Python's configure with the --enable-shared flag.

  • To build the PL/Tcl procedural language, you of course need a Tcl installation. The minimum required version is Tcl 8.4.

  • 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 https://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 OpenSSL, if you want to support encrypted client connections. OpenSSL is also required for random number generation on platforms that do not have /dev/urandom (except Windows). The minimum required version is 1.1.1.

    Additionally, LibreSSL is supported using the OpenSSL compatibility layer. The minimum required version is 3.4 (from OpenBSD version 7.0).

  • You need MIT Kerberos (for GSSAPI), OpenLDAP, and/or PAM, if you want to support authentication using those services.

  • You need Curl to build an optional module which implements the OAuth Device Authorization flow for client applications.

  • You need LZ4, if you want to support compression of data with that method; see default_toast_compression and wal_compression.

  • You need Zstandard, if you want to support compression of data with that method; see wal_compression. The minimum required version is 1.4.0.

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

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

FAQ