在银河麒麟V10下编译ceph 15.2.13
python源码下载地址
CEPH源码包下载地址
提示:编译机器务必内存大一点,16GB以上,磁盘空间留足一点!!!
1、创建rpmbuild目录
cd ~
mkdir rpmbuild/{BUILD,SOURCES,SPECS,RPMS,BUILDROOT} -pv
2、下载ceph源码,拷贝到/root/rpmbuild/SOURCES中
3、解压源码包(主要是拿源码包中的spec文件)
tar -xvf ceph-15.2.13.tar.gz
4、安装编译依赖环境和编译工具
yum install make python-devel openssl-devel graphviz autoconf automake rpm-build libtool
5、手动安装gcc 8.3.1,银河麒麟V10 ISO包的Packages-gcc下有8.3.11的包,拷贝到系统中,使用rpm -Uvh *.rpm安装,提示缺少依赖,yum install 解决依赖
6、进入源码目录,修改ceph.spec,将Source0 定义的包名改成tar.gz格式的,本例中下载的为tar.gz的包,故需要修改相应的
.......
%if 0%{?suse_version}
Group: System/Filesystems
%endif
URL: http://ceph.com/
Source0: http://ceph.com/download/ceph-15.2.13.tar.gz
.......
7、安装相关依赖
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
8、手动安装kylin10缺失的包,用el8的包替代
liboath-2.6.2-3.el8.aarch64.rpm
liboath-devel-2.6.2-3.el8.aarch64.rpm
redhat-lsb-submod-security-4.1-47.el8.aarch64.rpm
redhat-lsb-core-4.1-47.el8.aarch64.rpm
9、其中redhat-rpm-config,银河麒麟下是kylin-rpm-config,rpm -qa | grep rpm-config查询一下,如果没有的话yum install kylin-rpm-config一个
然后修改ceph.spec,注释掉BuildRequires: redhat-rpm-config
......
#hardened-cc1
%if 0%{?fedora} || 0%{?rhel}
# BuildRequires: redhat-rpm-config
%endif
......
10、修改系统默认的python版本为3.7.4
11、在/usr/lib/rpm/macros文件中有一个定义:
%_unpackaged_files_terminate_build 1,把1改为0只警告
12、最后使用rpmbuild -ba --target=$(uname -m) ceph.spec 进行编译
特别提醒:建议对swap扩容一下。使用free -m 查看swap大小,如果只有4或者8G的,建议扩容一下。否则编译到一半会因为无法分配内存报错
# 在/swap下创建swapfile文件,不要在/tmp下创建swapfile
mkdir -p /swap
dd if=/dev/zero of=/swap/swapfile bs=1M count=16384
# 格式化swap
mkswap /swap/swapfile
# 挂载swap
swapon /swap/swapfile