piątek, 11 listopada 2011

CentOS: Creating rpm packages (ceph-0.38)

This article describes step by step how to create own packages on the example of the ceph package (0.38)

1. Create the directory structure - the easiest way is to install the rpmdevtools and use it to create the structure:

[root@localhost /]# yum install rpmdevtools

2. Download the sources as a tar balls and put it to the SOURCES directory:

[root@localhost /]# cd ~/rpmbuild/SOURCES
[root@localhost rpmbuild]# wget http://ceph.newdream.net/download/ceph-0.38.tar.gz

3. Prepare and customize the spec. If you want to pass some options to the configure utility just customize the configure options and specify the directories to be included in the rpm package (all marked with red color below). Check also if the source tar archive name matches the one placed in the SOURCES folder.


[root@localhost rpmbuild]# vim ./SPECS/ceph.spec 
Name: ceph
Version: 0.38
Release: 1%{?dist}
Summary: Krystianek's package


Group: HA-experiments
License: GPL
URL:        http://http://ceph.newdream.net/
Source0: ceph-0.38.tar.gz
BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)


%description
CEPH utilities 


%prep
%setup -q


%build
%configure --without-tcmalloc
make %{?_smp_mflags}


%install
rm -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT


%clean
rm -rf $RPM_BUILD_ROOT


%files
%defattr(-,root,root,-)
%doc

/etc/
/var/
/usr/



%changelog


4. Create the rpm. Go to the directory structure root and invoke the rpmbuild to create the rpm

[root@localhost rpmbuild]# cd ~/rpmbuild
[root@localhost rpmbuild]# rpmbuild -ba SPECS/ceph.spec

You might need to set the mask for RPATH to ignore the errors regarding the standard paths:

[root@localhost rpmbuild]# QA_RPATHS=$[ 0x0001|0x0010 ] rpmbuild -ba SPECS/ceph.spec

5. Install the previously create rpm.


[root@localhost rpmbuild]# rpm -i ./RPMS/x86_64/ceph-0.38-1.el6.x86_64.rpm


Remarks: For cuilding the ceph you need additional development packages for tcmalloc (part of google performance, can be downloaded from http://code.google.com/p/google-perftools/) and libatomic (available in the standard CentOS repo as libatomic_ops-devel)


Brak komentarzy:

Prześlij komentarz