|
| 1 | +# Install Percona Distribiution for PostgreSQL from binary tarballs |
| 2 | + |
| 3 | +You can find the binary tarballs on the [Percona website](https://www.percona.com/downloads). Select the desired version from a version dropdown and _All_ from the Select Platform dropdown. |
| 4 | + |
| 5 | +There are the following tarballs available: |
| 6 | + |
| 7 | +* percona-postgresql-{{dockertag}}-ssl1.1-linux-x86_64.tar.gz - for operating systems that run OpenSSL version 1.x |
| 8 | +* percona-postgresql-{{dockertag}}-ssl3-linux-x86_64.tar.gz - for for operating systems that run OpenSSL version 3.x |
| 9 | + |
| 10 | +To check what OpenSSL version you have, run the following command: |
| 11 | + |
| 12 | +```{.bash data-prompt="$"} |
| 13 | +$ openssl version |
| 14 | +``` |
| 15 | + |
| 16 | +## Tarball contents |
| 17 | + |
| 18 | +The tarballs include the following components: |
| 19 | + |
| 20 | +| Component | Description | |
| 21 | +|-----------|-------------| |
| 22 | +| percona-postgresql{{pgversion}}| The latest version of PostgreSQL server and the following extensions: <br> - `pgaudit` <br> - `pgAudit_set_user` <br> - `pg_repack` <br> - `pg_stat_monitor` <br> - `pg_gather` <br> - `wal2json` <br> - the set of [contrib extensions](contrib.md)| |
| 23 | +| percona-haproxy | A high-availability solution and load-balancing solution | |
| 24 | +| percona-patroni | A high-availability solution for PostgreSQL | |
| 25 | +| percona-pgbackrest| A backup and restore tool | |
| 26 | +| percona-pgbadger| PostgreSQL log analyzer with fully detailed reports and graphs | |
| 27 | +| percona-pgbouncer| Lightweight connection pooler for PostgreSQL | |
| 28 | +| percona-pgpool-II| A middleware between PostgreSQL server and client for high availability, connection pooling and load balancing | |
| 29 | +| percona-perl | A Perl module required to create the `plperl` extension - a procedural language handler for PostgreSQL that allows writing functions in the Perl programming language| |
| 30 | +| percona-python3 | A Python3 module required to create `plpython` extension - a procedural language handler for PostgreSQL that allows writing functions in the Python programming language. Python is also required by Patroni |
| 31 | +| percona-tcl | Tcl development libraries required to create the `pltcl` extension - a loadable procedural language for the PostgreSQL database system that enables the creation of functions and trigger procedures in the Tcl language | |
| 32 | +| percona-etcd | A key-value distributed store that stores the state of the PostgreSQL cluster| |
| 33 | + |
| 34 | +## Preconditions |
| 35 | + |
| 36 | +=== "Debian and Ubuntu" |
| 37 | + |
| 38 | + 1. Uninstall the upstream PostgreSQL package. |
| 39 | + 2. Create the user to own the PostgreSQL process. For example, `mypguser`. Run the following command: |
| 40 | + |
| 41 | + ```{.bash data-prompt="$"} |
| 42 | + $ sudo useradd -m mypguser |
| 43 | + ``` |
| 44 | + |
| 45 | + Set the password for the user: |
| 46 | + |
| 47 | + ```{.bash data-prompt="$"} |
| 48 | + $ sudo passwd mypguser |
| 49 | + ``` |
| 50 | + |
| 51 | +=== "RHEL and derivatives" |
| 52 | + |
| 53 | + Create the user to own the PostgreSQL process. For example, `mypguser`, Run the following command: |
| 54 | + |
| 55 | + ```{.bash data-prompt="$"} |
| 56 | + $ sudo useradd mypguser -m |
| 57 | + ``` |
| 58 | + |
| 59 | + Set the password for the user: |
| 60 | + |
| 61 | + ```{.bash data-prompt="$"} |
| 62 | + $ sudo passwd mypguser |
| 63 | + ``` |
| 64 | + |
| 65 | +## Procedure |
| 66 | + |
| 67 | +The steps below install the tarballs for OpenSSL 3.x. Use another tarball if your operating system has OpenSSL version 1.x. |
| 68 | + |
| 69 | +1. Create the directory where you will store the binaries. For example, `/opt/pgdistro` |
| 70 | + |
| 71 | +2. Grant access to this directory for the `mypguser` user. |
| 72 | + |
| 73 | + ```{.bash data-prompt="$"} |
| 74 | + $ sudo chown mypguser:mypguser /opt/pgdistro/ |
| 75 | + ``` |
| 76 | + |
| 77 | +3. Fetch the binary tarball: |
| 78 | + |
| 79 | + ```{.bash data-prompt="$"} |
| 80 | + $ wget https://downloads.percona.com/downloads/postgresql-distribution-16/{{dockertag}}/binary/tarball/percona-postgresql-{{dockertag}}-ssl3-linux-x86_64.tar.gz |
| 81 | + ``` |
| 82 | + |
| 83 | +4. Extract the tarball to the directory for binaries that you created on step 1. |
| 84 | + |
| 85 | + ```{.bash data-prompt="$"} |
| 86 | + $ sudo tar -xfv percona-postgresql-{{dockertag}}-ssl3-linux-x86_64.tar.gz -C /opt/pgdistro/ |
| 87 | + ``` |
| 88 | + |
| 89 | +5. If you extracted the tarball in a directory other than `/opt`, copy `percona-python3`, `percona-tcl` and `percona-perl` to the `/opt` directory. This is required for the correct run of libraries that require those modules. |
| 90 | + |
| 91 | + ```{.bash data-prompt="$"} |
| 92 | + $ sudo cp <path_to>/percona-perl <path_to>/percona-python3 <path_to>/percona-tcl /opt/ |
| 93 | + ``` |
| 94 | + |
| 95 | +6. Add the location of the binaries to the PATH variable: |
| 96 | + |
| 97 | + ```{.bash data-prompt="$"} |
| 98 | + $ export PATH=:/opt/pgdistro/percona-haproxy/sbin/:/opt/pgdistro/percona-patroni/bin/:/opt/pgdistro/percona-pgbackrest/bin/:/opt/pgdistro/percona-pgbadger/:/opt/pgdistro/percona-pgbouncer/bin/:/opt/pgdistro/percona-pgpool-II/bin/:/opt/pgdistro/percona-postgresql{{pgversion}}/bin/:/opt/pgdistro/percona-etcd/bin/:/opt/percona-perl/bin/:/opt/percona-tcl/bin/:/opt/percona-python3/bin/:$PATH |
| 99 | + ``` |
| 100 | + |
| 101 | +6. Create the data directory for PostgreSQL server. For example, `/usr/local/pgsql/data`. |
| 102 | +7. Grant access to this directory for the `mypguser` user. |
| 103 | + |
| 104 | + ```{.bash data-prompt="$"} |
| 105 | + $ sudo chown mypguser:mypguser /usr/local/pgsql/data |
| 106 | + ``` |
| 107 | + |
| 108 | +8. Switch to the user that owns the Postgres process. In our example, `mypguser`: |
| 109 | + |
| 110 | + ```{.bash data-prompt="$"} |
| 111 | + $ su - mypguser |
| 112 | + ``` |
| 113 | + |
| 114 | +9. Initiate the PostgreSQL data directory: |
| 115 | + |
| 116 | + ```{.bash data-prompt="$"} |
| 117 | + $ /opt/pgdistro/percona-postgresql{{pgversion}}/bin/initdb -D /usr/local/pgsql/data |
| 118 | + ``` |
| 119 | + |
| 120 | + |
| 121 | + ??? example "Sample output" |
| 122 | + |
| 123 | + ```{.text .no-copy} |
| 124 | + Success. You can now start the database server using: |
| 125 | +
|
| 126 | + /opt/pgdistro/percona-postgresql{{pgversion}}/bin/pg_ctl -D /usr/local/pgsql/data -l logfile start |
| 127 | + ``` |
| 128 | + |
| 129 | +10. Start the PostgreSQL server: |
| 130 | + |
| 131 | + ```{.bash data-prompt="$"} |
| 132 | + $ /opt/pgdistro/percona-postgresql{{pgversion}}/bin/pg_ctl -D /usr/local/pgsql/data -l logfile start |
| 133 | + ``` |
| 134 | + |
| 135 | + ??? example "Sample output" |
| 136 | + |
| 137 | + ```{.text .no-copy} |
| 138 | + waiting for server to start.... done |
| 139 | + server started |
| 140 | + ``` |
| 141 | + |
| 142 | +9. Connect to `psql` |
| 143 | + |
| 144 | + ```{.bash data-prompt="$"} |
| 145 | + $ /opt/pgdistro/percona-postgresql{{pgversion}}/bin/psql |
| 146 | + ``` |
| 147 | + |
| 148 | + ??? example "Sample output" |
| 149 | + |
| 150 | + ```{.text .no-copy} |
| 151 | + psql ({{dockertag}}) |
| 152 | + Type "help" for help. |
| 153 | +
|
| 154 | + postgres=# |
| 155 | + ``` |
| 156 | + |
| 157 | +### Start the components |
| 158 | + |
| 159 | +After you unpacked the tarball and added the location of the components' binaries to the $PATH variable, the components are available for use. You can invoke a component by running its command-line tool. For example, to check HAProxy version, type: |
| 160 | +
|
| 161 | +```{.bash data-prompt="$"} |
| 162 | +$ haproxy version |
| 163 | +``` |
| 164 | +
|
| 165 | +Some components require additional setup. Check the [Enabling extensions](enable-extensions.md) page for details. |
0 commit comments