1<sect1 id="installation-source" xreflabel="Installing from source code"> 2 3 <title>Installing &repmgr; from source</title> 4 5 <indexterm> 6 <primary>installation</primary> 7 <secondary>from source</secondary> 8 </indexterm> 9 10 <sect2 id="installation-source-prereqs"> 11 <title>Prerequisites for installing from source</title> 12 <para> 13 To install &repmgr; the prerequisites for compiling 14 &postgres; must be installed. These are described in &postgres;'s 15 documentation 16 on <ulink url="https://www.postgresql.org/docs/current/install-requirements.html">build requirements</ulink> 17 and <ulink url="https://www.postgresql.org/docs/current/docguide-toolsets.html">build requirements for documentation</ulink>. 18 </para> 19 20 <para> 21 Most mainstream Linux distributions and other UNIX variants provide simple 22 ways to install the prerequisites from packages. 23 <itemizedlist spacing="compact" mark="bullet"> 24 <listitem> 25 <para> 26 <literal>Debian</literal> and <literal>Ubuntu</literal>: First 27 add the <ulink url="https://apt.postgresql.org/">apt.postgresql.org</ulink> 28 repository to your <filename>sources.list</filename> if you 29 have not already done so, and ensure the source repository is enabled. 30 </para> 31 <tip> 32 <para> 33 If not configured, the source repository can be added by including 34 a <literal>deb-src</literal> line as a copy of the existing <literal>deb</literal> 35 line in the repository file, which is usually 36 <filename>/etc/apt/sources.list.d/pgdg.list</filename>, e.g.: 37 <programlisting> 38deb https://apt.postgresql.org/pub/repos/apt/ stretch-pgdg main 39deb-src https://apt.postgresql.org/pub/repos/apt/ stretch-pgdg main</programlisting> 40 </para> 41 </tip> 42 <para> 43 Then install the prerequisites for 44 building PostgreSQL with e.g.: 45 <programlisting> 46 sudo apt-get update 47 sudo apt-get build-dep postgresql-9.6</programlisting> 48 </para> 49 50 <important> 51 <simpara> 52 Select the appropriate PostgreSQL version for your target repmgr version. 53 </simpara> 54 </important> 55 56 <note> 57 <para> 58 If using <command>apt-get build-dep</command> is not possible, the 59 following packages may need to be installed manually: 60 61 <itemizedlist spacing="compact" mark="bullet"> 62 63 <listitem> 64 <simpara><literal>flex</literal></simpara> 65 </listitem> 66 <listitem> 67 <simpara><literal>libedit-dev</literal></simpara> 68 </listitem> 69 <listitem> 70 <simpara><literal>libkrb5-dev</literal></simpara> 71 </listitem> 72 <listitem> 73 <simpara><literal>libpam0g-dev</literal></simpara> 74 </listitem> 75 <listitem> 76 <simpara><literal>libreadline-dev</literal></simpara> 77 </listitem> 78 <listitem> 79 <simpara><literal>libselinux1-dev</literal></simpara> 80 </listitem> 81 <listitem> 82 <simpara><literal>libssl-dev</literal></simpara> 83 </listitem> 84 <listitem> 85 <simpara><literal>libxml2-dev</literal></simpara> 86 </listitem> 87 <listitem> 88 <simpara><literal>libxslt1-dev</literal></simpara> 89 </listitem> 90 </itemizedlist> 91 </para> 92 </note> 93 94 </listitem> 95 <listitem> 96 <para> 97 <literal>RHEL or CentOS 6.x or 7.x</literal>: install the appropriate repository RPM 98 for your system from <ulink url="https://yum.postgresql.org/repopackages.php"> 99 yum.postgresql.org</ulink>. Then install the prerequisites for building 100 PostgreSQL with: 101 <programlisting> 102 sudo yum check-update 103 sudo yum groupinstall "Development Tools" 104 sudo yum install yum-utils openjade docbook-dtds docbook-style-dsssl docbook-style-xsl 105 sudo yum-builddep postgresql96</programlisting> 106 </para> 107 108 <important> 109 <simpara> 110 Select the appropriate PostgreSQL version for your target repmgr version. 111 </simpara> 112 </important> 113 <note> 114 <para> 115 If using <command>yum-builddep</command> is not possible, the 116 following packages may need to be installed manually: 117 118 <itemizedlist spacing="compact" mark="bullet"> 119 120 <listitem> 121 <simpara><literal>flex</literal></simpara> 122 </listitem> 123 <listitem> 124 <simpara><literal>libselinux-devel</literal></simpara> 125 </listitem> 126 <listitem> 127 <simpara><literal>libxml2-devel</literal></simpara> 128 </listitem> 129 <listitem> 130 <simpara><literal>libxslt-devel</literal></simpara> 131 </listitem> 132 <listitem> 133 <simpara><literal>openssl-devel</literal></simpara> 134 </listitem> 135 <listitem> 136 <simpara><literal>pam-devel</literal></simpara> 137 </listitem> 138 <listitem> 139 <simpara><literal>readline-devel</literal></simpara> 140 </listitem> 141 142 </itemizedlist> 143 </para> 144 </note> 145 146 <tip> 147 <para> 148 If building against PostgreSQL 11 or later configured with the <option>--with-llvm</option> option 149 (this is the case with the PGDG-provided packages) you'll also need to install the 150 <literal>llvm-toolset-7-clang</literal> package. This is available via the 151 <ulink url="https://wiki.centos.org/AdditionalResources/Repositories/SCL">Software Collections (SCL) Repository</ulink>. 152 </para> 153 </tip> 154 155 </listitem> 156 </itemizedlist> 157 </para> 158 159 </sect2> 160 161 162<sect2 id="installation-get-source"> 163 <title>Getting &repmgr; source code</title> 164 165 <para> 166 There are two ways to get the &repmgr; source code: with git, or by downloading tarballs of released versions. 167 </para> 168 169 <sect3> 170 <title>Using <application>git</application> to get the &repmgr; sources</title> 171 172 <para> 173 Use <application><ulink url="https://git-scm.com">git</ulink></application> if you expect 174 to update often, you want to keep track of development or if you want to contribute 175 changes to &repmgr;. There is no reason <emphasis>not</emphasis> to use <application>git</application> 176 if you're familiar with it. 177 </para> 178 179 <para> 180 The source for &repmgr; is maintained at 181 <ulink url="https://github.com/2ndQuadrant/repmgr">https://github.com/2ndQuadrant/repmgr</ulink>. 182 </para> 183 184 <para> 185 There are also tags for each <ulink url="https://github.com/2ndQuadrant/repmgr/releases">&repmgr; release</ulink>, e.g. 186 <literal><ulink url="https://github.com/2ndQuadrant/repmgr/releases/tag/v4.4.0">v4.4.0</ulink></literal>. 187 </para> 188 189 <para> 190 Clone the source code using <application>git</application>: 191 <programlisting> 192 git clone https://github.com/2ndQuadrant/repmgr</programlisting> 193 </para> 194 195 <para> 196 For more information on using <application>git</application> see 197 <ulink url="https://git-scm.com/">git-scm.com</ulink>. 198 </para> 199 200 </sect3> 201 202 <sect3> 203 <title>Downloading release source tarballs</title> 204 205 <para> 206 Official release source code is uploaded as tarballs to the 207 &repmgr; website along with a tarball checksum and a matching GnuPG 208 signature. See 209 <ulink url="http://repmgr.org/">http://repmgr.org/</ulink> 210 for the download information. See <xref linkend="appendix-signatures"/> 211 for information on verifying digital signatures. 212 </para> 213 214 <para> 215 You will need to download the repmgr source, e.g. <filename>repmgr-4.0.tar.gz</filename>. 216 You may optionally verify the package checksums from the 217 <literal>.md5</literal> files and/or verify the GnuPG signatures 218 per <xref linkend="appendix-signatures"/>. 219 </para> 220 221 <para> 222 After you unpack the source code archives using <command>tar xf</command> 223 the installation process is the same as if you were installing from a git 224 clone. 225 </para> 226 227 </sect3> 228 229 </sect2> 230 231 <sect2 id="installation-repmgr-source"> 232 <title>Installation of &repmgr; from source</title> 233 <para> 234 To installing &repmgr; from source, simply execute: 235 236 <programlisting> 237 ./configure && make install</programlisting> 238 239 Ensure <command>pg_config</command> for the target PostgreSQL version is in 240 <varname>$PATH</varname>. 241 </para> 242 </sect2> 243 244 245 246 <sect2 id="installation-build-repmgr-docs" xreflabel="Building repmgr documentation"> 247 <title>Building &repmgr; documentation</title> 248 <para> 249 The &repmgr; documentation is (like the main PostgreSQL project) 250 written in DocBook XML format. To build it locally as HTML, you'll need to 251 install the required packages as described in the 252 <ulink url="https://www.postgresql.org/docs/current/docguide-toolsets.html">PostgreSQL documentation</ulink>. 253 </para> 254 <para> 255 The minimum PostgreSQL version for building the &repmgr; documentation is 256 PostgreSQL 9.5. 257 </para> 258 259 <note> 260 <simpara> 261 In &repmgr; 4.3 and earlier, the documentation can only be built against 262 PostgreSQL 9.6 or earlier. 263 </simpara> 264 </note> 265 266 <para> 267 To build the documentation as HTML, execute: 268 <programlisting> 269 ./configure && make doc</programlisting> 270 </para> 271 <para> 272 The generated HTML files will be placed in the <filename>doc/html</filename> 273 subdirectory of your source tree. 274 </para> 275 276 <para> 277 To build the documentation as a single HTML file, after configuring and building 278 the main &repmgr; source as described above, execute: 279 <programlisting> 280 ./configure && make doc-repmgr.html</programlisting> 281 </para> 282 283 <para> 284 To build the documentation as a PDF file, after configuring and building 285 the main &repmgr; source as described above, execute: 286 <programlisting> 287 ./configure && make doc-repmgr-A4.pdf</programlisting> 288 </para> 289 290 291 </sect2> 292 293</sect1> 294