Compiling the Ceph Installation Package
After integrating the plugin into the source code, you need to compile and generate a new Ceph installation package, which involves procedures such as configuring the compilation environment, modifying related files, and performing compilation. Compile the package on the compilation server.
Prerequisites
During compilation, intermediate compilation results and target files are stored in the /home directory. It is recommended that the available capacity of the /home directory be greater than or equal to 100 GB.
Configuring a Local Repository
- Download the liboath source code and patch.
1 2 3
yum install git -y git config --global http.sslVerify false git clone https://gitee.com/src-openeuler/oath-toolkit.git
- Install the dependencies required for RPM packaging using a Yum source.
1yum install wget rpmdevtools gtk-doc pam-devel xmlsec1-devel libtool libtool-ltdl-devel createrepo cmake -y
- Create an rpmbuild directory. Move the patch file and source package to the /root/rpmbuild/SOURCES directory.
1 2 3 4 5
rpmdev-setuptree cd oath-toolkit mv 0001-oath-toolkit-2.6.5-lockfile.patch /root/rpmbuild/SOURCES mv oath-toolkit-2.6.5.tar.gz /root/rpmbuild/SOURCES cp oath-toolkit.spec /root/rpmbuild/SPECS/
- Compile the RPM package.
1rpmbuild -bb /root/rpmbuild/SPECS/oath-toolkit.spec
- Use the compiled RPM package as the local Yum repository.
1 2 3
mkdir -p /home/oath cp -r /root/rpmbuild/RPMS/* /home/oath/ cd /home/oath && createrepo .
- Configure the REPO file.
- Create a local.repo file.
1vi /etc/yum.repos.d/local.repo - Press i to enter the insert mode and add the following content to the file:
1 2 3 4 5 6
[local-oath] name=local-oath baseurl=file:///home/oath enabled=1 gpgcheck=0 priority=1
- Press Esc to exit the insert mode. Type :wq! and press Enter to save and exit the file.
- Create a local.repo file.
- Set the Yum certificate verification status to be verification-free.
- Open the yum.conf file.
1vim /etc/yum.conf - Press i to enter the insert mode and add the following content to the end of the file:
1 2
sslverify=false deltarpm=0
- Press Esc to exit the insert mode. Type :wq! and press Enter to save and exit the file.
- Open the yum.conf file.
- Configure pip to download from Huawei Mirrors to accelerate the download.
- Create a .pip directory and then create a pip.conf file in the directory.
1 2
mkdir -p ~/.pip vim ~/.pip/pip.conf
- Press i to enter the insert mode and add the following content:
1 2 3 4
[global] timeout = 120 index-url = https://repo.huaweicloud.com/repository/pypi/simple trusted-host = repo.huaweicloud.com
- Press Esc to exit the insert mode. Type :wq! and press Enter to save and exit the file.
- Create a .pip directory and then create a pip.conf file in the directory.
Installing Dependencies
- Configure the EPEL repository.
- Create an epel.repo file.
1vim /etc/yum.repos.d/epel.repo - Press i to enter the insert mode and add the following content:
1 2 3 4 5 6
[epel] name=epel baseurl=https://repo.huaweicloud.com/epel/7/aarch64/ enabled=1 gpgcheck=0 priority=1
- Press Esc to exit the insert mode. Type :wq! and press Enter to save and exit the file.
- Create an epel.repo file.
- Use the EPEL repository to install the dependencies that are missing in openEuler.
1yum install python-routes python-tox -y
- Delete the EPEL repository.
1rm -rf /etc/yum.repos.d/epel.repo
The EPEL repository is used only for installing the two dependencies in 2. After using the EPEL repository, you must delete it. Otherwise, RPM packages that conflict with openEuler will be downloaded from the EPEL repository in subsequent steps.
- Download the openEuler repository from Huawei Mirrors.
1wget -O /etc/yum.repos.d/openEulerOS.repo https://repo.huaweicloud.com/repository/conf/openeuler_aarch64.repo
- Install the dependencies required for compiling Ceph source code on the server.
1yum install java-devel sharutils checkpolicy selinux-policy-devel gperf cryptsetup fuse-devel gperftools-devel libaio-devel libblkid-devel libcurl-devel libudev-devel libxml2-devel libuuid-devel ncurses-devel python-devel valgrind-devel xfsprogs-devel xmlstarlet yasm nss-devel libibverbs-devel openldap-devel CUnit-devel python2-Cython python3-setuptools python-prettytable lttng-ust-devel expat-devel junit boost-random keyutils-libs-devel openssl-devel libcap-ng-devel python-sphinx python2-sphinx python3-sphinx leveldb leveldb-devel snappy snappy-devel lz4 lz4-devel liboath liboath-devel libbabeltrace-devel librabbitmq librabbitmq-devel librdkafka librdkafka-devel libnl3 libnl3-devel rdma-core-devel numactl numactl-devel numactl-libs createrepo openldap-devel rdma-core-devel lz4-devel expat-devel lttng-ust-devel libbabeltrace-devel python3-Cython python2-Cython gperftools-devel bc dnf-plugins-core librabbitmq-devel rpm-build java-1.8.0-openjdk-devel -y
Compiling and Generating RPM Packages
- Modify the install-deps.sh script.
- Open the script.
1 2
cd /home/ceph-14.2.8/ vi install-deps.sh
- Press i to enter the insert mode and add openEuler to line 321 in the file.
centos|fedora|rhel|ol|virtuozzo|openEuler)
- Press Esc to exit the insert mode. Type :wq! and press Enter to save and exit the file.
- Open the script.
- Run install-deps.sh to install the dependency.
1sh install-deps.sh - Modify the ceph.spec.in file.
1sed -i 's#%if 0%{?fedora} || 0%{?rhel}#%if 0%{?fedora} || 0%{?rhel} || 0%{?openEuler}#' ceph.spec.in
- Go back to the parent directory and compress the ceph-14.2.8 directory into a tar.bz2 package.
1 2
cd /home tar -cjvf ceph-14.2.8.tar.bz2 ceph-14.2.8
- Modify the rpmmacros file.
- Open the file.
1vi /root/.rpmmacros - Press i to enter the insert mode, change the %_topdir path to /home/rpmbuild, and comment out the following four lines of code:
1 2 3 4 5 6
%_topdir /home/rpmbuild #%__arch_install_post \ # [ "%{buildarch}" = "noarch" ] || QA_CHECK_RPATHS=1 ; \ # case "${QA_CHECK_RPATHS:-}" in [1yY]*) /usr/lib/rpm/check-rpaths ;; esac \ # /usr/lib/rpm/check-buildroot
- Press Esc to exit the insert mode. Type :wq! and press Enter to save and exit the file.
- Run the rpmbuild installation command again.
1rpmdev-setuptree
- Open the file.
- Copy the ceph.spec file to the SPECS directory.
1cp ceph-14.2.8/ceph.spec /home/rpmbuild/SPECS/
- Save the package file generated in 4 to the SOURCES directory.
1cp ceph-14.2.8.tar.bz2 /home/rpmbuild/SOURCES/
- Delete /etc/profile.d/performance.sh to accelerate the compilation.
1rm -rf /etc/profile.d/performance.sh
- Start a new terminal for the action in 8 to take effect and run the rpmbuild command to start the compilation.
1 2
unset GOMP_CPU_AFFINITY rpmbuild -bb /home/rpmbuild/SPECS/ceph.spec
The compilation takes more than half an hour. After the compilation is complete, the aarch64 and noarch directories are generated in the /home/rpmbuild/RPMS/ directory. The directories include the RPM packages required for Ceph cluster deployment.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
[root@localhost RPMS]# ls aarch64 noarch [root@localhost RPMS]# ls * aarch64: ceph-14.2.8-0.aarch64.rpm Librbd-devel-14.2.8-0.aarch64.rpm ceph-base-14.2.8-0.aarch64.rpm librgw2-14.2.8.0.aarch64.rpm ceph-common-14.2.8-0.aarch64.rpm librgw-devel-14.2.8-0.aarch64.rpm ceph-debuginfo-14.2.8-0.aarch64.rpm python3-ceph-argparse-14.2.8-0.aarch64.rpm ceph-debugsource-14.2.8-0.aarch64.rpm python3-cephfs-14.2.8-0.aarch64.rpm ceph-fuse-14.2.8-0.aarch64.rpm python3-rados-14.2.8-0.aarch64.rpm ceph-nds-14.2.8-0.aarch64.rpm python3-rbd-14.2.8-0.aarch64.rpm ceph-mgr-14.2.8-0.aarch64.rpm python3-rgw-14.2.8-0.aarch64.rpm ceph-mon-14.2.8-0.aarch64.rpm python-ceph-argparse-14.2.8-0.aarch64.rpm ceph-osd-14.2.8-0.aarch64.rpm python-ceph-compat-14.2.8-0.aarch64.rpm ceph-radosgw-14.2.8-0.aarch64.rpm python-cephfs-14.2.8-0.aarch64.rpm ceph-test-14.2.8-0.aarch64.rpm python-rados-14.2.8-0.aarch64.rpm Libcephfs2-14.2.8-0.aarch64.rpm python-rbd-14.2.8-0.aarch64.rpm Libcephfs-devel-14.2.8-0.aarch64.rpm python-rgw-14.2.8-0.aarch64.rpm Librados2-14.2.8-0.aarch64.rpm rados-objclass-devel-14.2.8-0.aarch64.rpm librados-devel-14.2.8-0.aarch64.rpm rbd-fuse-14.2.8-0.aarch64.rpm libradospp-devel-14.2.8-0.aarch64.rpm rbd-mirror-14.2.8-0.aarch64.rpm librbd1-14.2.8-0.aarch64.rpm rbd-nbd-14.2.8-0.aarch64.rpm noarch: ceph-grafana-dashboards-14.2.8-0.noarch.rpm ceph-mgr-k8sevents-14.2.8-0.noarch.rpm ceph-mgr-dashboard-14.2.8-0.noarch.rpm ceph-mgr-rook-14.2.8-0.noarch.rpm ceph-mgr-diskprediction-cloud-14.2.8-0.noarch.rpm ceph-mgr-ssh-14.2.8-0.noarch.rpm ceph-mgr-diskprediction-local-14.2.8-0.noarch.rpm
- Pack the compiled RPM package.
1 2
cd /home/rpmbuild/RPMS tar -zcvf ceph-ksal-rpm.tar.gz aarch64/ noarch/