如果需要要修改Ceph源码,就要自己构建安装包,然后指定ceph-deploy的安装源。 本文主要介绍从git上clone源码,然后用rpmbuild打包,最后用ceph-deploy安装。 环境为Centos6.5,ceph版本v0.94.5(hammer)。

Ceph RPM打包

官方的RPM打包教程http://ceph.com/docs/master/install/build-ceph/。 如果只是尝试打包的话,这个教程基本够了,下面主要讲从git源码开始。

1. git(recursive会把子模块一起克隆)

git clone --recursive https://github.com/ceph/ceph.git
cd ceph
git checkout v0.94.5 -f

2. 安装打包依赖

./install-deps.sh
yum install rpm-build rpmdevtools

3. 准备rpmbuild目录

rpmdev-setuptree

4. 配置编译

./autogen.sh
./configure
./make_dist 0.94.5
cp ceph-0.94.5.tar.bz2 ~/rpmbuild/SOURCES/
cp rpm/init-ceph.in-fedora.patch ~/rpmbuild/SOURCES/
cp ceph.spec.in ~/rpmbuild/SPECS/ceph.spec

5. 开始build,编译完成会在~/rpmbuild/RPMS/x86_64目录下生成打包文件

rpmbuild -ba ~/rpmbuild/SPECS/ceph.spec

经过漫长的等待,终于打包完成:

[root@xiexianbin_cn x86_64]# pwd
/root/rpmbuild/RPMS/x86_64
[root@xiexianbin_cn x86_64]# ll -al
total 722452
drwxr-xr-x 2 root root      4096 Dec 15 03:36 .
drwxr-xr-x 3 root root      4096 Dec 15 02:33 ..
-rw-r--r-- 1 root root  22108972 Dec 15 02:34 ceph-0.94.5-hammer.el6.x86_64.rpm
-rw-r--r-- 1 root root   7179016 Dec 15 02:34 ceph-common-0.94.5-hammer.el6.x86_64.rpm
-rw-r--r-- 1 root root 652570952 Dec 15 03:37 ceph-debuginfo-0.94.5-hammer.el6.x86_64.rpm
-rw-r--r-- 1 root root      2184 Dec 15 02:37 ceph-devel-compat-0.94.5-hammer.el6.x86_64.rpm
-rw-r--r-- 1 root root     20852 Dec 15 02:37 cephfs-java-0.94.5-hammer.el6.x86_64.rpm
-rw-r--r-- 1 root root   1791916 Dec 15 02:34 ceph-fuse-0.94.5-hammer.el6.x86_64.rpm
-rw-r--r-- 1 root root      2116 Dec 15 02:37 ceph-libs-compat-0.94.5-hammer.el6.x86_64.rpm
-rw-r--r-- 1 root root   2454180 Dec 15 02:34 ceph-radosgw-0.94.5-hammer.el6.x86_64.rpm
-rw-r--r-- 1 root root  45571524 Dec 15 02:37 ceph-test-0.94.5-hammer.el6.x86_64.rpm
-rw-r--r-- 1 root root   1966220 Dec 15 02:34 libcephfs1-0.94.5-hammer.el6.x86_64.rpm
-rw-r--r-- 1 root root     12732 Dec 15 02:34 libcephfs1-devel-0.94.5-hammer.el6.x86_64.rpm
-rw-r--r-- 1 root root     31328 Dec 15 02:37 libcephfs_jni1-0.94.5-hammer.el6.x86_64.rpm
-rw-r--r-- 1 root root      2524 Dec 15 02:37 libcephfs_jni1-devel-0.94.5-hammer.el6.x86_64.rpm
-rw-r--r-- 1 root root   1707528 Dec 15 02:34 librados2-0.94.5-hammer.el6.x86_64.rpm
-rw-r--r-- 1 root root     36516 Dec 15 02:34 librados2-devel-0.94.5-hammer.el6.x86_64.rpm
-rw-r--r-- 1 root root   1840540 Dec 15 02:34 libradosstriper1-0.94.5-hammer.el6.x86_64.rpm
-rw-r--r-- 1 root root      7996 Dec 15 02:34 libradosstriper1-devel-0.94.5-hammer.el6.x86_64.rpm
-rw-r--r-- 1 root root   1853420 Dec 15 02:34 librbd1-0.94.5-hammer.el6.x86_64.rpm
-rw-r--r-- 1 root root      9576 Dec 15 02:34 librbd1-devel-0.94.5-hammer.el6.x86_64.rpm
-rw-r--r-- 1 root root      2032 Dec 15 02:37 python-ceph-compat-0.94.5-hammer.el6.x86_64.rpm
-rw-r--r-- 1 root root      9748 Dec 15 02:34 python-cephfs-0.94.5-hammer.el6.x86_64.rpm
-rw-r--r-- 1 root root     28248 Dec 15 02:34 python-rados-0.94.5-hammer.el6.x86_64.rpm
-rw-r--r-- 1 root root     17616 Dec 15 02:34 python-rbd-0.94.5-hammer.el6.x86_64.rpm
-rw-r--r-- 1 root root     11172 Dec 15 02:34 rbd-fuse-0.94.5-hammer.el6.x86_64.rpm
-rw-r--r-- 1 root root    489452 Dec 15 02:34 rest-bench-0.94.5-hammer.el6.x86_64.rpm
[root@xiexianbin_cn x86_64]# 

注意,编译大概需要近15G存储空间

完毕。