Introduction
In this blog we will be installing citus on postgresql. You can follow the official documentation but if you have complied postgresql through its source code this tutorial can help you install citus on it easily.
Step 1: Installing PostgreSQL
Before installing citus we need a compatible version of postgresql. For this purpose we will install postgresql 15 from source code.
Creating directories to install postgresql
mkdir citus_installation
cd citus_installation
mkdir pg
cd pg
Installing dependencies for postgreSQL
sudo apt-get install build-essential libreadline-dev zlib1g-dev flex bison
Downloading and unpacking PostgreSQL 15
wget https://ftp.postgresql.org/pub/source/v15.3/postgresql-15.3.tar.gz && tar -xvf postgresql-15.3.tar.gz && rm -f postgresql-15.3.tar.gz
Installation
Next, we will proceed with the installation of "pg". The "--prefix" option specifies the directory path where we want to install "psql". In this instance, we will be installing it in the current directory using "pwd".
cd postgresql-15.3
# configure by setting flags
./configure --enable-debug --enable-cassert --prefix=$(pwd) CFLAGS="-ggdb -Og -fno-omit-frame-pointer"
# now install
make install
# go back
cd ../../
Step 2: Installing Citus
Now we will install citus on our PostgreSQL. This is a rather easy and smooth process.
Dependencies:
Before installing citus you need to install all the build dependecies for citus
sudo apt-get install -y postgresql-server-dev-15 postgresql-15 \
autoconf flex git libcurl4-gnutls-dev
libicu-dev \
libkrb5-dev liblz4-dev libpam0g-dev libreadline-dev \
libselinux1-dev libssl-dev libxslt1-dev libzstd-dev \
make uuid-dev
Downloading Citus
After that you can clone the citus repo
git clone https://github.com/citusdata/citus.git
cd citus
Configuration And Installation
Then run the following commands to configure and install
PG_CONFIG=/home/yourusername/citus_installation/pg/postgresql-15.3/bin/pg_config ./configure
make
sudo make install
Setup in PostgreSQL
Then to add Citus to your local PostgreSQL database, add the following to postgresql.conf:
shared_preload_libraries = 'citus'
Conclusion:
Now you have successfully installed citus with a source code compiled postgreSQL. Have fun enjoying the power of scaling databases and using realtime analytics with PostgreSQL.
Top comments (0)