Kylin v10 编译安装ceph 15.2.17

1. 环境:

ceph:octopus(15.2.17)

OS:Kylin-Server-V10_U1-Release-Build02-20210824-GFB-x86_64


2. 基础环境准备

2.1 配置软件源

vim /etc/yum.repos.d/kylin_x86_64.repo

###Kylin Linux Advanced Server 10 - os repo###

[ks10-adv-cdrom]
name = Kylin Linux Advanced Server 10 - cdrom
baseurl = http://archive2.kylinos.cn/rpm/kylin/production/KY10-GFB-amd64/custom/kylin-server/KY10-GFB-amd64/
gpgcheck = 0
enabled = 1

2.1 安装依赖包

安装编译依赖环境和编译工具

yum install make python-devel openssl-devel graphviz autoconf automake rpm-build libtool
yum install CUnit-devel boost-random cmake expat-devel fuse-devel gperf libaio-devel libbabeltrace-devel libblkid-devel libcap-ng-devel libcurl-devel libibverbs-devel libnl3-devel librabbitmq-devel librdkafka-devel librdmacm-devel libxml2-devel lttng-ust-devel lz4-devel ncurses-devel nss-devel openldap-devel python3-Cython python3-devel python3-prettytable python3-sphinx  snappy-devel valgrind-devel xfsprogs-devel xmlstarlet yasm systemd-devel leveldb-devel spax at time mailx ed sendmail util-linux-user cups-client gperftools-devel gperftools-libs nasm  lua-devel libicu-devel gperftools-devel cryptsetup-devel

