Difference between revisions of "Creating rpm packages"

From Notes_Wiki
(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...")
 
m
 
Line 1: Line 1:
<yambe:breadcrumb>Rpm|Rpm</yambe:breadcrumb>
[[Main Page|Home]] > [[CentOS]] > [[CentOS 6.x]] > [[System administration tools]] > [[Package management tools]] > [[Rpm|rpm]] > [[Creating rpm packages]]
=Creating rpm packages=


# Install '<tt>rpmdevtools</tt>' and '<tt>rpmlint</tt>' packages
# Install '<tt>rpmdevtools</tt>' and '<tt>rpmlint</tt>' packages
Line 54: Line 53:




<yambe:breadcrumb>Rpm|Rpm</yambe:breadcrumb>
[[Main Page|Home]] > [[CentOS]] > [[CentOS 6.x]] > [[System administration tools]] > [[Package management tools]] > [[Rpm|rpm]] > [[Creating rpm packages]]

Latest revision as of 12:20, 28 July 2022

Home > CentOS > CentOS 6.x > System administration tools > Package management tools > rpm > 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


Home > CentOS > CentOS 6.x > System administration tools > Package management tools > rpm > Creating rpm packages