Fix some bugs when testing opensds ansible
[stor4nfv.git] / src / ceph / doc / install / build-ceph.rst
1 ============
2  Build Ceph
3 ============
4
5 You can get Ceph software by retrieving Ceph source code and building it yourself.
6 To build Ceph, you need to set up a development environment, compile Ceph, 
7 and then either install in user space or build packages and install the packages. 
8
9 Build Prerequisites
10 ===================
11
12
13 .. tip:: Check this section to see if there are specific prerequisites for your 
14    Linux/Unix distribution.
15
16 Before you can build Ceph source code, you need to install several libraries
17 and tools::
18
19         ./install-deps.sh
20
21 .. note:: Some distributions that support Google's memory profiler tool may use
22    a different package name (e.g., ``libgoogle-perftools4``).
23
24 Build Ceph
25 ==========
26
27 Ceph is built using cmake. To build Ceph, navigate to your cloned Ceph
28 repository and execute the following::
29
30     cd ceph
31     ./do_cmake.sh
32     cd build
33     make
34
35 .. topic:: Hyperthreading
36
37         You can use ``make -j`` to execute multiple jobs depending upon your system. For 
38         example, ``make -j4`` for a dual core processor may build faster.
39
40 See `Installing a Build`_ to install a build in user space.
41
42 Build Ceph Packages
43 ===================
44
45 To build packages, you must clone the `Ceph`_ repository. You can create 
46 installation packages from the latest code using ``dpkg-buildpackage`` for 
47 Debian/Ubuntu or ``rpmbuild`` for the RPM Package Manager.
48
49 .. tip:: When building on a multi-core CPU, use the ``-j`` and the number of 
50    cores * 2. For example, use ``-j4`` for a dual-core processor to accelerate 
51    the build.
52
53
54 Advanced Package Tool (APT)
55 ---------------------------
56
57 To create ``.deb`` packages for Debian/Ubuntu, ensure that you have cloned the 
58 `Ceph`_ repository, installed the `Build Prerequisites`_ and installed 
59 ``debhelper``::
60
61         sudo apt-get install debhelper
62
63 Once you have installed debhelper, you can build the packages::
64
65         sudo dpkg-buildpackage
66
67 For multi-processor CPUs use the ``-j`` option to accelerate the build.
68
69
70 RPM Package Manager
71 -------------------
72
73 To create ``.rpm`` packages, ensure that you have cloned the `Ceph`_ repository,
74 installed the `Build Prerequisites`_ and installed ``rpm-build`` and 
75 ``rpmdevtools``::
76
77         yum install rpm-build rpmdevtools
78
79 Once you have installed the tools, setup an RPM compilation environment::
80
81         rpmdev-setuptree
82
83 Fetch the source tarball for the RPM compilation environment::
84
85         wget -P ~/rpmbuild/SOURCES/ http://ceph.com/download/ceph-<version>.tar.bz2
86
87 Or from the EU mirror::
88
89         wget -P ~/rpmbuild/SOURCES/ http://eu.ceph.com/download/ceph-<version>.tar.bz2
90
91 Extract the specfile::
92
93     tar --strip-components=1 -C ~/rpmbuild/SPECS/ --no-anchored -xvjf ~/rpmbuild/SOURCES/ceph-<version>.tar.bz2 "ceph.spec"
94
95 Build the RPM packages::
96
97         rpmbuild -ba ~/rpmbuild/SPECS/ceph.spec
98
99 For multi-processor CPUs use the ``-j`` option to accelerate the build.
100
101 .. _Ceph: ../clone-source
102 .. _Installing a Build: ../install-storage-cluster#installing-a-build