下载安装额外依赖(https://download.csdn.net/download/nanhai_happy/88218750?spm=1001.2014.3001.5503)如下:

wget https://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/l/liboath-2.6.2-1.el7.x86_64.rpm
wget https://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/l/liboath-devel-2.6.2-1.el7.x86_64.rpm
wget http://mirror.centos.org/centos/7/os/x86_64/Packages/redhat-lsb-core-4.1-27.el7.centos.1.x86_64.rpm
wget http://mirror.centos.org/centos/7/os/x86_64/Packages/redhat-lsb-submod-security-4.1-27.el7.centos.1.x86_64.rpm

安装

rpm -ivh liboath-2.6.2-1.el7.x86_64.rpm
rpm -ivh liboath-devel-2.6.2-1.el7.x86_64.rpm
rpm -ivh redhat-lsb-submod-security-4.1-27.el7.centos.1.x86_64.rpm
rpm -ivh redhat-lsb-core-4.1-27.el7.centos.1.x86_64.rpm

2.2 安装gcc 8.3.1

挂载Kylin-Server-V10_U1-Release-Build02-20210824-GFB-x86_64.iso,默认挂载路径为/run/media/root/KYLIN10-SVR/,在 Packages-gcc路径下有8.3.11的包,执行安装如下:

cd /run/media/root/KYLIN10-SVR/Packages-gcc
yum install gmp-devel libmpc-devel mpfr-devel isl
rpm -ivh *.rpm --force

3. 编译安装ceph

3.1 下载ceph 15.2.17

访问ceph网站https://download.ceph.com/tarballs/,找到对应的版本,下载

wget https://download.ceph.com/tarballs/ceph-15.2.17.tar.gz

3.2 创建rpmbuild环境

创建rpmbuild目录

cd ~
mkdir rpmbuild/{BUILD,SOURCES,SPECS,RPMS,BUILDROOT} -pv

3.3 解压ceph软件包

mv ceph-15.2.17.tar.gz /root/rpmbuild/SOURCES
cd /root/rpmbuild/SOURCES
tar -xvf ceph-15.2.17.tar.gz

3.4 修改ceph.spec文件

进入源码目录,修改ceph.spec,将Source0 定义的包名改成tar.gz格式的,本例中下载的为tar.gz的包,故需要修改相应的

vim ceph.spec

Summary:        User space components of the Ceph file system
License:        LGPL-2.1 and LGPL-3.0 and CC-BY-SA-3.0 and GPL-2.0 and BSL-1.0 and BSD-3-Clause and MIT
%if 0%{?suse_version}
Group:          System/Filesystems
%endif
URL:            http://ceph.com/
Source0:        %{?_remote_tarball_prefix}ceph-15.2.17.tar.bz2

更改为

Summary:        User space components of the Ceph file system
License:        LGPL-2.1 and LGPL-3.0 and CC-BY-SA-3.0 and GPL-2.0 and BSL-1.0 and BSD-3-Clause and MIT
%if 0%{?suse_version}
Group:          System/Filesystems
%endif
URL:            http://ceph.com/
Source0:        %{?_remote_tarball_prefix}ceph-15.2.17.tar.gz

将redhat-rpm-config更改为kylin-rpm-config

%if 0%{?fedora} || 0%{?rhel}
BuildRequires:  redhat-rpm-config
%endif

更改为

%if 0%{?fedora} || 0%{?rhel}
BuildRequires:  kylin-rpm-config
%endif

3.5 修改宏定义

在/usr/lib/rpm/macros文件中有一个定义:

%_unpackaged_files_terminate_build 1,把1改为0只警告

3.6 python版本修改

把系统默认的python版本修改为为3.7.4,如下

ln -sf /usr/bin/python3.7 /usr/bin/python

3.7 编译

编译执行如下命令:

rpmbuild -ba --target=$(uname -m) ceph.spec
  • -ba 编译后做成.rpm和src.rpm(还原成刚下载的NAME-VERSION.SRC.RPM包格式)
  • -bb 编译后做成.rpm
  • -bp 只执行spec的%pre 段(解开源码包并打补丁,即只做准备)

注意:编译的机器配置高一些,不然编译比较缓慢,存储空间要求100GB以上

3.8 安装

编译完成后进行安装,如下

yum -y remove librados2 librbd1
yum -y install librabbitmq librdkafka resource-agents jq socat xmlstarlet leveldb
yum -y install python2-zope-event python3-pyyaml  python3-zope-event python3-prettytable python3-bcrypt python3-pecan python3-werkzeug python3-pyOpenSSL python3-more-itertools python3-zipp

rpm -ivh ext-deps/liboath-2.6.2-1.el7.x86_64.rpm
rpm -ivh x86_64/python3-zope-interface-4.6.0-1.ky10.ky10.x86_64.rpm
rpm -ivh noarch/python3-*.rpm
rpm -ivh noarch/ceph-mgr-modules-core-15.2.17-0.ky10.ky10.noarch.rpm
chmod 600 /var/log/tallylog
rpm -ivh noarch/cephadm-15.2.17-0.ky10.ky10.noarch.rpm

rpm -ivh x86_64/lib*.rpm
rpm -ivh x86_64/python*.rpm --force
rpm -ivh x86_64/ceph-*.rpm
rpm -ivh x86_64/rbd-*.rpm
rpm -ivh x86_64/rados-objclass-devel-15.2.17-0.ky10.ky10.x86_64.rpm

软件包链接如下:

链接:https://pan.baidu.com/s/1SKZg5eNZ2XqX0Zky_eCBtA?pwd=icyv 
提取码:icyv 
--来自百度网盘超级会员V5的分享

或者通过该地址下载 kylin v10 ceph 15.2.17 x86_64 rpm


4. 问题记录:

4.1 CMake Error at cmake/modules/BuildBoost.cmake

执行rpmbuild的时候出现如下错误:

-- Found Curses: /usr/lib64/libncurses.so
-- Found nl: /usr/lib64/libnl-3.so
-- Checking for module 'libcap-ng'
--   Found libcap-ng, version 0.7.10
-- Setting civetweb to use OPENSSL >= 1.1
-- Found RabbitMQ: /usr/include
-- Checking for one of the modules 'rdkafka'
-- Found RDKafka: /usr/include (found suitable version "0.11.4", minimum required is "0.9.2")
-- exclude following files under src: *.js;*.css;civetweb;erasure-code/jerasure/jerasure;erasure-code/jerasure/gf-complete;rocksdb;googletest;spdk;xxHash;isa-l;lua;zstd;crypto/isa-l/isa-l_crypto;blkin;rapidjson;dmclock;seastar;fmt;c-ares;spawn;pybind/mgr/rook/rook-client-python
-- Configuring done
CMake Error at cmake/modules/BuildBoost.cmake:278 (_add_executable):
  Target "ceph-mon" links to target "StdFilesystem::filesystem" but the
  target was not found.  Perhaps a find_package() call is missing for an
  IMPORTED target, or an ALIAS target is missing?
Call Stack (most recent call first):
  src/CMakeLists.txt:526 (add_executable)


CMake Error at cmake/modules/BuildBoost.cmake:278 (_add_executable):
  Target "ceph-mon" links to target "StdFilesystem::filesystem" but the
  target was not found.  Perhaps a find_package() call is missing for an
  IMPORTED target, or an ALIAS target is missing?
Call Stack (most recent call first):
  src/CMakeLists.txt:526 (add_executable)
	 

......


CMake Error at cmake/modules/BuildBoost.cmake:270 (_add_library):
  Target "rgw_a" links to target "StdFilesystem::filesystem" but the target
  was not found.  Perhaps a find_package() call is missing for an IMPORTED
  target, or an ALIAS target is missing?
Call Stack (most recent call first):
  src/rgw/CMakeLists.txt:218 (add_library)


CMake Error at cmake/modules/BuildBoost.cmake:270 (_add_library):
  Target "rgw" links to target "StdFilesystem::filesystem" but the target was
  not found.  Perhaps a find_package() call is missing for an IMPORTED
  target, or an ALIAS target is missing?
Call Stack (most recent call first):
  src/rgw/CMakeLists.txt:369 (add_library)


CMake Error at cmake/modules/BuildBoost.cmake:278 (_add_executable):
  Target "ceph_rgw_jsonparser" links to target "StdFilesystem::filesystem"
  but the target was not found.  Perhaps a find_package() call is missing for
  an IMPORTED target, or an ALIAS target is missing?
Call Stack (most recent call first):
  src/rgw/CMakeLists.txt:402 (add_executable)


CMake Error at cmake/modules/BuildBoost.cmake:278 (_add_executable):
  Target "ceph_rgw_multiparser" links to target "StdFilesystem::filesystem"
  but the target was not found.  Perhaps a find_package() call is missing for
  an IMPORTED target, or an ALIAS target is missing?
Call Stack (most recent call first):
  src/rgw/CMakeLists.txt:408 (add_executable)


-- Generating done
-- Build files have been written to: /root/rpmbuild/BUILD/ceph-15.2.17/build
错误:/var/tmp/rpm-tmp.0Le2Ek (%build) 退出状态不好

后来发现gcc未升级到8.3.1导致的,将gcc进行升级后解决该问题


5. 参考文献:

https://www.cnblogs.com/yzbhfdz/p/15791759.html

https://download.ceph.com/tarballs/

https://developer.aliyun.com/article/477157

https://blog.51cto.com/xiexiaojun/1884429

https://www.cnblogs.com/jing99/p/9672295.html

https://bediverezero.github.io/utinity/2020/10/21/rpmbuild-acceleration.html

相关推荐
一名路过的小码农2 天前
ceph 18.2.4二次开发,docker镜像制作
ceph·docker·容器
墨水\\5 天前
分布式----Ceph应用(下)
分布式·ceph
大G哥6 天前
基于K8S1.28.2实验rook部署ceph
java·ceph·云原生·容器·kubernetes
石兴稳7 天前
Ceph PG(归置组)的状态说明
ceph
石兴稳7 天前
Ceph层次架构分析
ceph
活老鬼7 天前
Ceph分布式存储
linux·运维·服务器·分布式·ceph
石兴稳9 天前
Ceph client 写入osd 数据的两种方式librbd 和kernel rbd
linux·ceph
石兴稳9 天前
Ceph的pool有两种类型
ceph
运维小文9 天前
ceph的集群管理
ceph·对象存储·存储·ceph集群管理·ceph节点管理
石兴稳10 天前
iSCSI 和SCSI的概述
ceph