PostgreSQL Installation Guide
PostgreSQL Installation Guide
0 Installation Guide
Table of Contents
1 Introduction ................................................................................................................. 4
1.1 Typographical Conventions Used in this Guide ................................................. 5
2 Requirements Overview.............................................................................................. 6
2.1 Hardware Requirements...................................................................................... 7
2.2 Software Prerequisites ........................................................................................ 7
3 Installing PostgreSQL with the Graphical Installation Wizard .................................. 9
3.1 Invoking the Graphical Installer ....................................................................... 10
4 Using the Language Pack Installer ........................................................................... 20
4.1 Using Language Pack ....................................................................................... 25
5 Using Stack Builder .................................................................................................. 27
6 Invoking the Installer from the Command Line ....................................................... 33
6.1 Performing a Text Mode Installation ................................................................ 33
6.2 Performing an Unattended Installation ............................................................. 36
7 Reference - Command Line Options ........................................................................ 38
8 Uninstalling PostgreSQL .......................................................................................... 42
8.1 Uninstalling PostgreSQL on a Linux System ................................................... 42
8.2 Uninstalling PostgreSQL on a Windows System ............................................. 46
8.3 Uninstalling PostgreSQL on a Mac System...................................................... 51
9 Installation Troubleshooting ..................................................................................... 55
9.1 Installation Log Files ........................................................................................ 55
1 Introduction
The PostgreSQL installers created by EnterpriseDB are designed to make it quick and
simple to install PostgreSQL on your computer. The installer provides:
The sections that follow provide information about using the PostgreSQL 10.0 installer:
In the following descriptions a term refers to any word or group of words that are
language keywords, user-supplied values, literals, etc. A term’s exact meaning depends
upon the context in which it is used.
Italic font introduces a new term, typically, in the sentence that defines it for the
first time.
Fixed-width (mono-spaced) font is used for terms that must be given
literally such as SQL commands, specific table and column names used in the
examples, programming language keywords, etc. For example, SELECT * FROM
emp;
Italic fixed-width font is used for terms for which the user must
substitute values in actual usage. For example, DELETE FROM table_name;
A vertical pipe | denotes a choice between the terms on either side of the pipe. A
vertical pipe is used to separate two or more alternative terms within square
brackets (optional choices) or braces (one mandatory choice).
Square brackets [ ] denote that one or none of the enclosed term(s) may be
substituted. For example, [ a | b ], means choose one of “a” or “b” or neither
of the two.
Braces {} denote that exactly one of the enclosed alternatives must be specified.
For example, { a | b }, means exactly one of “a” or “b” must be specified.
Ellipses ... denote that the proceeding term may be repeated. For example, [ a |
b ] ... means that you may have the sequence, “b a a b a”.
2 Requirements Overview
PostgreSQL 10.0 is certified on the following platforms:
32 bit Windows:
Windows 7, 8, and 10
64 bit Windows:
Windows 7, 8, and 10
Windows 2012
Windows 2016
32 bit Linux:
Ubuntu 14.04
64 bit Linux:
Debian 7 and 8
SLES 12
MAC OS X:
a 1 GHz processor
2 GB of RAM
512 MB of HDD
User Privileges
On a Linux or Mac system, you must have superuser privileges to perform a PostgreSQL
installation. To perform an installation on a Windows system, you must have
administrator privileges.
If you are installing PostgreSQL into a Windows system that is configured with User
Account Control (UAC) enabled, you can assume sufficient privileges to invoke the
graphical installer by right clicking on the name of the installer and selecting Run as
administrator from the context menu. If prompted, enter an administrator password
to continue.
You must install xterm, konsole, or gnome-terminal before executing any console-
based program installed by the PostgreSQL installer.
SELinux Permissions
Before installing PostgreSQL on a system that is running SELinux, you must set SELinux
to permissive mode.
The following example works on Redhat Enterprise Linux, Fedora Core or CentOS
distributions. Use comparable commands that are compatible with your Linux
distribution to set SELinux to permissive mode during installation and return it to
enforcing mode when installation is complete.
Before installing PostgreSQL, set SELinux to permissive mode with the command:
# setenforce Permissive
When the installation is complete, return SELinux to enforcing mode with the
command:
# setenforce Enforcing
Be sure to apply Windows operating system updates before invoking the PostgreSQL
installer. If (during the installation process) the installer encounters errors, exit the
installation, and ensure that your version of Windows is up-to-date before restarting the
installer.
The Mac OS X installer is an App Bundle (a set of files and directories in a prescribed
format). The installer is available as a disk image (.dmg) file from the website or as an
archive (.zip) from StackBuilder. To extract the installer, simply mount the disk image
and copy the installer to the desired location, or run it directly from the disk image.
By default, Mac OS X ships with shared memory settings that are too low for running
PostgreSQL. The installer will detect this, and if possible, reconfigure shared memory
and then prompt you to reboot the system and rerun the PostgreSQL installer. For more
information, please see the README file in the distribution disk image.
Note that if you are invoking the graphical installer to perform a system upgrade, the
installer will preserve the configuration options specified during the previous installation.
When the PostgreSQL installation finishes, you will be offered the option to invoke the
Stack Builder package manager. Stack Builder provides an easy-to-use graphical
interface that downloads and installs applications, drivers and utilities and their
dependencies. See Section 5 for more information about using Stack Builder.
The graphical PostgreSQL installer is available from the EnterpriseDB website at:
http://www.enterprisedb.com/downloads/postgres-postgresql-downloads
After navigating to the Product Downloads page, select the PostgreSQL tab, and then
choose the PostgreSQL installer that corresponds to your platform. When the download
completes, extract the files using a system-specific file extractor.
Section 3.1 demonstrates using the setup wizard to install PostgreSQL on a Linux system;
follow the same procedure to install PostgreSQL on a Windows or Mac system.
Note that in some versions of Windows, you can invoke the installer with
Administrator privileges by right clicking on the installer icon and selecting Run as
Administrator from the context menu.
On a Linux host, disable SELinux, navigate into the directory in which the installer
resides, and invoke the installer with the command:
./postgresql-10.0-linux-x64.run
Click Next to continue. The Installation Directory window (Figure 3.2) opens.
Accept the default installation directory, or specify an alternate location and click Next
to continue.
Use options on the Select Components dialog (see Figure 3.3) to select which
software components will be installed; select:
Please note this is not a comprehensive list; the command line tools installed may
vary by platform.
Click Next to continue. The Data Directory window opens, as shown in Figure 3.4.
Accept the default location or specify the name of the alternate directory in which you
wish to store the data files, and click Next to continue.
PostgreSQL uses the password specified on the Password window for both the database
superuser and the PostgreSQL service account.
The specified password must conform to any security policies existing on the
PostgreSQL host. After entering a password in the Password field, and confirming the
password in the Retype Password field, click Next to continue.
Use the Port field to specify the port number on which the server should listen. The
default listener port is 5432 (shown in Figure 3.6). Click Next to continue.
Use the Locale field to specify the locale that will be used by the new database cluster.
The Default locale is the operating system locale (shown in Figure 3.7). Click Next
to continue.
The wizard will inform you that it has the information required to install PostgreSQL (see
Figure 3.8); click Next to continue.
During the installation, the setup wizard confirms the installation progress of PostgreSQL
via a series of progress bars (see Figure 3.9).
Before the setup wizard completes the PostgreSQL installation, it offers to Launch
Stack Builder at exit (see Figure 3.10).
Figure 3.10 - The installation wizard offers to Launch Stack Builder at exit.
You can optionally uncheck the Stack Builder box and click Finish to complete the
PostgreSQL installation or accept the default and proceed to Stack Builder.
The Stack Builder utility provides a graphical interface that downloads and installs
applications and drivers that work with PostgreSQL. You can invoke Stack Builder at
installation time or (after the installation completes) through the PostgreSQL menu. For
more information about Stack Builder, see Section 5, Using Stack Builder.
The Perl package contains the cpan package manager, and Python contains pip and
easy_install package managers. There is no package manager for TCL/TK.
There is a major change in our Python installation for Linux. In previous releases,
plpython was statically linked with ActiveState's python library. The Language Pack
Installer dynamically links with our shared object for python. In ActiveState Linux
installers for Python, there was no dynamic library. As a result of these changes,
plpython will no longer work with ActiveState installers.
Language Pack installers are available from the EnterpriseDB website; visit:
http://www.enterprisedb.com
Before invoking the installer, you must assume Administrative privileges (on Windows)
or superuser privileges (on Linux). If you are using SELinux, disable SELinux before
invoking the installer (see Section 2.2).
On a Linux host, assume superuser privileges, disable SELinux (if applicable), navigate
into the directory in which the installer resides, and invoke the installer with the
command:
./edb-languagepack-10-platform_details.run
If prompted, select an installation language. The installer Welcome window opens (see
Figure 4.1).
The Ready to Install window (see Figure 4.2) displays the Language Pack
installation directory:
On OSX: /Library/edb/languagepack-10
A progress bar marks installation progress (see Figure 4.3); click Next to continue.
The installer will inform you that the Language Pack installation has completed (see
Figure 4.4); click Finish to exit the installer.
On Linux:
If you are using Linux (32 or 64-bit), you must manually add Perl, Python and TCL to the
path or modify the service scripts to include the following variables. To simplify setting
the paths, you can create environment variables that identify the installation location:
PERLHOME=/opt/edb/languagepack-10/Perl-5.24
PYTHONHOME=/opt/edb/languagepack-10/Python-3.4
TCLHOME=/opt/edb/languagepack-10/Tcl-8.6
export PYTHONHOME
You can also use the environment variables when setting the path:
export PATH=$PYTHONHOME/bin:$PERLHOME/bin:$TCLHOME/bin:$PATH
export PATH=/opt/edb/languagepack-10/Python-3.4/bin:
Lastly, you must tell Linux where to find the shared libraries:
export
LD_LIBRARY_PATH=$PYTHONHOME/lib:$PERLHOME/lib/CORE:$TCLHOME/lib:$
LD_LIBRARY_PATH
On 32-bit Windows:
If you are using 32-bit Windows, you must tell the Python interpreter where to find
Python:
set PYTHONHOME=C:\edb\languagepack-10\i386\Python-3.4
SET PATH=C:\edb\languagepack-10\i386\Python-
3.4;C:\edb\languagepack-10\i386\Perl-
5.24\bin;C:\edb\languagepack-10\i386\Tcl-8.6\bin;%PATH%
On 64-bit Windows:
If you are using 64-bit Windows, you must tell the Python interpreter where to find
Python:
SET PYTHONHOME=C:\edb\languagepack-10\x64\Python-3.4
SET PATH=C:\edb\languagepack-10\x64\Python-
3.4;C:\edb\languagepack-10\x64\Perl-5.24\bin;C:\edb\languagepack-
10\x64\Tcl-8.6\bin;%PATH%
On OSX:
If you are using OSX, you must manually add Perl, Python and TCL to the path or
modify the service scripts to include the following variables. To simplify setting the
paths, you can create environment variables that identify the installation location:
PERLHOME=/Library/edb/languagepack-10/Perl-5.24
PYTHONHOME=/Library/edb/languagepack-10/Python-3.4
TCLHOME=/Library/edb/languagepack-10/Tcl-8.6
export PYTHONHOME
You can also use the environment variables when setting the path:
export PATH=$PYTHONHOME/bin:$PERLHOME/bin:$TCLHOME/bin:$PATH
Lastly, you must tell OSX where to find the shared libraries:
export
DYLD_LIBRARY_PATH=$PYTHONHOME/lib:$PERLHOME/lib/CORE:$TCLHOME/lib
:$DYLD_LIBRARY_PATH
Known Restrictions:
Stack Builder requires Internet access; if your installation of PostgreSQL resides behind a
firewall (with restricted Internet access), Stack Builder can download program installers
through a proxy server. The module provider determines if the module can be accessed
through an HTTP proxy or an FTP proxy; currently, all updates are transferred via an
HTTP proxy and the FTP proxy information is not used.
You can invoke Stack Builder at any time after the installation has completed by
selecting the Application Stack Builder menu option from the PostgreSQL 10
menu. Enter your system password (if prompted), and the Stack Builder welcome
window opens (shown in Figure 5.1).
Use the drop-down listbox on the welcome window to select your PostgreSQL
installation.
If the selected PostgreSQL installation has restricted Internet access, use the Proxy
Servers button on the Welcome window to open the Proxy servers dialog (shown in
Figure 5.2).
Enter the IP address and port number of the proxy server in the HTTP proxy or FTP
proxy fields on the Proxy servers dialog. Currently, all Stack Builder modules are
distributed via HTTP proxy (FTP proxy information is ignored). Click OK to continue.
The tree control on the Stack Builder module selection window (shown in Figure 5.3)
contains a node for each module category; click on a category heading to expose the
modules within that category (as shown in Figure 5.4).
Each entry within the tree control is the name of a module that can be installed with Stack
Builder.
If the module is installed, you will see the word (installed) to the right of the
module name.
Boxes next to the modules that are already installed, but eligible for update are
automatically checked.
To add new modules to the selected PostgreSQL installation, check the box to the left of
the module name and click Next.
The Selected packages window confirms the packages selected (Figure 5.5).
The package installers are downloaded to the directory specified in the Download
directory field. Use the button to the right of the Download directory field to open
a file selector, and choose an alternate location in which to store the downloaded
installers.
Click Next to connect to the server and download the required installation files. (see
Figure 5.6).
Figure 5.6 - Stack Builder is downloading installation files for the specified packages.
When the downloads complete, a window opens confirming that the installation files
have been downloaded and are ready for installation (see Figure 5.7).
You can check the box next to Skip Installation, and select Next to exit Stack
Builder without installing the downloaded files, or leave the box unchecked and click
Next to start the installation process.
Each downloaded installer has different requirements. As the installers execute, they
may prompt you to confirm acceptance of license agreements, to enter passwords, and
enter configuration information.
During the installation process, you may be prompted by one (or more) of the installers to
restart your system. Select No or Restart Later until all installations are completed.
When the last installation has completed, re-boot the system to apply all of the updates.
You may occasionally encounter packages that don’t install successfully. If a package
fails to install, Stack Builder will alert you to the installation error with a popup dialog,
and write a message to the log file at:
On Windows: %TEMP%
On Linux: /tmp
When the installation is complete, the installer will alert you to the success or failure of
the installations of the requested packages. If you were prompted by an installer to restart
your computer, re-boot now.
Please note: The modules supported by Stack Builder are subject to change and vary by
platform.
Include the --mode text option when invoking the installer to perform an
installation from the command line.
Include the --mode unattended option when invoking the installer to perform
an installation without user input.
Please Note: If you are invoking the installer from the command line to perform a system
upgrade, the installer will ignore command line options, and preserve the configuration of
the previous installation.
To specify that the installer should run in text mode, include the --mode text command
line option when invoking the installer. Text-mode installations are useful if you need to
install on a remote server using ssh tunneling (and have access to a minimal amount of
bandwidth), or if you do not have access to a graphical interface.
In text mode, the installer uses a series of command line questions to establish the
configuration parameters. Text-mode installations are valid only on Linux or Mac
systems.
When the installation begins, the text mode installer welcomes you to the Setup Wizard:
----------------------------------------------------------------
Welcome to the PostgreSQL Setup Wizard.
----------------------------------------------------------------
Please specify the directory where PostgreSQL will be installed.
----------------------------------------------------------------
----------------------------------------------------------------
Select the components you want to install; clear the components
you do not want to install. Click Next when you are ready to
continue.
----------------------------------------------------------------
PostgreSQL Server
pgAdmin 4
Stackbuilder
Command Line Tools
Confirm that your selections are correct by entering Y or pressing Return (to accept the
default).
----------------------------------------------------------------
Please select a directory under which to store your data.
----------------------------------------------------------------
Enter an alternate location, or press Enter to accept the default and continue. The
default location of the data directory is /opt/PostgreSQL/10/data:
----------------------------------------------------------------
Please provide a password for the database superuser (postgres).
A locked Unix user account (postgres) will be created if not
present.
Password :
Retype password :
----------------------------------------------------------------
You must provide a password for the database superuser. The specified password must
conform to any security policies (minimum length, use of special characters, and so on)
in place on the host. After entering a password in the Password field, confirm the
password and press Enter to continue.
----------------------------------------------------------------
Please select the port number the server should listen on.
Port [5432]:
----------------------------------------------------------------
When prompted, enter the Port that the PostgreSQL service will monitor for
connections. By default, PostgreSQL selects the first available port after port 5432.
----------------------------------------------------------------
[715] zh_TW.utf8
[716] zu_ZA
[717] zu_ZA.iso88591
[718] zu_ZA.utf8
Please choose an option [1] :
----------------------------------------------------------------
When prompted, specify a Locale by entering a locale number from the list. Press
Enter to accept the Default locale value and instruct the installer to use the system
locale as the server locale.
When the setup wizard has gathered the information that it needs to perform the
installation, it will prompt you that it is ready to begin installing PostgreSQL:
----------------------------------------------------------------
Setup is now ready to begin installing PostgreSQL on your
computer.
----------------------------------------------------------------
Please wait while Setup installs PostgreSQL on your computer.
Installing
0% ______________ 50% ______________ 100%
#########################################
----------------------------------------------------------------
Setup has finished installing PostgreSQL on your computer.
To specify that the installer should run without user interaction, include the --mode
unattended command line option. In unattended mode, the installer uses one of the
following sources for configuration parameters:
You can embed the non-interactive PostgreSQL installer within another application
installer; during the installation process, a progress bar displays for the user (shown in
Figure 6.1).
Figure 6.1 - Using --mode unattended displays a progress bar to the user.
You must have superuser privileges to install PostgreSQL using the --mode
unattended option on a Linux or Mac system. On a Windows system, administrative
privileges are required. If you are using the --mode unattended option to install
PostgreSQL with another installer, the calling installer must be invoked with superuser or
administrative privileges.
To start the installer in unattended mode, specify the --mode unattended option on
the command line.
On Windows
To start the installer in unattended mode on a Windows system, navigate to the directory
that contains the executable file, and enter:
on some Windows systems, and enforced password policies may not accept the default
password (postgres).
On Linux
To install in unattended mode on a Linux machine, navigate to the directory that contains
the PostgreSQL installer and enter:
The --superpassword option specifies a password for the database superuser. If you
omit the option, the database superuser password defaults to postgres. The default
password can be easily guessed by a potential intruder; be sure to provide a stronger
password with the --superpassword option.
You can control configuration parameters for PostgreSQL by specifying options at the
command line, or by including the parameters in a configuration file. Specify the
parameters within the configuration file in option=value pairs (shown in Figure 6.2).
When you invoke the installer, include the --optionfile parameter, and the complete
path to the configuration parameter file:
# ./postgres-version-platform.run --optionfile
/$HOME/config_param
For more information about the command line options supported during an unattended
installation, see Section 7, Reference - Command Line Options.
--create_shortcuts
--datadir data_directory
Use the --datadir parameter to specify a location for the cluster's data
directory. data_directory is the name of the directory; include the complete
path to the desired directory.
--debuglevel { 0 | 1 | 2 | 3 | 4 }
Use the --debuglevel parameter to set the level of detail written to the
debug_log file (see --debugtrace). Higher values produce more detail (and a
longer trace file). The default is 2.
--debugtrace debug_log
--disable-stackbuilder {yes|no}
--extract-only {yes|no}
--help
--installer-language {en|es|fr}
en (English)
es (Spanish)
fr (French)
--install_plpgsql
--install_runtimes { yes | no }
--locale locale
Specifies the locale for the PostgreSQL cluster. By default, the installer will use
to the locale detected by initdb.
Use the --mode parameter to specify an installation mode. The following modes
are supported:
gtk - Specify gtk to tell the installer to use the GTK graphical toolkit.
xwindow - Specify xwindow tell the installer to use the X Window graphical
toolkit.
--optionfile config_file
Use the --optionfile parameter to specify the name of a file that contains the
installation configuration parameters. config_file must specify the complete
path to the configuration parameter file.
--prefix installation_dir
/opt/PostgreSQL/10
C:\Program Files\PostgreSQL\10
--serverport port_number
If you are installing PostgreSQL in unattended mode, and do not specify a value
using the --serverport parameter, the installer will use port 5432, or the first
available port after port 5432 as the default listener port.
--serviceaccount user_account_name
Use the --serviceaccount parameter to specify the name of the user account
that owns the server process. The default value of --serviceaccount is set to
postgres.
Please note that for security reasons, the --serviceaccount parameter must
specify the name of an account that does not hold administrator privileges.
--servicename service_name
--servicepassword user_password
--superaccount super_user_name
Use the --superaccount parameter to specify the user name of the database
superuser. The default value of --superaccount is set to postgres.
--superpassword superuser_password
--version
8 Uninstalling PostgreSQL
The PostgreSQL installer creates an uninstaller in the PostgreSQL installation directory.
opt/PostgreSQL/10/uninstall-postgresql
The uninstaller will open, asking you if you wish to uninstall the Entire application
or Individual components (see Figure 8.1).
If you wish to remove the Entire application, click Next to continue. If you choose
to remove Individual components, a selection screen opens, allowing you to select
which components you wish to uninstall (see Figure 8.2).
Select the components you wish to uninstall, and click Next to start uninstalling
components (see Figure 8.3).
When the uninstaller finishes, a Warning notifies you that the data directory and
service user account have not been removed (see Figure 8.4).
Figure 8.4 - Confirming database objects that have not been removed.
Click OK to close the Warning; an Info popup informs you that the uninstallation is
complete (see Figure 8.5)
Right click on PostgreSQL 10, and select Uninstall/Change from the context
menu.
If you wish to remove the Entire application, click Next to continue. If you choose
to remove Individual components, a selection screen opens, allowing you to select
which components you wish to uninstall (see Figure 8.7).
Select the components you wish to uninstall, and click Next to start uninstalling
components (see Figure 8.8).
A progress bar will keep you informed as PostgreSQL is removed (see Figure 8.9).
When the uninstaller completes, a Warning notifies you that the data directory and
service user account have not been removed (see Figure 8.10).
Figure 8.10 - A popup confirms that the data directory and service user account have not
been removed from the host system.
When the uninstaller completes, an Info dialog opens to confirm (as shown in Figure
8.11). Click OK to exit.
/Library/PostgreSQL/10
open uninstall-postgres.app
If prompted, provide a password that allows the uninstaller to make changes to your
system. The uninstaller will open, asking you if you wish to uninstall the Entire
application or Individual components (see Figure 8.12).
If you wish to remove the Entire application, click Next to continue. If you choose
to remove Individual components, a selection screen opens, allowing you to select
which components you wish to uninstall (see Figure 8.13).
Select the components you wish to uninstall, and click Next to start uninstalling
components (see Figure 8.14).
When the uninstaller finishes, a Warning notifies you that the data directory and
service user account have not been removed (see Figure 8.15).
Figure 8.15 - Confirming database objects that have not been removed.
Click OK to close the Warning; an Info popup informs you that the uninstallation is
complete (see Figure 8.16)
9 Installation Troubleshooting
--mode unattended Authentication Errors
If you encounter an error during the installation process on a Windows system, exit the
installation, and ensure that your version of Windows is up-to-date. After applying any
outstanding operating system updates, re-invoke the PostgreSQL installer.
If applications fail to launch (such as Stack Builder or your web browser) during the
installation process on a Linux or Unix system, verify that the xdg-open program is on
your system. If xdg-open is missing, install the xdg-utils package.
If you are using the GNOME desktop, load the root profile before running the
PostgreSQL installation script. To load the root profile, issue the command, su - root
instead of su root before installing PostgreSQL.
%TEMP% on Windows
The installation log file is called install-postgresql.log. The logfile may contain
the superuser password specified during the installation, which should be replaced before
sharing the log with anyone.
If you are unable to resolve the problem after reviewing the logfile, please search the
EnterpriseDB forums or your favourite search engine for a solution. If you still cannot
resolve the issue, please post details of the problem, along with system details and any
appropriate parts of the installation logfile to the installer forum.