Compile and Install Apache Cloudberry on Rocky Linux 8 and Ubuntu
The source of this document is from the GitHub repository apache/cloudberry
.
This document shares how to compile and install Apache Cloudberry on Rocky Linux 8, RHEL 8, and Ubuntu. Note that this document is for developers to try out Apache Cloudberry in a single-node environments. DO NOT use this document for production environments.
To learn how to compile and install Apache Cloudberry on Rocky Linux 9, see Compile on Rocky Linux 9.
Take the following steps to compile and install Apache Cloudberry:
- Clone GitHub repo.
- Install dependencies.
- Perform prerequisite platform tasks.
- Build Apache Cloudberry.
- Verify the cluster.
Step 1. Clone GitHub repo
Clone the GitHub repository apache/cloudberry
to the target machine:
git clone https://github.com/apache/cloudberry.git
Step 2. Install dependencies
Enter the repository and install dependencies according to your operating systems:
- For RHEL 8 and Rocky Linux 8
- For Ubuntu 18.04 or later
-
Install Development Tools.
sudo yum group install -y "Development Tools"
-
Install dependencies:
sudo yum install -y epel-release
sudo yum install -y apr-devel bison bzip2-devel cmake3 flex gcc gcc-c++ krb5-devel libcurl-devel libevent-devel libkadm5 libxml2-devel libzstd-devel openssl-devel perl-ExtUtils-Embed python3-devel python3-pip readline-devel xerces-c-devel zlib-devel -
Install more dependencies by running the
README.Rhel-Rocky.bash
script.cd ~/cloudberry/deploy/build/
./README.Rhel-Rocky.bash
-
Install dependencies by running the
README.Ubuntu.bash
script in thedeploy/build
directory.## You need to enter your password to run.
sudo ~/cloudberry/deploy/build/README.Ubuntu.bashinfo- When you run the
README.Ubuntu.bash
script for dependencies, you will be asked to configurerealm
for Kerberos. You can enter any realm, because this is just for testing, and during testing, it will reconfigure a local server/client. If you want to skip this manual configuration, runexport DEBIAN_FRONTEND=noninteractive
. - If the script fails to download packages, we recommend that you can try another one software source for Ubuntu.
- When you run the
-
Install GCC 10. Ubuntu 18.04 and later versions should use GCC 10 or newer:
## Install gcc-10
sudo apt install software-properties-common
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt install gcc-10 g++-10
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 100
Step 3. Perform prerequisite platform tasks
After you have installed all the dependencies for your operating system, it is time to do some prerequisite platform tasks before you go on building Apache Cloudberry. These operation include manually running ldconfig
on all platforms, creating the gpadmin
user, and setting up a password to start the Apache Cloudberry and test.
-
Make sure that you add
/usr/local/lib
and/usr/local/lib64
to the/etc/ld.so.conf
file.echo -e "/usr/local/lib \n/usr/local/lib64" >> /etc/ld.so.conf
ldconfig -
Create the
gpadmin
user and set up the SSH key. Manually create SSH keys based on different operating systems, so that you can runssh localhost
without a password.- For Rocky Linux 8 and RHEL 8
- For Ubuntu
useradd gpadmin # Creates gpadmin user
su - gpadmin # Uses the gpadmin user
ssh-keygen # Creates SSH key
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keys
exituseradd -r -m -s /bin/bash gpadmin # Creates gpadmin user
su - gpadmin # Uses the gpadmin user
ssh-keygen # Creates SSH key
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keys
exit
Step 4. Build Apache Cloudberry
After you have installed all the dependencies and performed the prerequisite platform tasks, you can start to build Apache Cloudberry. Run the following commands in sequence.
-
Configure the build environment. Enter the
cloudberry
directory and run theconfigure
script.cd ../..
./configure --with-perl --with-python --with-libxml --with-gssapi --prefix=/usr/local/cloudberrydbinfoApache Cloudberry is built with GPORCA by default. If you want to build CBDB without GPORCA, add the
--disable-orca
flag in the./configure
command../configure --disable-orca --with-perl --with-python --with-libxml --prefix=/usr/local/cloudberry
-
Compile the code and install the database.
make -j8
make -j8 install -
Bring in the Greenplum environment variables for your running shell.
cd ..
cp -r cloudberry/ /home/gpadmin/
cd /home/gpadmin/
chown -R gpadmin:gpadmin cloudberry/
su - gpadmin
cd cloudberry/
source /usr/local/cloudberry/greenplum_path.sh -
Start the demo cluster.
- For Ubuntu, Rocky Linux 8, and RHEL 8
make create-demo-cluster
-
Prepare the test by running the following command. This command will configure the port and environment variables for the test.
Environment variables such as
PGPORT
andCOORDINATOR_DATA_DIRECTORY
will be configured, which are the default port and the data directory of the coordinator node.source gpAux/gpdemo/gpdemo-env.sh
Step 5. Verify the cluster
-
You can verify whether the cluster has started successfully by running the following command. If successful, you might see multiple active
postgres
processes with ports ranging from7000
to7007
.ps -ef | grep postgres
-
Connect to the Apache Cloudberry and see the active segment information by querying the system table
gp_segement_configuration
. For detailed description of this table, see the Greenplum document here.psql -p 7000 postgres
psql (14.4, server 14.4)
Type "help" for help.SELECT VERSION();
version
-------------------------------------------------------------------------------------
PostgreSQL 14.4 (Apache Cloudberry 1.6.0+dev.1383.g5cdbab19af build dev) on x86_64-pc-li
nux-gnu, compiled by gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-23), 64-bit compiled on Feb
26 2025 18:20:10
(1 row)SELECT * FROM gp_segment_configuration;
dbid | content | role | preferred_role | mode | status | port | hostname | address | datadir | warehouseid
------+---------+------+----------------+------+--------+------+------------+------------+------------------------------------------------------------------------------+-------------
1 | -1 | p | p | n | u | 7000 | i-6wvpa9wt | i-6wvpa9wt | /home/gpadmin/cloudberry/gpAux/gpdemo/datadirs/qddir/demoDataDir-1 | 0
8 | -1 | m | m | s | u | 7001 | i-6wvpa9wt | i-6wvpa9wt | /home/gpadmin/cloudberry/gpAux/gpdemo/datadirs/standby | 0
3 | 1 | p | p | s | u | 7003 | i-6wvpa9wt | i-6wvpa9wt | /home/gpadmin/cloudberry/gpAux/gpdemo/datadirs/dbfast2/demoDataDir1 | 0
6 | 1 | m | m | s | u | 7006 | i-6wvpa9wt | i-6wvpa9wt | /home/gpadmin/cloudberry/gpAux/gpdemo/datadirs/dbfast_mirror2/demoDataDir1 | 0
2 | 0 | p | p | s | u | 7002 | i-6wvpa9wt | i-6wvpa9wt | /home/gpadmin/cloudberry/gpAux/gpdemo/datadirs/dbfast1/demoDataDir0 | 0
5 | 0 | m | m | s | u | 7005 | i-6wvpa9wt | i-6wvpa9wt | /home/gpadmin/cloudberry/gpAux/gpdemo/datadirs/dbfast_mirror1/demoDataDir0 | 0
4 | 2 | p | p | s | u | 7004 | i-6wvpa9wt | i-6wvpa9wt | /home/gpadmin/cloudberry/gpAux/gpdemo/datadirs/dbfast3/demoDataDir2 | 0
7 | 2 | m | m | s | u | 7007 | i-6wvpa9wt | i-6wvpa9wt | /home/gpadmin/cloudberry/gpAux/gpdemo/datadirs/dbfast_mirror3/demoDataDir2 | 0
(8 rows)