Creating rpm packages

From Notes_Wiki
Revision as of 03:07, 13 September 2013 by Saurabh (talk | contribs) (Created page with "<yambe:breadcrumb>Rpm|Rpm</yambe:breadcrumb> =Creating rpm packages= # Install '<tt>rpmdevtools</tt>' and '<tt>rpmlint</tt>' packages # Use '<tt>rpmdev-setuptree</tt>' comman...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

<yambe:breadcrumb>Rpm|Rpm</yambe:breadcrumb>

Creating rpm packages

  1. Install 'rpmdevtools' and 'rpmlint' packages
  2. Use 'rpmdev-setuptree' command to create rpmbuild folder and sub-folders in current users home folder
  3. Create 'hello.txt' file using 'echo hello > ~/rpmbuild/SOURCES/hello.txt'
  4. Create 'hello_world.spec' file with following contents:
    Name: hello_world
    Version: 1.0
    Release: 1%{?dist}
    Summary: Test hello world package to learn rpm
    License: GPL
    URL: http://www.sbarjatiya.com/
    Source0: hello.txt
    %description
    Just a test package to learn RPM
    %prep
    cp $RPM_SOURCE_DIR/hello.txt $RPM_BUILD_DIR
    %build
    %install
    rm -rf $RPM_BUILD_ROOT
    mkdir -p $RPM_BUILD_ROOT
    cp hello.txt $RPM_BUILD_ROOT
    %clean
    rm -rf $RPM_BUILD_ROOT
    %files
    %defattr(-,root,root,-)
    /hello.txt
    %changelog
    * Tue Oct 10 2013 Saurabh Barjatiya <barjatiya.saurabh@gmail.com>
    - Created spec file for hello_world project with hello.txt file
  5. Go to '~/rpmbuild/SPECS' folder
  6. Use 'rpmbuild -ba hello_world.spec' command to create rpm file
  7. Test created rpm using 'sudo rpm -ivh ../RPMS/x86_64/hello*.rpm'
  8. Verify there is hello.txt file in / using 'ls -l /'


Steps learned using http://rpmbuildtut.wordpress.com/ and http://www.rpm.org/max-rpm/ch-rpm-build.html


<yambe:breadcrumb>Rpm|Rpm</yambe:breadcrumb>