Difference between revisions of "Build rpm packages with the rpmbuild command"
From Linuxintro
Line 7: | Line 7: | ||
Hello! dkkbakg interesting dkkbakg site! I'm really like it! Very, very dkkbakg good! | Hello! dkkbakg interesting dkkbakg site! I'm really like it! Very, very dkkbakg good! | ||
− | + | Very nice site! | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
= Build the rpm = | = Build the rpm = |
Revision as of 09:58, 25 October 2013
This article is about how to build rpm packages with the rpmbuild command and a SPEC file. The example is based on SuSE 11.3 x86_64. However, other distributions should work same or similar. In this article, we will create a program that outputs "hello world", add a makefile to build it, and create a SPEC file to package the software as an RPM file.
Hello! fegckkb interesting fegckkb site! I'm really like it! Very, very fegckkb good!
Very nice site!
Hello! dkkbakg interesting dkkbakg site! I'm really like it! Very, very dkkbakg good!
Very nice site!
Build the rpm
Now we have the SPEC file and the software. First we store the source in the "appropriate" place:
cd tar cvzf hello.tar.gz hello-1.0 cp hello.tar.gz /usr/src/packages/SOURCES
Then, build it with the command
rpmbuild -ba hello-1.0/hello.spec
You will find your ready RPM under /usr/src/packages/RPMS.
Test the rpm
- let's see if the RPM really exists
# ll /usr/src/packages/RPMS/x86_64/ total 8 -rw-r--r-- 1 root root 4856 Feb 13 17:03 hello-1.0-1.x86_64.rpm
- let's install it
# rpm -ivh /usr/src/packages/RPMS/x86_64/hello-1.0-1.x86_64.rpm Preparing... ########################################### [100%] 1:hello ########################################### [100%]
- list what files it contains
# rpm -ql hello /usr/local/bin/hello
- find out if it remembers the information we gave it
# rpm -qi hello Name : hello Relocations: (not relocatable) Version : 1.0 Vendor: - Release : 1 Build Date: Sun Feb 13 17:03:57 2011 Install Date: Sun Feb 13 17:21:42 2011 Build Host: tweedleburg.site Group : Applications/Tutorials Source RPM: hello-1.0-1.src.rpm Size : 11847 License: GPL Signature : (none) Packager : Thorsten Staerk URL : http://www.staerk.de/thorsten/ Summary : hello greets the world Description : hello greets the world Distribution: SUSE Linux
- let's see if we can remove it
# ll /usr/local/bin/hello -rwxr-xr-x 1 root root 11847 Feb 13 17:03 /usr/local/bin/hello # rpm -e hello # ll /usr/local/bin/hello ls: cannot access /usr/local/bin/hello: No such file or directory
- yes we can :)
Clean up
To clean up, run
rm /usr/src/packages/SOURCES/hello.tar.gz rm -rf /usr/src/packages/BUILD/hello-1.0