<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>JERVIS DOT WS &#187; RHEL</title>
	<atom:link href="http://jervis.ws/tag/rhel/feed/" rel="self" type="application/rss+xml" />
	<link>http://jervis.ws</link>
	<description>A techie’s thoughts and opinions on anything &#38; everything that comes to mind</description>
	<lastBuildDate>Tue, 15 Feb 2011 20:49:09 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.5</generator>
		<item>
		<title>Building RPMs</title>
		<link>http://jervis.ws/2010/02/28/building-rpms/</link>
		<comments>http://jervis.ws/2010/02/28/building-rpms/#comments</comments>
		<pubDate>Sun, 28 Feb 2010 11:08:35 +0000</pubDate>
		<dc:creator>Rob</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Red Hat]]></category>
		<category><![CDATA[RHEL]]></category>
		<category><![CDATA[rpm]]></category>

		<guid isPermaLink="false">http://www.jervis.ws/?p=191</guid>
		<description><![CDATA[<p>Here is some advice I found useful when setting up my RPM build environment, and building a basic RPM.  The main source I used, to save reading my book again or the man pages, was Linc Fessenden&#8217;s blog and some of Linc&#8217;s blog is repeated here for completeness. Thanks Linc!</p>
<p>These instructions should work fine on any CentOS [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.jervis.ws/wp-content/uploads/rpm-build.jpg"><img class="alignright size-full wp-image-202" title="rpm-build" src="http://www.jervis.ws/wp-content/uploads/rpm-build.jpg" alt="" width="371" height="102" /></a>Here is some advice I found useful when setting up my RPM build environment, and building a basic RPM.  The main source I used, to save reading my book again or the man pages, was <a href="http://lincgeek.org/blog/?p=303" target="_blank">Linc Fessenden&#8217;s blog</a> and some of Linc&#8217;s blog is repeated here for completeness. Thanks Linc!</p>
<p>These instructions should work fine on any CentOS / RHEL / Fedora system.</p>
<p>First off, we need the rpm-build package to be installed. Check and install if needed.<br />
<code>yum install rpm-build</code></p>
<p>Login to the system as your user account, then make the following directories:</p>
<p><code><br />
mkdir -p ~/rpm<br />
mkdir -p ~/rpm/BUILD<br />
mkdir -p ~/rpm/RPMS<br />
mkdir -p ~/rpm/SOURCES<br />
mkdir -p ~/rpm/SPECS<br />
mkdir -p ~/rpm/SRPMS<br />
mkdir -p ~/rpm/tmp<br />
</code></p>
<p>And create an ~/.rpmmacros file with the following in it:</p>
<p><code><br />
%packager Your Name<br />
%_topdir /home/YOUR USERNAME/rpm<br />
%_tmppath /home/YOUR USERNAME/rpm/tmp<br />
</code></p>
<p>Now you need to create a package source code ditectory in the ~/rpm/SOURCES directory. You should name it package name &#8211; major revision number. Eg: ~/rpm/SOURCES/robspackage-1. In that directory place all the files that you wish to package in the RPM. I have put &#8220;script.sh&#8221; in mine.</p>
<p>Once that is done, make a tarball of that directory in the ~/rpm/SOURCES directory named programname-revision.tar.gz. Eg:<br />
<code><br />
cd ~/rpm/SOURCES<br />
tar -czvf rob-1.tar.gz rob-1/<br />
</code></p>
<p>In the ~/rpm/SPECS directory, create a packagename.spec file for your package.<br />
Eg: rob.spec:</p>
<blockquote><p>Summary: My first rpm package<br />
Name: rob<br />
Version: 1<br />
Release: 1<br />
Source0: rob-1.tar.gz<br />
License: GPL<br />
Group: CustomGroup<br />
BuildArch: noarch<br />
BuildRoot: %{_tmppath}/%{name}-buildroot<br />
%description<br />
Relevant package description<br />
%prep<br />
%setup -q<br />
%build<br />
%install<br />
install -m 0755 -d $RPM_BUILD_ROOT/opt/rob<br />
install -m 0755 script.sh $RPM_BUILD_ROOT/opt/rob/script.sh<br />
%clean<br />
rm -rf $RPM_BUILD_ROOT<br />
%post<br />
echo &#8221; &#8221;<br />
echo &#8220;This will display after rpm installs the package!&#8221;<br />
%files<br />
%dir /opt/rob<br />
/opt/rob/script.sh<br />
%changelog<br />
* Wed Feb 24 2010 Rob Jervis<br />
- added something or fixed a bug</p>
<p>* Tue Feb 23 2010 Rob Jervis<br />
- First RPM package of the rob application for EL5</p></blockquote>
<p>Direct Quote from Linc:<br />
&#8220;The install lines tell rpm what to install where and with what permissions. You also have to do any directory creation there as well (the one with the -d in the line).&#8221;</p>
<p>&#8220;The things after %file are similar in that this tells rpm’s database which files are attached to this package. The %dir signifies a new directory, otherwise the files are listed with their complete paths.&#8221;</p>
<p>Now you need to create the package, go to ~/rpm and do “rpmbuild -ba SPECS/rob.spec”.<br />
If your package builds ok, it will end up in the RPMS directory, in this case: ~/rpm/RPMS/noarch/rob-1-1.noarch.rpm.</p>
<p>If it fails to build, first check your spec file carefully. Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://jervis.ws/2010/02/28/building-rpms/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

