参考:https://my.oschina.net/linuxhunter/blog/682013
一、克隆ceph源码:git clone https://github.com/ceph/ceph.git
完成后进入ceph源码目录 cd ceph。
二、克隆ceph源码的子模块,否则编译的时候会报错。
git submodule update --force --init --recursive
三、选择ceph的版本,执行如下命令
git tag #查看ceph源码的tag
git show v10.2.3 #查看ceph v10.2.3 tag 的详细信息。
git checkout ecc23778e #切换到tag v10.2.3分支
四、进入ceph源码目录,依次执行如下命令
./install-deps.sh #安装ceph需要的依赖文件
./autogen.sh #产生ceph的configure配置文件
./configure --prefix=/usr --libexecdir=/usr/lib --sysconfdir=/etc --with-radosgw --with-rados --with-rbd --with-cephfs --with-nss --without-libcryptopp #产生Makefile文件
make -j48 #用48核编译
make install #安装ceph
五、出现的问题
执行ceph -v时提示
Traceback (most recent call last):
File "/usr/bin/ceph", line 118, in <module>
import rados
ImportError: No module named rados
用find /* -name 'rados*' 发现在/usr/lib/python2.7/site-packages/下有 rados.so 和rados-0-py2.7.egg-info两个文件
拷贝这两个文件到/usr/lib/python2.7/dist-packages/下。
问题解决。