Skip to content

Building CTA

Check out the CERN Tape Archive Repository

The build should be performed on CentOS7.

Clone the CTA git repository

sudo yum -y install git
git clone https://gitlab.cern.ch/cta/CTA.git

Go to the CTA folder and init the submodules:

cd CTA
git submodule update --init --recursive

Setup Oracle Instant Client repository

CTA requires the standard Oracle instantclient devel RPM in order to be built, and the instanclient basic RPM in order to run. Install Oracle repo file with the following commands:

sudo yum -y install wget
sudo wget https://public-yum.oracle.com/RPM-GPG-KEY-oracle-ol7 -O /etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
sudo tee /etc/yum.repos.d/oracle-instant-client.repo > /dev/null << 'EOF'
[oracle-instant-client]
name=Oracle instant client
baseurl=https://yum.oracle.com/repo/OracleLinux/OL7/oracle/instantclient/x86_64/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=1
EOF

You should not install instant client RPMs. They will be installed by yum-builddep command automatically.

Configure yum repos, priorities and versions

sudo yum-config-manager --add-repo=./continuousintegration/docker/ctafrontend/cc7/etc/yum.repos.d/centos-cernonly.repo
sudo yum-config-manager --add-repo=./continuousintegration/docker/ctafrontend/cc7/etc/yum.repos.d/cta-ci.repo
sudo yum-config-manager --add-repo=./continuousintegration/docker/ctafrontend/cc7/etc/yum.repos.d/eos-quarkdb.repo
sudo yum install -y yum-plugin-priorities
sudo cp ./continuousintegration/docker/ctafrontend/cc7/etc/yum/pluginconf.d/versionlock.list  /etc/yum/pluginconf.d/versionlock.list

Create cta dependencies RPMs

Some specific rpm are necessary to build them follow this script:

cd ~
git clone https://gitlab.cern.ch/cta/cta-dependencies.git
cd cta-dependencies
sudo yum install -y centos-release-scl cmake3 rpm-build llvm5.0
sudo yum install -y devtoolset-8 systemd-rpm-macros zlib-devel
sudo yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
sudo yum install -y postgresql14-devel
cp -r /usr/pgsql-14/include/* /usr/include/
cp -r /usr/pgsql-14/lib/* /usr/lib64
source /opt/rh/devtoolset-8/enable
sudo mkdir -p /root/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
sudo make

Create source rpm

If the correct version of the required CTA RPMs is not available, they can be built from source as described in this section.

First, build the source RPM of the CTA project by running cmake against the CTA sources that were installed in Section [install_cta_get_cta_repo]:

cd ~
mkdir CTA_build
cd CTA_build
cmake3 -DPackageOnly:Bool=true ../CTA
make cta_srpm
Install build deps

sudo yum-builddep -y ./RPM/SRPMS/cta-0-1.src.rpm

Build binaries

Delete the contents of the CTA_build directory, then re-run cmake to prepare to build the complete CTA project (not just the source RPMs):

cd ..
rm -rf CTA_build/
mkdir CTA_build
cd CTA_build
cmake3 ../CTA

Build CTA by running make:

make -j 4

Once the build is completed you can run the unit tests to verify everything worked :

./tests/cta-unitTests

Build packages

Build the CTA RPMs:

make cta_rpm

Install

First it's needed to copy the external repository for oracle-instanclient-19.3-basic in /etc/yum.repos.d/:

[oracle-instant-client]
name=Oracle instant client
baseurl=https://yum.oracle.com/repo/OracleLinux/OL7/oracle/instantclient/x86_64/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=1
priority=1

or running this command:

yum-config-manager --add-repo https://yum.oracle.com/repo/OracleLinux/OL7/oracle/instantclient/x86_64/

Install the CTA RPMs:

yum -y install RPM/RPMS/x86_64/cta-*

The cta-migration-tools package needs some CERN-specific dependencies and can be omitted.