Creating rpm packages
From Notes_Wiki
<yambe:breadcrumb>Rpm|Rpm</yambe:breadcrumb>
Creating rpm packages
- Install 'rpmdevtools' and 'rpmlint' packages
- Use 'rpmdev-setuptree' command to create rpmbuild folder and sub-folders in current users home folder
- Create 'hello.txt' file using 'echo hello > ~/rpmbuild/SOURCES/hello.txt'
- 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
- Go to '~/rpmbuild/SPECS' folder
- Use 'rpmbuild -ba hello_world.spec' command to create rpm file
- Test created rpm using 'sudo rpm -ivh ../RPMS/x86_64/hello*.rpm'
- 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>