<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Qasim Tahir</title>
    <description>The latest articles on DEV Community by Qasim Tahir (@qasim_tahir_91).</description>
    <link>https://dev.to/qasim_tahir_91</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1868978%2Ff2991334-d57d-4229-848b-b30337368bc6.png</url>
      <title>DEV Community: Qasim Tahir</title>
      <link>https://dev.to/qasim_tahir_91</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/qasim_tahir_91"/>
    <language>en</language>
    <item>
      <title>How to Create PostgreSQL Custom Builds and RPM Packages</title>
      <dc:creator>Qasim Tahir</dc:creator>
      <pubDate>Thu, 01 Aug 2024 09:14:17 +0000</pubDate>
      <link>https://dev.to/qasim_tahir_91/how-to-create-postgresql-custom-builds-and-rpm-packages-bdj</link>
      <guid>https://dev.to/qasim_tahir_91/how-to-create-postgresql-custom-builds-and-rpm-packages-bdj</guid>
      <description>&lt;p&gt;As a developer, there is sometimes a need to create custom builds of PostgreSQL. This may arise because a developer wants to install specific versions of PostgreSQL RPMs, which can be hard to find among previously released versions. A developer might require a specific version to perform a proof of concept (POC) or to create a development environment compatible with their application. So, I decided to write a blog to explain how to make a custom build for Rocky or RHEL and make RPM packages.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;NOTE:&lt;/strong&gt; I am using Rocky Linux 8 for performing a demo.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
Make sure to install below pre-requisites requirements:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo dnf install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm
sudo dnf install -y docbook-xsl libxslt-devel clang-devel python3-devel perl-generators bison e2fsprogs-devel flex gettext git glibc-devel krb5-devel libicu-devel libselinux-devel libuuid-devel libxml2-devel libxslt-devel clang llvm-devel openldap-devel openssl-devel pam-devel patch perl perl-ExtUtils-MakeMaker perl-ExtUtils-Embed readline-devel rpmdevtools selinux-policy systemd systemd-devel systemtap-sdt-devel tcl-devel vim wget zlib-devel lz4-devel git rpmdevtools rpmlint libcurl-devel curl pgdg-srpm-macros
sudo dnf --enablerepo=devel install perl-IPC-Run -y
sudo dnf group install "Development Tools" -y
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
Clone the PostgreSQL’s rpms repository:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; git clone git://git.postgresql.org/git/pgrpms.git ~/pgrpms
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
Firstly, define the PostgreSQL version you want to create a custom build. For example, if you want to choose 15.5 version of PostgreSQL then define version as below:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;PGMAJVER=15
PGMINVER=5
VERSION="${PGMAJVER}.${PGMINVER}"
CONFIG_FILE="$HOME/pgrpms/rpm/redhat/main/non-common/postgresql-${PGMAJVER}/main/postgresql-${PGMAJVER}.spec"
GLOBAL_FILE="$HOME/pgrpms/rpm/redhat/global/Makefile.global-PG${PGMAJVER}"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
Update the version settings as per your desired version by running below command:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd ~/pgrpms
git checkout $(git log --pretty=format:"%H %s" | grep "Update to ${VERSION}" | awk '{print $1}' | head -n 1)
sed -i '/git pull/s/^/#/' "$GLOBAL_FILE"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
Now navigate to desired version directory
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd ~/pgrpms/rpm/redhat/$PGMAJVER/postgresql-$PGMAJVER/EL-8
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
Now execute the below command to start RPM packages compilation
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;make build$PGMAJVER
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You may face some issues based on what PostgreSQL version you are building and what version of RPM distribution you are using.&lt;/p&gt;

&lt;p&gt;The following list has been generated in the final step. It can be copied to the target machine for installation.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;postgresql$PGMAJVER-$VERSION .rhel8.x86_64.rpm
postgresql$PGMAJVER-server-$VERSION .rhel8.x86_64.rpm
postgresql$PGMAJVER-contrib-$VERSION .rhel8.x86_64.rpm
postgresql$PGMAJVER-plperl-$VERSION .rhel8.x86_64.rpm
postgresql$PGMAJVER-plpython3-$VERSION .rhel8.x86_64.rpm
postgresql$PGMAJVER-libs-$VERSION .rhel8.x86_64.rpm
postgresql$PGMAJVER-llvmjit-$VERSION .rhel8.x86_64.rpm
postgresql$PGMAJVER-devel-$VERSION .rhel8.x86_64.rpm
postgresql$PGMAJVER-test-$VERSION .rhel8.x86_64.rpm
postgresql$PGMAJVER-pltcl-$VERSION .rhel8.x86_64.rpm
postgresql$PGMAJVER-docs-$VERSION .rhel8.x86_64.rpm
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Conclusion:&lt;/strong&gt;&lt;br&gt;
Many people hold the misconception that a custom build is challenging, but it simply requires a bit of structured effort.&lt;br&gt;
&lt;strong&gt;AgensSQL by Bitnine Global Inc.&lt;/strong&gt; offers enhanced database features compared to the standard PostgreSQL database, providing stability and up-to-date functionalities to meet modern enterprise requirements. &lt;/p&gt;

</description>
      <category>opensource</category>
      <category>database</category>
      <category>postgressql</category>
      <category>linux</category>
    </item>
  </channel>
</rss>
