构建ceph deb 安装包

前言
本文基于ubuntu 14.04.5 LTS 和ceph v0.94.3 之上做的实验

一、编译ceph包
1.1.克隆ceph代码,切换分支

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

备注:recursive会把子模块一起克隆

1.2.安装依赖包

./install-deps.sh
./autogen.sh

1.3.编译前配置

./configure --prefix=/

注意:这里如果不配置--prefix选项,所有程序默认安装在/usr/local下面,在后面可能会涉及到路径的问题

1.4.编译

make -j 4

通过如下命令确定总核数

cat /proc/cpuinfo | grep cores

1.5.构建 Ceph deb安装包

apt-get install debhelper
dpkg-buildpackage -j8 2>err0813dpkg.txt

1.6.编译完毕后,会有以下包存在

构建ceph deb 安装包

二、制作deb包本地安装源

2.1.安装dpkg-scanpackages命令

apt-get install dpkg-dev

2.2 创建ceph软件包目录

mkdir /home/ceph-hammer
cd /home/ceph-hammer
mkdir pools
mkdir -p dists/trusty/main/binary-i386
mkdir -p dists/trusty/main/binary-amd64

备注:pools 为软件包存放的物理地址

2.3 拷贝ceph软件包到pools

cp *.deb /home/ceph-hammer/pools

2.4 生成override 文件

把pools目录下所有的deb包包名写入文件override中

ls -1 pools | sed 's/_.*$/ extra BOGUS/' | uniq > override

2.5生成Packages

把所有包的包名、版本号、依赖关系等信息写入文件Packages中

dpkg-scanpackages pools override > dists/trusty/main/binary-i386/Packages
dpkg-scanpackages pools override > dists/trusty/main/binary-amd64/Packages

备注:etch版本中要把Packages文件变成Packages.gz文件

2.6 更改sources.list

echo "deb file:///home/ceph-hammer trusty main " >> /etc/apt/sources.list

注意:由于ceph-deploy1.5 默认会连接网络下载最新的版本,所以在这边的配置,似乎不太起作用。

2.7 本地安装源目录结构
创建完本地安装源后,目录结构如下所示:
构建ceph deb 安装包
2.8设置完成,更新deb源
完成以上设置和文件复制之后,就可以开始正常使用本地的源了和使用网络上的源一样操作。

apt-get update
apt-get dist-upgrade

 

三、安装ceph
3.1 安装前准备
关闭ubuntu的packages 认证功能,否则会报The following packages cannot be authenticated!

echo "APT::Get::AllowUnauthenticated 1 ;" | sudo tee -a /etc/apt/apt.conf

3.2.安装并更改ceph-deploy

1.在ceph01安装ceph-deploy

apt-get install ceph-deploy

2. 修改install.py文件

在通过ceph-deploy安装ceph节点时(即ceph-deploy install monitor),会调用ceph-deploy的install.py,而此时会使用该脚本连接网络下载deb包,由于使用本地源,故需修改 install.py中deb包下载的路径。
install.py位置:/usr/lib/python2.7/dist-packages/ceph_deploy/hosts/debian/install.py
修改如下:
修改前

---------------------------
32 if version_kind == 'stable':
33 url = 'http://ceph.com/debian-{version}/'.format(
34 version=version,
35 )
36 elif version_kind == 'testing':
37 url = 'http://ceph.com/debian-testing/'
---------------------------

修改后:

---------------------------
32 if version_kind == 'stable':
33 # url = 'http://ceph.com/debian-{version}/'.format(
34 url = 'file:///home/ceph-{version}/'.format(
35 version=version,
36 )
37 elif version_kind == 'testing':
38 url = 'http://ceph.com/debian-testing/'
---------------------------

3.3 安装ceph

见ceph官方文档

四、所遇问题
问题1:
执行ceph-deploy install ceph01 报以下错误:
[ceph01][DEBUG ] The following packages have unmet dependencies:
[ceph01][DEBUG ] ceph : Depends: liblttng-ust0 (>= 2.5.1-1ubuntu2~cloud0) but 2.4.0-4ubuntu1 is to be installed
[ceph01][DEBUG ] Depends: librados2 but it is not going to be installed
[ceph01][DEBUG ] ceph-common : Depends: librbd1 (= 0.94.7-1) but it is not going to be installed
[ceph01][DEBUG ] Depends: librados2 but it is not going to be installed
[ceph01][DEBUG ] Depends: python-rados (= 0.94.7-1) but it is not going to be installed
[ceph01][DEBUG ] Depends: python-rbd (= 0.94.7-1) but it is not going to be installed
[ceph01][DEBUG ] ceph-mds : Depends: librados2 but it is not going to be installed

原因及解决过程:
执行 apt-get install librados2报
librados2 : Depends: liblttng-ust0 (>= 2.5.1-1ubuntu2~cloud0) but 2.4.0-4ubuntu1 is to be installed
E: Unable to correct problems, you have held broken packages.
用apt-cache show liblttng-ust0 查看发现环境中安装的版本是2.4.0-4ubuntu1,而librados2需要安装2.5.1-1ubuntu2的版本,因此报错。
解决下载:
1.下载liblttng-ust0_2.5.1-1ubuntu2_amd64.deb
liblttng-ust-ctl2_2.5.1-1ubuntu2_amd64.deb和
liburcu2_0.8.4-6ubuntu1_amd64.deb
三个deb包
(下载地址:
liblttng-ust0_2.5.1-1ubuntu2_amd64.deb
liblttng-ust-ctl2_2.5.1-1ubuntu2_amd64.deb
https://mirror.umd.edu/ubuntu/pool/main/u/ust/
liburcu2_0.8.4-6ubuntu1_amd64.deb
https://launchpad.net/ubuntu/vivid/amd64/liburcu2/0.8.4-6ubuntu1
放入deb包本地安装源目录。

执行

dpkg-scanpackages ceph_source /dev/null |gzip > ceph_source/Packages.gz

更新Packages.gz包

问题2:
ceph-deploy安装我自己编译的deb包,报错WARNING: The following packages cannot be authenticated!
解决方案:
关闭ubuntu的packages 认证功能:

echo "APT::Get::AllowUnauthenticated 1 ;" | sudo tee -a /etc/apt/apt.conf

参考资料:
1.Debian Linux操作系统下本地源的安装方法
http://soft.zdnet.com.cn/software_zone/2007/1006/536773.shtml
2. CentOS6.5 本地源搭建Ceph
http://www.cnblogs.com/linprogram/p/5482513.html

 

上一篇:Linux中Redis的安装


下一篇:org.apache.poi 读取数字问题