{"id":69370,"date":"2021-08-19T04:10:05","date_gmt":"2021-08-19T08:10:05","guid":{"rendered":"http:\/\/bangla.salearningschool.com\/recent-posts\/how-to-create-a-rpm-package-in-linux-26-rhcsa\/"},"modified":"2025-04-29T21:41:33","modified_gmt":"2025-04-29T21:41:33","slug":"how-to-create-a-rpm-package-in-linux-26-rhcsa","status":"publish","type":"post","link":"http:\/\/bangla.sitestree.com\/?p=69370","title":{"rendered":"How to create a RPM package in Linux #26 #RHCSA"},"content":{"rendered":"<h2>How to create a RPM package in Linux<\/h2>\n<p>Creating basic installation RPM package is really easy. You just have to use rpmbuild command. rpmbuild will be applied to your source files and a RPM package will be created [all source files will be included in the RPM package]. Somewhere you need to specify the path of your source files. Just before creating the RPM package, your source files will be copied to a temporary location [termed as Build Root]. Actually, you need to write a spec file. rpmbuild will read that file to extract parameters and will act based on the parameter values.<\/p>\n<h2>Sample RPM Package<\/h2>\n<pre>Summary: A summary description of the software.\nName: xyz\nVersion: 1.0.0\nRelease: 1\nGroup: System Environment\/Base\nBuildRoot: \/var\/tmp\/%{name}-buildroot\nPrefix:\/opt\/xyz\n%description\nDescription of your software\n%pre%prep%build%installrm -rf \/opt\/xyz\/$RPM_BUILD_ROOTmkdir -p \/opt\/xyz\/$RPM_BUILD_ROOT\/dir1mkdir -p \/opt\/xyz\/$RPM_BUILD_ROOT\/dir2cp -r your_source_files_path\/* \/opt\/xyz\/$RPM_BUILD_ROOT\/%post%cleanrm -rf \/opt\/xyz\/$RPM_BUILD_ROOT%files%defattr(-,root,root)\/opt\/xyz\/dir1\/opt\/xyz\/dir2<\/pre>\n<p>In the example, BuildRoot is assigned to: \/var\/tmp\/%{name}-buildroot. %install section is doing the building\/creation of the RPM package. From Summary to %description are the headers to specify different information as the names indicate. %install section is creating the directories needed and copying your source files to BuildRoot directory(cp -r your_source_files_path\/* \/opt\/xyz\/$RPM_BUILD_ROOT\/). %files section specifies where rpm package will install your software.%clean section just cleans the BuildRoot directory after the RPM package is created.<\/p>\n<p>Just a note: As I mentioned Prefix to be \/opt\/xyz, I provided \/opt\/xyz in the paths. If you keep Prefix to be null, then you need to remove \/opt\/xyz from the paths. You can place shell commands under %pre section. These command will run just before the RPM package is being installed(using rpm -i command). Under %post section, you can also place some shell commands that will run immediately after the software installation(using rpm -i command). You can use %preor %post section for operations like creating databases, users, and assigning permissions<\/p>\n<p>This may not be 100% perfect. I did not test it on any system, but it should be almost ok. For another example, please visit: <a href=\"http:\/\/www.redhat.com\/magazine\/002dec04\/features\/betterliving-part2\/\" target=\"new\" rel=\"noopener noreferrer\">http:\/\/www.redhat.com\/magazine\/002dec04\/features\/betterliving-part2\/<\/a><\/p>\n<p>The spec file should have name of type name-version_release.spec. After creating the spec file, run the command rpmbuild -ba the_spec_file_name. It will create rpm packages under \/usr\/src\/redhat\/BUILD\/x86_64 and \/usr\/src\/redhat\/SRPMS. You need to copy the spec file under \/usr\/src\/redhat\/SPECS\/<\/p>\n<p>To install the created RPM package, use rpm -ivh rpmpackagename.rpm command. Look %files section to know where the software will be installed. You can change the path using commands like:rpm -ivh &#8211;prefix \/opt\/rty\/ rpmpackagename.rpm. Check our guide on rpm command From: http:\/\/sitestree.com\/?p=4751<br \/> Categories:26, RHCSA<br \/>Tags:<br \/> Post Data:2009-01-06 06:48:45<\/p>\n<pre><code>    Shop Online: &lt;a href='https:\/\/www.ShopForSoul.com\/' target='new' rel=\"noopener\"&gt;https:\/\/www.ShopForSoul.com\/&lt;\/a&gt;\n    (Big Data, Cloud, Security, Machine Learning): Courses: &lt;a href='http:\/\/Training.SitesTree.com' target='new' rel=\"noopener\"&gt; http:\/\/Training.SitesTree.com&lt;\/a&gt; \n    In Bengali: &lt;a href='http:\/\/Bangla.SaLearningSchool.com' target='new' rel=\"noopener\"&gt;http:\/\/Bangla.SaLearningSchool.com&lt;\/a&gt;\n    &lt;a href='http:\/\/SitesTree.com' target='new' rel=\"noopener\"&gt;http:\/\/SitesTree.com&lt;\/a&gt;\n    8112223 Canada Inc.\/JustEtc: &lt;a href='http:\/\/JustEtc.net' target='new' rel=\"noopener\"&gt;http:\/\/JustEtc.net (Software\/Web\/Mobile\/Big-Data\/Machine Learning) &lt;\/a&gt;\n    Shop Online: &lt;a href='https:\/\/www.ShopForSoul.com'&gt; https:\/\/www.ShopForSoul.com\/&lt;\/a&gt;\n    Medium: &lt;a href='https:\/\/medium.com\/@SayedAhmedCanada' target='new' rel=\"noopener\"&gt; https:\/\/medium.com\/@SayedAhmedCanada &lt;\/a&gt;\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>How to create a RPM package in Linux Creating basic installation RPM package is really easy. You just have to use rpmbuild command. rpmbuild will be applied to your source files and a RPM package will be created [all source files will be included in the RPM package]. Somewhere you need to specify the path &hellip; <\/p>\n<p><a class=\"more-link btn\" href=\"http:\/\/bangla.sitestree.com\/?p=69370\">Continue reading<\/a><\/p>\n","protected":false},"author":8,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1917,187],"tags":[],"class_list":["post-69370","post","type-post","status-publish","format-standard","hentry","category-fromsitestree-com","category----project-management-basics","item-wrap"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":69376,"url":"http:\/\/bangla.sitestree.com\/?p=69376","url_meta":{"origin":69370,"position":0},"title":"Quick guide to RPM (Red Hat Package Manager) #26","author":"Author-Check- Article-or-Video","date":"August 19, 2021","format":false,"excerpt":"Quick Guide to RPM RPM-Red Hat Package Manager Caldera, Suse, Fedora also use RPM rpm -qa | more to check the installed software in the system q=query a=list rpm -qi faq Query individual package q=query i=requires a package name faq=the package rpm -ql faq List all the files for the\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":14013,"url":"http:\/\/bangla.sitestree.com\/?p=14013","url_meta":{"origin":69370,"position":1},"title":"Centos\/Redhat \u09b2\u09bf\u09a8\u09be\u0995\u09cd\u09b8 \u098f yum \u0987\u09a8\u09cd\u09b8\u099f\u09b2\u09be\u09b0 \u09b8\u09be\u09b0\u09cd\u09ad\u09be\u09b0 \u0995\u09bf\u09ad\u09be\u09ac\u09c7 \u0995\u09a8\u09ab\u09bf\u0997\u09be\u09b0 \u0995\u09b0\u09ac\u09c7\u09a8","author":"Sayed","date":"December 7, 2017","format":false,"excerpt":"Centos\/Redhat \u09b2\u09bf\u09a8\u09be\u0995\u09cd\u09b8 \u098f yum \u0987\u09a8\u09cd\u09b8\u099f\u09b2\u09be\u09b0 \u09b8\u09be\u09b0\u09cd\u09ad\u09be\u09b0 \u0995\u09bf\u09ad\u09be\u09ac\u09c7 \u0995\u09a8\u09ab\u09bf\u0997\u09be\u09b0 \u0995\u09b0\u09ac\u09c7\u09a8 Mount Installer ISO mkdir \/mnt\/dvd1 mount \/dev\/sr0 \/mnt\/dvd1 Check if FTP server is installed systemctl status vsftpd systemctl start vsftpd Install ftp Server. Using rpm as yum is not available yet [default yum needs the internet, kindof] cd \/mnt\/dvd1\/Packages\/ rpm -ivh\u2026","rel":"","context":"In &quot;\u09b2\u09bf\u09a8\u09be\u0995\u09cd\u09b8 \u098f\u09ac\u0982 \u0989\u09a8\u09bf\u0995\u09cd\u09b8 \u0964 Linux and Unix&quot;","block_context":{"text":"\u09b2\u09bf\u09a8\u09be\u0995\u09cd\u09b8 \u098f\u09ac\u0982 \u0989\u09a8\u09bf\u0995\u09cd\u09b8 \u0964 Linux and Unix","link":"http:\/\/bangla.sitestree.com\/?cat=1231"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":69374,"url":"http:\/\/bangla.sitestree.com\/?p=69374","url_meta":{"origin":69370,"position":2},"title":"Build RPM Package #26","author":"Author-Check- Article-or-Video","date":"August 19, 2021","format":false,"excerpt":"Check the tutorial below for a detail discussionhttp:\/\/www.rpm.org\/max-rpm\/ From: http:\/\/sitestree.com\/?p=4749 Categories:26Tags: Post Data:2010-08-25 17:48:18 Shop Online: <a href='https:\/\/www.ShopForSoul.com\/' target='new' rel=\"noopener\">https:\/\/www.ShopForSoul.com\/<\/a> (Big Data, Cloud, Security, Machine Learning): Courses: <a href='http:\/\/Training.SitesTree.com' target='new' rel=\"noopener\"> http:\/\/Training.SitesTree.com<\/a> In Bengali: <a href='http:\/\/Bangla.SaLearningSchool.com' target='new' rel=\"noopener\">http:\/\/Bangla.SaLearningSchool.com<\/a> <a href='http:\/\/SitesTree.com' target='new' rel=\"noopener\">http:\/\/SitesTree.com<\/a> 8112223 Canada Inc.\/JustEtc: <a href='http:\/\/JustEtc.net' target='new' rel=\"noopener\">http:\/\/JustEtc.net (Software\/Web\/Mobile\/Big-Data\/Machine\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":67586,"url":"http:\/\/bangla.sitestree.com\/?p=67586","url_meta":{"origin":69370,"position":3},"title":"Create your own yum repo in Centos\/Redhat #DevOps #RHCSA","author":"Author-Check- Article-or-Video","date":"July 25, 2021","format":false,"excerpt":"Yum is a software installation manager for Redhat Linux and Related. yum is a better tool than rpm. Here, we will take the rpm packages as come with Redhat\/Centos and then we will host those packages on our own Repo Server for yum. i.e. yum will use this Repo to\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":67602,"url":"http:\/\/bangla.sitestree.com\/?p=67602","url_meta":{"origin":69370,"position":4},"title":"Experiment with SSH and TCP Wrappers #DevOps","author":"Author-Check- Article-or-Video","date":"July 25, 2021","format":false,"excerpt":"The idea was : use two servers; server1, and server2 create user: user1 in both server1 and server2 use nmtui to assign IP Addresses to both use ifdown and ifup to check if IPs are assigned properly change \/etc\/hosts and add the server ips and names use ping to know\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":13343,"url":"http:\/\/bangla.sitestree.com\/?p=13343","url_meta":{"origin":69370,"position":5},"title":"\u0986\u09ae\u09be\u09a6\u09c7\u09b0 \u09b2\u09bf\u0996\u09be \u0995\u09bf\u099b\u09c1 \u0985\u09cd\u09af\u09be\u09a8\u09a1\u09cd\u09b0\u0987\u09a1 \u0985\u09cd\u09af\u09be\u09aa &#8211; \u0995\u09cb\u09a1 \u0989\u09a6\u09be\u09b9\u09b0\u09a3 \u09b8\u09b9","author":"Sayed","date":"October 8, 2017","format":false,"excerpt":"\u0986\u09ae\u09be\u09a6\u09c7\u09b0 \u09b2\u09bf\u0996\u09be \u0995\u09bf\u099b\u09c1 \u0985\u09cd\u09af\u09be\u09a8\u09a1\u09cd\u09b0\u0987\u09a1 \u0985\u09cd\u09af\u09be\u09aa - \u0986\u09aa\u09a8\u09bf \u098f\u0996\u09be\u09a8\u09c7 \u09aa\u09be\u09ac\u09c7\u09a8\u0964 https:\/\/play.google.com\/store\/apps\/developer?id=Sayed+Ahmed \u0995\u09cb\u09a1 \u0997\u09c1\u09b2\u09cb \u09a8\u09bf\u099a\u09c7\u09b0 \u09b2\u09bf\u0999\u09cd\u0995 \u098f \u09aa\u09be\u09ac\u09c7\u09a8\u0964 https:\/\/github.com\/sayedjustetc\/android-apps-by-justetc \u0985\u09cd\u09af\u09be\u09a8\u09a1\u09cd\u09b0\u0987\u09a1 \u0985\u09cd\u09af\u09be\u09aa \u09b2\u09bf\u0996\u09be\u09b0 \u099c\u09a8\u09cd\u09af \u0986\u09aa\u09a8\u09be\u0995\u09c7 \u099c\u09be\u09ad\u09be \u09ac\u09cd\u09af\u09ac\u09b9\u09be\u09b0 \u0995\u09b0\u09a4\u09c7 \u09b9\u09ac\u09c7\u0964 \u0986\u09aa\u09a8\u09bf Android Developer Studio (ADT) \u0985\u09a5\u09ac\u09be\u00a0 Eclipse \u09ac\u09cd\u09af\u09ac\u09b9\u09be\u09b0 \u0995\u09b0\u09a4\u09c7 \u09aa\u09be\u09b0\u09c7\u09a8\u0964 \u0986\u09ae\u09b0\u09be\u00a0 Android Developer Studio (ADT)\u00a0 \u098f\u09ac\u0982\u00a0 Gradle \u09ac\u09cd\u09af\u09ac\u09b9\u09be\u09b0 \u0995\u09b0\u09c7\u099b\u09bf . \u09a4\u09be\u0987 \u0986\u09ae\u09be\u09a6\u09c7\u09b0 \u0995\u09cb\u09a1 \u0989\u09a6\u09be\u09b9\u09b0\u09a3\u2026","rel":"","context":"In &quot;Root&quot;","block_context":{"text":"Root","link":"http:\/\/bangla.sitestree.com\/?cat=1"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/69370","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/users\/8"}],"replies":[{"embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=69370"}],"version-history":[{"count":1,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/69370\/revisions"}],"predecessor-version":[{"id":78086,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/69370\/revisions\/78086"}],"wp:attachment":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=69370"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=69370"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=69370"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}