<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://aznot.com/index.php?action=history&amp;feed=atom&amp;title=RPM_Package_Manager</id>
	<title>RPM Package Manager - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://aznot.com/index.php?action=history&amp;feed=atom&amp;title=RPM_Package_Manager"/>
	<link rel="alternate" type="text/html" href="https://aznot.com/index.php?title=RPM_Package_Manager&amp;action=history"/>
	<updated>2026-05-08T23:02:07Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://aznot.com/index.php?title=RPM_Package_Manager&amp;diff=1110&amp;oldid=prev</id>
		<title>Kenneth: /* Simple SPEC */</title>
		<link rel="alternate" type="text/html" href="https://aznot.com/index.php?title=RPM_Package_Manager&amp;diff=1110&amp;oldid=prev"/>
		<updated>2014-09-22T01:30:32Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Simple SPEC&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== RPM Package Manager (RPM) ==&lt;br /&gt;
&lt;br /&gt;
[http://www.rpm.org/ RPM Package Manager (RPM)]:&lt;br /&gt;
:&amp;quot;The RPM Package Manager (RPM) is a powerful command line driven package management system capable of installing, uninstalling, verifying, querying, and updating computer software packages. Each software package consists of an archive of files along with information about the package like its version, a description, and the like.&amp;quot; [http://www.rpm.org/]&lt;br /&gt;
&lt;br /&gt;
==RPM Commands==&lt;br /&gt;
 # List all installed packages&lt;br /&gt;
 rpm -qa&lt;br /&gt;
&lt;br /&gt;
 # List installed package by name&lt;br /&gt;
 rpm -q &amp;lt;package&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # List installed package details&lt;br /&gt;
 rpm -qi &amp;lt;package&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # List files in an installed package&lt;br /&gt;
 rpm -ql &amp;lt;package&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # List state of all files in an installed package (similar to -l)&lt;br /&gt;
 rpm -qs &amp;lt;package&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # Verify installed package (check to see if any files have been changed)&lt;br /&gt;
 rpm -V &amp;lt;package&amp;gt;&lt;br /&gt;
 rpm -Vv &amp;lt;package&amp;gt;&lt;br /&gt;
 rpm -qa -V  # show all files that have changed from all packages&lt;br /&gt;
&lt;br /&gt;
 # List package details (does not have to be installed)&lt;br /&gt;
 # Tell me all about the package contained in &amp;lt;file&amp;gt;.rpm, which doesn&amp;#039;t have to be installed.&lt;br /&gt;
 rpm -qpi &amp;lt;file&amp;gt;.rpm&lt;br /&gt;
&lt;br /&gt;
 # List package contents (does not have to be installed)&lt;br /&gt;
 rpm -qpl &amp;lt;file&amp;gt;.rpm&lt;br /&gt;
 rpm -qpvl &amp;lt;file&amp;gt;.rpm&lt;br /&gt;
&lt;br /&gt;
 # Show which package file came from&lt;br /&gt;
 rpm -qf &amp;lt;file&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 # List packaged documentation&lt;br /&gt;
 rpm -qpd &amp;lt;file&amp;gt;.rpm&lt;br /&gt;
&lt;br /&gt;
 # List packaged configuration files&lt;br /&gt;
 rpm -qpc &amp;lt;file&amp;gt;.rpm&lt;br /&gt;
&lt;br /&gt;
 # Check if you were bitten by the FC6 i686 bug:&lt;br /&gt;
 rpm -q --qf=&amp;#039;%{name}-%{version}-%{release}.%{arch}\n&amp;#039; kernel&lt;br /&gt;
 rpm -qa --queryformat &amp;quot;%{NAME}-%{VERSION}.%{RELEASE} (%{ARCH})\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 # Rebuild RPM database: (generally does not happen with FC)&lt;br /&gt;
 rm -f /var/lib/rpm/__db*&lt;br /&gt;
 rpmdb -vv --rebuilddb&lt;br /&gt;
&lt;br /&gt;
 # List RPM dependencies: [http://www.cyberciti.biz/faq/how-do-i-find-what-dependencies-a-rpm-file-has/]&lt;br /&gt;
 rpm -qpR [file.rpm]&lt;br /&gt;
 rpm -qR [package]&lt;br /&gt;
 rpm -q --requires [package]&lt;br /&gt;
&lt;br /&gt;
 # Remove a package:&lt;br /&gt;
 rpm -e [package]&lt;br /&gt;
&lt;br /&gt;
 # Install a package:&lt;br /&gt;
 rpm -Uvh [file.rpm]&lt;br /&gt;
&lt;br /&gt;
==How to extract SPEC file from a Source RPM==&lt;br /&gt;
[http://www.linuxquestions.org/questions/programming-9/how-to-extract-spec-file-from-rpm-file-426847/ How to extract spec file from rpm file]:&lt;br /&gt;
:&amp;quot;A .spec is similar to a Makefile. When you install an application from tarball it (usually) doesnt automagically install the Makefile. When you make a rpm from spec it doesnt include the spec file. So, no there isnt any way.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
To see scripts:&lt;br /&gt;
 rpm -qp --scripts &amp;lt;file&amp;gt;.rpm&lt;br /&gt;
&lt;br /&gt;
Extract SPEC file from source RPM:&lt;br /&gt;
:&amp;quot;You can extract the spec file from a source rpm file (some times a binary rpm file), using command:&amp;quot;&lt;br /&gt;
 rpm2cpio {FullNameOfSourceRPM} | cpio -iumd {NameOfSourceRPM.spec}&lt;br /&gt;
&lt;br /&gt;
List files in rpm file:&lt;br /&gt;
 rpm -qpl [file.rpm]&lt;br /&gt;
 rpm2cpio [file.rpm] | cpio -t&lt;br /&gt;
&lt;br /&gt;
Extract RPM contents from RPM:&lt;br /&gt;
 rpm2cpio [file.rpm] | cpio -idmv&lt;br /&gt;
&lt;br /&gt;
 i: Restore archive&lt;br /&gt;
 d: Create leading directories where needed&lt;br /&gt;
 m: Retain previous file modification times when creating files&lt;br /&gt;
 v: Verbose i.e. display progress&lt;br /&gt;
&lt;br /&gt;
==Signing==&lt;br /&gt;
Signing RPM [http://sial.org/howto/rpm/]&lt;br /&gt;
&lt;br /&gt;
Generate gpg key:&lt;br /&gt;
 gpg --gen-key&lt;br /&gt;
 gpg --armor --export kenneth@kennethburgener.org &amp;gt; RPM-GPG-KEY-kenneth&lt;br /&gt;
&lt;br /&gt;
Configure rpm (~/.rpmmacros):&lt;br /&gt;
 %_signature gpg&lt;br /&gt;
 %_gpg_name kenneth@kennethburgener.org&lt;br /&gt;
 #or %_gpg_name Kenneth Burgener&lt;br /&gt;
&lt;br /&gt;
Check signatures:&lt;br /&gt;
 rpm --checksig [file(s).rpm]&lt;br /&gt;
 rpm -K [file(s).rpm]&lt;br /&gt;
 &lt;br /&gt;
 # signed:&lt;br /&gt;
 [file.rpm]: (sha1) dsa sha1 md5 gpg OK&lt;br /&gt;
 &lt;br /&gt;
 # not signed:&lt;br /&gt;
 [file.rpm]: md5 OK&lt;br /&gt;
&lt;br /&gt;
Delete signature:&lt;br /&gt;
 rpm --delsign [file(s).rpm]&lt;br /&gt;
&lt;br /&gt;
NOTE: You cannot resign an RPM v3 file with RPM v4.  When you go to check the signature you will see an error.&lt;br /&gt;
 # Check RPM file version&lt;br /&gt;
 rpm -qp [file.rpm] --qf &amp;#039;%{rpmversion}\n&amp;#039;&lt;br /&gt;
&lt;br /&gt;
 # Error when trying to install a bad signed RPM with Yum&lt;br /&gt;
 warning: rpmts_HdrFromFdno:  Header V3 DSA signature: NOKEY, key ID [ID]&lt;br /&gt;
 Public key for [PACKAGE] is not installed&lt;br /&gt;
&lt;br /&gt;
Resign package:&lt;br /&gt;
 rpm --resign [file(s).rpm]&lt;br /&gt;
 rpm --addsign [file(s).rpm]&lt;br /&gt;
&lt;br /&gt;
 [trogdor@hal i386]$ rpm --resign *rpm&lt;br /&gt;
 error: You must set &amp;quot;%_gpg_name&amp;quot; in your macro file&lt;br /&gt;
 Pass phrase check failed&lt;br /&gt;
 &lt;br /&gt;
 [trogdor@hal i386]$ cat &amp;gt; ~/.rpmmacros&lt;br /&gt;
 %_gpg_name      Kenneth Burgener&lt;br /&gt;
&lt;br /&gt;
You cannot sign a version 3 RPM file.  Show RPM file&amp;#039;s version:&lt;br /&gt;
 rpm -qp [file.rpm] --qf &amp;#039;%{rpmversion}\n&amp;#039;&lt;br /&gt;
Import signature:&lt;br /&gt;
 rpm --import [signature_file]&lt;br /&gt;
&lt;br /&gt;
List imported signatures:&lt;br /&gt;
 rpm -q gpg-pubkey --qf &amp;#039;%{name}-%{version}-%{release} --&amp;gt; %{summary}\n&amp;#039;&lt;br /&gt;
&lt;br /&gt;
===Automate Signing===&lt;br /&gt;
&amp;quot;You can automate it by not putting a password on the gpgkey.  most of the rpms are manually signed for this reason.  and all of extras are manually signed. the only automated signed would be in rawhide  and i think they are generally not signed at all.&lt;br /&gt;
&lt;br /&gt;
iirc, even with a blank passwd, rpm&amp;#039;s default behavior is to ask for a&lt;br /&gt;
password anyway,&lt;br /&gt;
&lt;br /&gt;
&amp;#039;expect&amp;#039; knows what to do :)&lt;br /&gt;
&lt;br /&gt;
Yes, rpm always asks... And yes, expect knows what to do:&lt;br /&gt;
 #!/usr/bin/expect&lt;br /&gt;
 set p &amp;quot;&amp;quot;&lt;br /&gt;
 set f [lindex $argv 0]&lt;br /&gt;
 spawn rpm --resign $f&lt;br /&gt;
 expect &amp;quot;Enter pass phrase:&amp;quot;&lt;br /&gt;
 send -- &amp;quot;$p\r&amp;quot;&lt;br /&gt;
 expect eof&lt;br /&gt;
&lt;br /&gt;
The other way; Use perl (&lt;br /&gt;
&lt;br /&gt;
http://search.cpan.org/~nanardon/RPM4-0.20/lib/RPM4.pm). RPM4 also knows how to do it...&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Reference: [http://osdir.com/ml/redhat.fedora.buildsystem/2006-11/msg00056.html Re: automate rpm signing?: msg#00056]&lt;br /&gt;
&lt;br /&gt;
== Rebuilding a SRPM ==&lt;br /&gt;
&lt;br /&gt;
=== [http://perso.b2b2c.ca/sarrazip/dev/rpm-building-crash-course.html RPM Building Crash Course] ===&lt;br /&gt;
&lt;br /&gt;
==== Avoiding root ====&lt;br /&gt;
&lt;br /&gt;
By default, RPM packages are built in the /usr/src/redhat directory, which is only writable by root. You can have the rpmbuild command use another directory (e.g., /home/your_userid/rpm) by putting this line in a file called .rpmmacros in your home directory:&lt;br /&gt;
&lt;br /&gt;
 %_topdir /home/your_userid/rpm&lt;br /&gt;
&lt;br /&gt;
You must then create the following subdirectories in that directory:&lt;br /&gt;
&lt;br /&gt;
 cd /home/your_userid/rpm&lt;br /&gt;
 mkdir SOURCES SPECS BUILD SRPMS&lt;br /&gt;
 mkdir -p RPMS/i386 RPMS/athlon RPMS/i486 RPMS/i586 RPMS/i686 RPMS/noarch&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
 echo &amp;quot;%_topdir $HOME&amp;quot; &amp;gt; ~/.rpmmacros&lt;br /&gt;
 mkdir $HOME/rpm&lt;br /&gt;
 cd $HOME/rpm&lt;br /&gt;
 mkdir SOURCES SPECS BUILD SRPMS&lt;br /&gt;
 mkdir -p RPMS/i386 RPMS/athlon RPMS/i486 RPMS/i586 RPMS/i686 RPMS/noarch&lt;br /&gt;
&lt;br /&gt;
==== Building from a source RPM (SRPM) ====&lt;br /&gt;
&lt;br /&gt;
Install the .src.rpm file this way:&lt;br /&gt;
&lt;br /&gt;
 rpm -i somepackage-1.0-1.src.rpm&lt;br /&gt;
&lt;br /&gt;
This will create files in the SOURCES directory of your RPM building directory tree, and a .spec file in the SPECS directory.&lt;br /&gt;
&lt;br /&gt;
Then go the SPECS directory and give the command to build the RPM:&lt;br /&gt;
&lt;br /&gt;
 cd /home/your_userid/rpm/SPECS&lt;br /&gt;
 rpmbuild -bb somepackage.spec&lt;br /&gt;
&lt;br /&gt;
Give the -ba option instead if you also want to build the SRPM. The binary RPM packages will typically be created in the RPMS/i386 directory (on a PC-based system).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Rebuilding a source RPM (SRPM) ====&lt;br /&gt;
&lt;br /&gt;
 mkdir -p /usr/src/redhat/&lt;br /&gt;
 rpmbuild --rebuild sourcerpm.src.rpm&lt;br /&gt;
&lt;br /&gt;
==== Building from a source archive ====&lt;br /&gt;
&lt;br /&gt;
When a source archive (e.g., somepackage-1.0.tar.gz) contains a .spec file, one can give the following command to build the RPM without having to deploy the archive:&lt;br /&gt;
&lt;br /&gt;
 rpmbuild -tb somepackage-1.0.tar.gz&lt;br /&gt;
&lt;br /&gt;
Give the -ta option instead if you also want to build the SRPM.&lt;br /&gt;
&lt;br /&gt;
=== [http://postfix.state-of-mind.de/patrick.koetter/smtpauth/building_RPMS_from_SRPMS.html 7. Building RPMS from SOURCE or SRPMS] ===&lt;br /&gt;
&lt;br /&gt;
7. Building RPMS from SOURCE or SRPMS&lt;br /&gt;
&lt;br /&gt;
If you haven&amp;#039;t done so before: It is easy to build or rebuild RPMS from SRPMS. Let&amp;#039;s get a quick overview how we build RPMS in our HOWTO.&lt;br /&gt;
&lt;br /&gt;
IMPORTANT NOTE: Never build RPMS as root.&lt;br /&gt;
&lt;br /&gt;
# Log into your machine as a regular user.&lt;br /&gt;
# create a mirror image of the main RPM directory structure in your $HOME and&lt;br /&gt;
# tell RPM to use these directories instead of the original ones.&lt;br /&gt;
&lt;br /&gt;
7.1. Create RPM directories&lt;br /&gt;
&lt;br /&gt;
RPM needs a certain directory structure to build RPMS from SOURCE or from SRPMS. When we build them as non-root user, we cannot use the default location because only root is allowed to write to those directories. So we create the same directory structure in our regular users $HOME-directory:&lt;br /&gt;
&lt;br /&gt;
 [user@example.com]$ mkdir $HOME/rpm $HOME/rpm/SOURCES $HOME/rpm/SPECS $HOME/rpm/BUILD $HOME/rpm/SRPMS $HOME/rpm/RPMS $HOME/rpm/RPMS/i386&lt;br /&gt;
&lt;br /&gt;
When we are done with this, the directory tree of the new rpm directory in our $HOME-directory should look like that:&lt;br /&gt;
&lt;br /&gt;
Example 1. directory tree of new rpm directory&lt;br /&gt;
&lt;br /&gt;
 rpm&lt;br /&gt;
 |-- BUILD&lt;br /&gt;
 |-- RPMS&lt;br /&gt;
 |   `-- i386&lt;br /&gt;
 |-- SOURCES&lt;br /&gt;
 |-- SPECS&lt;br /&gt;
 `-- SRPMS&lt;br /&gt;
&lt;br /&gt;
7.2. Set environment variables&lt;br /&gt;
&lt;br /&gt;
Now we need to tell the RPM-Manager that the non-root user wants this location to build RPMS instead of the default location.&lt;br /&gt;
&lt;br /&gt;
 [user@example.com]$ echo &amp;quot;%_topdir $HOME/rpm&amp;quot; &amp;gt;&amp;gt; $HOME/.rpmmacros&lt;br /&gt;
&lt;br /&gt;
Note: If you want to dig deeper into building RPMS you can find excellent information in the [http://www.rpm.org/max-rpm/ Maximum RPM HOWTO] at [http://www.rpm.org/ rpm.org].&lt;br /&gt;
&lt;br /&gt;
==Building a RPM==&lt;br /&gt;
[http://www.rpm.org/max-rpm/ Max RPM]&lt;br /&gt;
&lt;br /&gt;
Install rpm build tools:&lt;br /&gt;
 yum install rpm-build&lt;br /&gt;
&lt;br /&gt;
Configuring your ~/.rpmmacros:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
%packager	Kenneth Burgener &amp;lt;kenneth.burgener@oeey.com&amp;gt;&lt;br /&gt;
%vendor		Name of your project&lt;br /&gt;
&lt;br /&gt;
%_topdir	/home/build/rpm&lt;br /&gt;
%_tmppath	/home/build/rpm/tmp&lt;br /&gt;
&lt;br /&gt;
%_signature	gpg&lt;br /&gt;
%_gpg_name	kenneth.burgener@oeey.com&lt;br /&gt;
# %_gpg_name	Kenneth Burgener &amp;lt;kenneth.burgener@oeey.com&amp;gt;&lt;br /&gt;
%_gpgbin	/usr/bin/gpg&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
%_sourcedir	/home/build/rpm/SOURCE&lt;br /&gt;
%_specdir	/home/build/rpm/SPEC&lt;br /&gt;
%_srcrpmdir	/home/build/rpm/SRPMS&lt;br /&gt;
%_builddir	/home/build/rpm/BUILD&lt;br /&gt;
%_rpmdir	/home/build/rpm/RPMS&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See current rpm configurations:&lt;br /&gt;
 rpm --showrc | grep -i specdir&lt;br /&gt;
&lt;br /&gt;
Create folders:&lt;br /&gt;
 mkdir ~/rpm; cd ~/rpm&lt;br /&gt;
 mkdir -p BUILD RPMS RPMS/i386 RPMS/noarch SOURCES SPECS SRPMS tmp&lt;br /&gt;
&lt;br /&gt;
Building RPM and SRPM:&lt;br /&gt;
 rpmbuild -ba package.spec&lt;br /&gt;
 &lt;br /&gt;
 # spec in tar file:&lt;br /&gt;
 rpmbuild -ta package.tar.gz&lt;br /&gt;
&lt;br /&gt;
Check your binary packages for commonly overlooked errors ([http://rpmlint.zarb.org/ rpmlint website]):&lt;br /&gt;
 rpmlint [file.rpm]&lt;br /&gt;
&lt;br /&gt;
Steps of: rpmbuild -ba [file.spec]&lt;br /&gt;
* Read and parse the filename.spec file&lt;br /&gt;
* Run the %prep section to unpack the source code into a temporary directory and apply any patches&lt;br /&gt;
* Run the %build section to compile the code&lt;br /&gt;
* Run the %install section to install the code into directories on the build machine&lt;br /&gt;
* Read the list of files from the %files section, gather them up, and create binary and source RPM files&lt;br /&gt;
* Run the %clean section to remove the temporary build directory&lt;br /&gt;
&lt;br /&gt;
==SPEC file==&lt;br /&gt;
Install and uninstall scripts:&lt;br /&gt;
 %pre     Runs before the package is installed&lt;br /&gt;
 %post    Runs after the package is installed&lt;br /&gt;
 %preun   Runs before the package is uninstalled&lt;br /&gt;
 %postun  Runs after the package is uninstalled &lt;br /&gt;
&lt;br /&gt;
 %pre-install&lt;br /&gt;
 %post-install&lt;br /&gt;
 %verify&lt;br /&gt;
 %pre-uninstall&lt;br /&gt;
 %post-uninstall&lt;br /&gt;
&lt;br /&gt;
Tips:&lt;br /&gt;
*These scripts will be deleted upon termination of a section, preventing you from looking at them.  You can cheat and get a look at them by forcing an error in that section.  Just add &amp;quot;exit 1&amp;quot; to your spec file in the appropriate section.  Another useful thing is to &amp;quot;set; exit 1&amp;quot; in a spec file.  This will exit and spit out a list of defined environment variables.  Finally, you can place &amp;quot;bash -i&amp;quot; in a spec file to stop rpmbuild and drop to a shell where you can take a look around.&lt;br /&gt;
*Use %config(noreplace) - this will save configuration files from being replaced or over-written on update. &lt;br /&gt;
&lt;br /&gt;
===Simple SPEC===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Summary: CP Worker&lt;br /&gt;
Name: cp-worker&lt;br /&gt;
Version: 1.0&lt;br /&gt;
Release: 1&lt;br /&gt;
License: Commercial&lt;br /&gt;
BuildArch: noarch&lt;br /&gt;
Group: Applications&lt;br /&gt;
Source0: nx-thirdparty.jar&lt;br /&gt;
Source1: nx-upgrade.jar&lt;br /&gt;
Source2: log4j.properties&lt;br /&gt;
Source3: memcached.xml&lt;br /&gt;
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot&lt;br /&gt;
Requires: cp-bootstrap&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
%description&lt;br /&gt;
%{summary}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
%prep&lt;br /&gt;
#%setup -q&lt;br /&gt;
#&lt;br /&gt;
&lt;br /&gt;
%build&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
%install&lt;br /&gt;
# Clean build root&lt;br /&gt;
%{__rm} -rf %{buildroot}&lt;br /&gt;
&lt;br /&gt;
# Copy upgrade files&lt;br /&gt;
%{__mkdir} -p %{buildroot}/usr/cca/loader %{buildroot}/usr/cca/conf&lt;br /&gt;
%{__cp} -a %{SOURCE0} %{SOURCE1} %{buildroot}/usr/cca/loader&lt;br /&gt;
%{__cp} -a %{SOURCE2} %{SOURCE3} %{buildroot}/usr/cca/conf&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
%clean&lt;br /&gt;
%{__rm} -rf %{buildroot}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
%pre&lt;br /&gt;
&lt;br /&gt;
%post&lt;br /&gt;
&lt;br /&gt;
%preun&lt;br /&gt;
&lt;br /&gt;
%postun&lt;br /&gt;
&lt;br /&gt;
%files&lt;br /&gt;
%defattr(-,cca,cca)&lt;br /&gt;
%doc README docs/*&lt;br /&gt;
/usr/*&lt;br /&gt;
%config /usr/cca/conf/memcache.xml&lt;br /&gt;
%config(noreplace) /usr/cca/conf/memcache2.xml&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
%changelog&lt;br /&gt;
* Wed Jul 12 2007 Jesse Keating &amp;lt;jkeating@redhat.com&amp;gt; - 2.10.0-2&lt;br /&gt;
- item 1&lt;br /&gt;
- item 2&lt;br /&gt;
&lt;br /&gt;
* Wed Feb 12 2006 Jesse Keating &amp;lt;jkeating@redhat.com&amp;gt; - 2.10.0-1&lt;br /&gt;
- item 1&lt;br /&gt;
- item 2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Sample SPEC Files==&lt;br /&gt;
&lt;br /&gt;
===nail===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Summary: Nail&lt;br /&gt;
Name: nail&lt;br /&gt;
Version: 12.2&lt;br /&gt;
Release: 1&lt;br /&gt;
License: GPL&lt;br /&gt;
BuildArch: i386&lt;br /&gt;
Group: Applications&lt;br /&gt;
Source0: nail-12.2.tar.gz&lt;br /&gt;
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
%description&lt;br /&gt;
Nail is a replacement for the mail command.  Nail allows for attachments.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
%prep&lt;br /&gt;
%setup -q&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
%build&lt;br /&gt;
# Make nail&lt;br /&gt;
make&lt;br /&gt;
&lt;br /&gt;
%install&lt;br /&gt;
# Clean build root&lt;br /&gt;
%{__rm} -rf %{buildroot}&lt;br /&gt;
&lt;br /&gt;
# Install nail&lt;br /&gt;
make DESTDIR=%{buildroot} install&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
%clean&lt;br /&gt;
# Clean build root&lt;br /&gt;
rm -rf %{buildroot}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
%pre&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
%files&lt;br /&gt;
%defattr(-,root,root,-)&lt;br /&gt;
/etc/nail.rc&lt;br /&gt;
/usr/local/bin/nail&lt;br /&gt;
/usr/local/share/man/man1/nail.1&lt;br /&gt;
%config /etc/nail.rc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Building a RPM Tutorials===&lt;br /&gt;
IBM Packaging software with RPM:&lt;br /&gt;
*[http://www.ibm.com/developerworks/library/l-rpm1/ IBM: Packaging software with RPM, Part 1 (Using RPM on Red Hat Linux 7.1)]&lt;br /&gt;
*[http://www.ibm.com/developerworks/library/l-rpm2/ IBM: Packaging software with RPM, Part 2 (Building without root, patching software, and distributing RPMs)]&lt;br /&gt;
*[http://www-128.ibm.com/developerworks/linux/library/l-rpm3.html IBM: Packaging software with RPM, Part 3 (Running scripts at install and uninstall)]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*[http://www.redhat.com/docs/books/max-rpm/max-rpm-html/ch-rpm-build.html Building Packages: A Simple Example]&lt;br /&gt;
*[http://genetikayos.com/code/repos/rpm-tutorial/trunk/rpm-tutorial.html Building RPM Tutorial - T.R. Fullhart]&lt;br /&gt;
*[https://pmc.ucsc.edu/~dmk/notes/RPMs/Creating_RPMs.html Creating RPMs]&lt;br /&gt;
*[http://developer.novell.com/wiki/index.php/Using_Build.rpm_to_Package_an_OpenSource_Project Novell: Using Build.rpm to Package an OpenSource Project]&lt;br /&gt;
*[http://www.brandonhutchinson.com/Building_an_RPM.html Building an RPM]&lt;br /&gt;
*[http://susefaq.sourceforge.net/articles/rpm.html RPM RedHat Package Manager]&lt;br /&gt;
*[http://sipx-wiki.calivia.com/index.php/Building_RPM_tips Building RPM tips]&lt;br /&gt;
*[http://www.tldp.org/LDP/solrhe/Securing-Optimizing-Linux-RH-Edition-v1.3/chap3sec20.html How to use RPM Commands]&lt;br /&gt;
&lt;br /&gt;
===Examples===&lt;br /&gt;
*[http://tldp.org/HOWTO/Font-HOWTO/rpm.html Create RPMs of Your Fonts]&lt;br /&gt;
&lt;br /&gt;
== RPM Version ==&lt;br /&gt;
&lt;br /&gt;
Manual Dependencies - http://www.rpm.org/max-rpm-snapshot/s1-rpm-depend-manual-dependencies.html&lt;br /&gt;
:Version Requirements&lt;br /&gt;
&lt;br /&gt;
Version:&lt;br /&gt;
 Version: 0.13.1&lt;br /&gt;
 Version: 2.7&lt;br /&gt;
&lt;br /&gt;
 Requires: bar &amp;gt;= 2.7, baz = 2.1&lt;br /&gt;
&lt;br /&gt;
Version with Release:&lt;br /&gt;
 Release: 4&lt;br /&gt;
&lt;br /&gt;
 Requires: bar &amp;gt;= 2.7-4, baz = 2.1-1&lt;br /&gt;
&lt;br /&gt;
Epoch numbers:&lt;br /&gt;
 Epoch: 42&lt;br /&gt;
&lt;br /&gt;
 Requires: foo = 42:&lt;br /&gt;
 Requires: foo &amp;gt;= 42:&lt;br /&gt;
 Requires: foo &amp;gt;= 42:1.0&lt;br /&gt;
&lt;br /&gt;
Note: You must include the epoch in a requires if it exists in the package. If you think of epoch numbers as being nothing more than very simple version numbers, you&amp;#039;ll be on the mark.  Epoch is the most significant component of a package&amp;#039;s complete version identifier with regards to RPM&amp;#039;s version comparison algorithm. It might seem that using epoch numbers is a lot of extra trouble, and you&amp;#039;re right.&lt;br /&gt;
&lt;br /&gt;
== RPM HOWTO ==&lt;br /&gt;
&lt;br /&gt;
*[http://www.rpm.org/max-rpm/ Maximum RPM]&lt;br /&gt;
*&amp;lt;s&amp;gt;[http://www.rpm.org/RPM-HOWTO/ RPM HOWTO]&amp;lt;/s&amp;gt;&lt;br /&gt;
**[http://www.rpm.org/wiki/Docs RPM.org - list of documentation]&lt;br /&gt;
*[http://www.tldp.org/HOWTO/text/RPM-HOWTO RPM at Idle (Text)] [http://www.ibiblio.org/pub/Linux/docs/HOWTO/other-formats/html_single/RPM-HOWTO.html (HTML)]&lt;br /&gt;
*[http://docs.fedoraproject.org/drafts/rpm-guide-en/ Fedora RPM Guide]&lt;br /&gt;
&lt;br /&gt;
==To Read==&lt;br /&gt;
*http://www.informit.com/articles/article.asp?p=440160&amp;amp;rl=1&lt;br /&gt;
*http://www.cyberciti.biz/tips/redhat-centos-fedora-linux-setup-repo.html&lt;br /&gt;
*http://www.oracle.com/technology/tech/linux/htdocs/yum-repository-setup.html&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*http://www.redhat.com/archives/fedora-list/2005-May/msg03438.html&lt;br /&gt;
*http://www.phy.duke.edu/~rgb/General/yum_HOWTO/yum_HOWTO/yum_HOWTO-10.html&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*http://www.gurulabs.com/GURULABS-RPM-LAB/GURULABS-RPM-GUIDE-v1.0.PDF&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*http://www.ibm.com/developerworks/library/l-rpm1/&lt;br /&gt;
*https://pmc.ucsc.edu/~dmk/notes/RPMs/Creating_RPMs.html&lt;br /&gt;
*http://www.rpm.org/RPM-HOWTO/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*http://zod.freshrpms.net/rpm.html?id=118&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*http://www.google.com/search?hl=en&amp;amp;q=Hi+everybody%2C++I+developed+a+small+application+using+Java.+I+want+to+distribute+it+as+a+RPM+or+a+binary+package.+How+to+create+our+own+RPM+%2Fbinary+package+Question&amp;amp;btnG=Google+Search&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*http://www.linuxjournal.com/node/1000229&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*http://en.wikipedia.org/wiki/RPM_Package_Manager&lt;br /&gt;
*http://docs.fedoraproject.org/drafts/rpm-guide-en/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*http://www.cyberciti.biz/tips/how-to-extract-an-rpm-package-without-installing-it.html&lt;br /&gt;
*http://www.altap.cz/salam_en/features/rpm_viewer.html&lt;br /&gt;
*http://www.losurs.org/docs/tips/redhat/unpack&lt;br /&gt;
*http://www.rpm.org/max-rpm/s1-rpm-miscellania-rpm2cpio.html&lt;br /&gt;
*http://www.linux-sxs.org/housekeeping/rpmextract.html&lt;br /&gt;
*http://www.ale.org/archive/ale/ale-1999-05/msg00494.html&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*http://docs.python.org/dist/creating-rpms.html&lt;br /&gt;
*http://download1.swsoft.com/Plesk/Plesk7.5/Doc/plesk-7.5r-sdk-html/docs/plesk_modules/unix/ch11.html&lt;br /&gt;
*http://www.linuxforums.org/forum/redhat-fedora-linux-help/44921-how-create-rpm-binary-packages.html&lt;br /&gt;
*http://www.netadmintools.com/art272.html&lt;br /&gt;
*http://www.ibm.com/developerworks/library/l-rpm1/&lt;br /&gt;
*http://tldp.org/HOWTO/RPM-HOWTO/build.html&lt;br /&gt;
*http://forums.fedoraforum.org/archive/index.php/t-65432.html&lt;br /&gt;
*http://genetikayos.com/code/repos/rpm-tutorial/trunk/rpm-tutorial.html&lt;br /&gt;
*https://pmc.ucsc.edu/~dmk/notes/RPMs/Creating_RPMs.html&lt;br /&gt;
*http://sial.org/howto/yum/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*https://lists.dulug.duke.edu/pipermail/yum/2004-July/004752.html&lt;br /&gt;
*http://people.redhat.com/jkeating/fedora-release.spec&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
*[http://en.wikipedia.org/wiki/RPM_Package_Manager Wiki: RPM Package Manager]&lt;br /&gt;
&lt;br /&gt;
==Issues==&lt;br /&gt;
===error unpacking file===&lt;br /&gt;
 error: unpacking of archive failed on file /usr/java/jdk1.5.0_14/src.zip;481a3ec9: cpio: read&lt;br /&gt;
&lt;br /&gt;
The rpm is corrupted.  In this case it was the rpm in the yum cache was bad.  Clean cache and try again.&lt;br /&gt;
 yum clean all&lt;br /&gt;
 yum install [package]&lt;br /&gt;
&lt;br /&gt;
==Sample SPEC files==&lt;br /&gt;
&lt;br /&gt;
===Apache sample===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Summary: apache web server&lt;br /&gt;
Name: apache&lt;br /&gt;
Version: 2.0.54&lt;br /&gt;
Release: 1&lt;br /&gt;
License: Apache&lt;br /&gt;
Group: application&lt;br /&gt;
Source0: %{name}-%{version}.tar.gz&lt;br /&gt;
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot&lt;br /&gt;
%description&lt;br /&gt;
Apache is a great webserver&lt;br /&gt;
&lt;br /&gt;
%prep&lt;br /&gt;
%setup -q&lt;br /&gt;
&lt;br /&gt;
%build&lt;br /&gt;
./configure --prefix=/usr/local&lt;br /&gt;
make&lt;br /&gt;
make test&lt;br /&gt;
&lt;br /&gt;
%install&lt;br /&gt;
rm -rf $RPM_BUILD_ROOT&lt;br /&gt;
make root=$RPM_BUILD_ROOT install&lt;br /&gt;
&lt;br /&gt;
%clean&lt;br /&gt;
rm -rf $RPM_BUILD_ROOT&lt;br /&gt;
&lt;br /&gt;
%files&lt;br /&gt;
%defattr(-,root,root,-)&lt;br /&gt;
%doc&lt;br /&gt;
/usr/*&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Sample1===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
%define name skstream&lt;br /&gt;
%define version 0.2.2&lt;br /&gt;
%define release 1&lt;br /&gt;
&lt;br /&gt;
Summary: Portable C++ classes for IP(sockets) applications.&lt;br /&gt;
Name: %{name}&lt;br /&gt;
Version: %{version}&lt;br /&gt;
Release: %{release}&lt;br /&gt;
Source: ftp://ftp.worldforge.org/pub/worldforge/libs/%{name}-%{version}.tar.gz&lt;br /&gt;
Vendor: The WorldForge Project&lt;br /&gt;
URL: http://www.worldforge.org/&lt;br /&gt;
License: LGPL&lt;br /&gt;
Group: System Environment/Libraries&lt;br /&gt;
Prefix: %{_prefix}&lt;br /&gt;
&lt;br /&gt;
%description&lt;br /&gt;
This library contains C++ utility classes for using IP(sockets).&lt;br /&gt;
&lt;br /&gt;
%package devel&lt;br /&gt;
Summary: Libraries, includes to develop applications with %{name}.&lt;br /&gt;
Group: Development/Libraries&lt;br /&gt;
Requires: %{name} = %{version}&lt;br /&gt;
&lt;br /&gt;
%description devel&lt;br /&gt;
The %{name}-devel package contains the header files and static libraries for&lt;br /&gt;
building applications which use %{name}.&lt;br /&gt;
&lt;br /&gt;
%prep&lt;br /&gt;
%setup -q&lt;br /&gt;
&lt;br /&gt;
%build&lt;br /&gt;
if [ -x ./configure ]; then&lt;br /&gt;
  CFLAGS=&amp;quot;$RPM_OPT_FLAGS&amp;quot; ./configure --prefix=%{_prefix}&lt;br /&gt;
else&lt;br /&gt;
  CFLAGS=&amp;quot;$RPM_OPT_FLAGS&amp;quot; ./autogen.sh --prefix=%{_prefix}&lt;br /&gt;
fi&lt;br /&gt;
make&lt;br /&gt;
&lt;br /&gt;
%install&lt;br /&gt;
rm -rf $RPM_BUILD_ROOT&lt;br /&gt;
make DESTDIR=$RPM_BUILD_ROOT install&lt;br /&gt;
&lt;br /&gt;
%clean&lt;br /&gt;
rm -rf $RPM_BUILD_ROOT&lt;br /&gt;
&lt;br /&gt;
%post -p /sbin/ldconfig&lt;br /&gt;
&lt;br /&gt;
%postun -p /sbin/ldconfig&lt;br /&gt;
&lt;br /&gt;
%files&lt;br /&gt;
%defattr(-,root,root)&lt;br /&gt;
%doc AUTHORS ChangeLog COPYING INSTALL NEWS README TODO&lt;br /&gt;
%{_prefix}/lib/lib*.so.*&lt;br /&gt;
&lt;br /&gt;
%files devel&lt;br /&gt;
%defattr(-,root,root)&lt;br /&gt;
%doc AUTHORS ChangeLog COPYING INSTALL NEWS README TODO&lt;br /&gt;
%{_prefix}/bin/*-config&lt;br /&gt;
%{_prefix}/lib/lib*.a&lt;br /&gt;
%{_prefix}/lib/lib*.so&lt;br /&gt;
%{_prefix}/include/*&lt;br /&gt;
%{_prefix}/share/aclocal/*&lt;br /&gt;
&lt;br /&gt;
%changelog&lt;br /&gt;
* Thu Mar 7 2002 T.R. Fullhart &amp;lt;kayos@kayos.org&amp;gt;&lt;br /&gt;
- First draft of the spec file&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===[http://tldp.org/HOWTO/Font-HOWTO/rpm.html Font RPM Example]===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Name: myfonts&lt;br /&gt;
Summary: Collection of My Funny Fonts&lt;br /&gt;
Version: 1.0&lt;br /&gt;
Release: 1&lt;br /&gt;
License: GPL&lt;br /&gt;
Group: User Interface/X&lt;br /&gt;
Source: %{name}.tar.gz&lt;br /&gt;
BuildRoot: %{_tmppath}/build-root-%{name}&lt;br /&gt;
BuildArch: noarch&lt;br /&gt;
Requires: freetype&lt;br /&gt;
Packager: Avi Alkalay &amp;lt;avi@unix.sh&amp;gt;&lt;br /&gt;
Prefix: /usr/share/fonts&lt;br /&gt;
Url: http://myfonts.com/&lt;br /&gt;
&lt;br /&gt;
%description&lt;br /&gt;
These are the fonts used in our marketing campaign, designed by our marketing agency specially for us.&lt;br /&gt;
The package includes the following fonts: Bodoni, Bodoni Black, Company Logo, Outline Company Logo, etc.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
%prep&lt;br /&gt;
&lt;br /&gt;
%setup -q -n %{name}&lt;br /&gt;
&lt;br /&gt;
%build&lt;br /&gt;
&lt;br /&gt;
%install&lt;br /&gt;
mkdir -p $RPM_BUILD_ROOT/%{prefix}&lt;br /&gt;
cp -r %{name}/ $RPM_BUILD_ROOT/%{prefix}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
%clean&lt;br /&gt;
rm -rf $RPM_BUILD_ROOT&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
%files&lt;br /&gt;
%defattr(-,root,root,0755)&lt;br /&gt;
%{prefix}/%{name}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
%post&lt;br /&gt;
{&lt;br /&gt;
	ttmkfdir -d %{prefix}/%{name} \&lt;br /&gt;
		-o %{prefix}/%{name}/fonts.scale&lt;br /&gt;
	umask 133&lt;br /&gt;
	/usr/X11R6/bin/mkfontdir %{prefix}/%{name}&lt;br /&gt;
	/usr/sbin/chkfontpath -q -a %{prefix}/%{name}&lt;br /&gt;
	[ -x /usr/bin/fc-cache ] &amp;amp;&amp;amp; /usr/bin/fc-cache&lt;br /&gt;
} &amp;amp;&amp;gt; /dev/null || :&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
%preun&lt;br /&gt;
{&lt;br /&gt;
	if [ &amp;quot;$1&amp;quot; = &amp;quot;0&amp;quot; ]; then&lt;br /&gt;
		cd %{prefix}/%{name}&lt;br /&gt;
		rm -f fonts.dir fonts.scale fonts.cache*&lt;br /&gt;
	fi&lt;br /&gt;
} &amp;amp;&amp;gt; /dev/null || :&lt;br /&gt;
&lt;br /&gt;
%postun&lt;br /&gt;
if [ &amp;quot;$1&amp;quot; = &amp;quot;0&amp;quot; ]; then&lt;br /&gt;
  /usr/sbin/chkfontpath -q -r %{prefix}/%{name}&lt;br /&gt;
fi&lt;br /&gt;
[ -x /usr/bin/fc-cache ] &amp;amp;&amp;amp; /usr/bin/fc-cache&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
%changelog&lt;br /&gt;
* Thu Dec 14 2002 Avi Alkalay &amp;lt;avi@unix.sh&amp;gt; 1.0&lt;br /&gt;
- Tested&lt;br /&gt;
- Ready for deployment&lt;br /&gt;
* Thu Dec 10 2002 Avi Alkalay &amp;lt;avi@unix.sh&amp;gt; 0.9&lt;br /&gt;
- First version of the template&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===freshrpm-release===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# $Id: freshrpms-release.spec 3341 2005-06-28 18:40:26Z thias $&lt;br /&gt;
# Authority: matthias&lt;br /&gt;
&lt;br /&gt;
Summary: Freshrpms.net release file and package configuration&lt;br /&gt;
Name: freshrpms-release&lt;br /&gt;
Version: 1.1&lt;br /&gt;
Release: 1.fc&lt;br /&gt;
License: GPL&lt;br /&gt;
Group: System Environment/Base&lt;br /&gt;
Source0: GPL&lt;br /&gt;
Source1: RPM-GPG-KEY-freshrpms&lt;br /&gt;
Source2: freshrpms.repo&lt;br /&gt;
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root&lt;br /&gt;
BuildArch: noarch&lt;br /&gt;
&lt;br /&gt;
%description&lt;br /&gt;
Freshrpms.net release file. This package also contains yum configuration to&lt;br /&gt;
use the freshrpms.net provided rpm packages, as well as the public gpg key&lt;br /&gt;
used to sign them.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
%prep&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
%build&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
%install&lt;br /&gt;
%{__rm} -rf %{buildroot}&lt;br /&gt;
# Install license to be included in the docs and gpg key as pubkey&lt;br /&gt;
%{__cp} -a %{SOURCE0} %{SOURCE1} .&lt;br /&gt;
# Install gpg public key&lt;br /&gt;
%{__install} -D -p -m 0644 %{SOURCE1} \&lt;br /&gt;
    %{buildroot}%{_sysconfdir}/pki/rpm-gpg/RPM-GPG-KEY-freshrpms&lt;br /&gt;
# Install yum repo file&lt;br /&gt;
%{__install} -D -p -m 0644 %{SOURCE2} \&lt;br /&gt;
    %{buildroot}%{_sysconfdir}/yum.repos.d/freshrpms.repo&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
%clean&lt;br /&gt;
%{__rm} -rf %{buildroot}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
%post&lt;br /&gt;
# Import Freshrpms.net gpg key if needed&lt;br /&gt;
rpm -q gpg-pubkey-e42d547b-3960bdf1 &amp;gt;/dev/null 2&amp;gt;&amp;amp;1 || \&lt;br /&gt;
    rpm --import %{_sysconfdir}/pki/rpm-gpg/RPM-GPG-KEY-freshrpms&lt;br /&gt;
# We don&amp;#039;t want a possible error to leave the previous package installed&lt;br /&gt;
exit 0&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
%files&lt;br /&gt;
%defattr(-, root, root, 0755)&lt;br /&gt;
%doc GPL&lt;br /&gt;
%pubkey RPM-GPG-KEY-freshrpms&lt;br /&gt;
%{_sysconfdir}/pki/rpm-gpg/RPM-GPG-KEY-freshrpms&lt;br /&gt;
%config(noreplace) %{_sysconfdir}/yum.repos.d/freshrpms.repo&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
%changelog&lt;br /&gt;
* Tue Jun 28 2005 Matthias Saou &amp;lt;http://freshrpms.net/&amp;gt; 1.1-1&lt;br /&gt;
- Put gpg public key in /etc/pki/rpm-gpg and add gpgkey line to yum file.&lt;br /&gt;
&lt;br /&gt;
* Wed Nov 10 2004 Matthias Saou &amp;lt;http://freshrpms.net/&amp;gt; 1-1&lt;br /&gt;
- Initial RPM release, inspired by fedora-release.&lt;br /&gt;
- No /etc/freshrpms-release (for now at least), as it&amp;#039;s basically useless :-)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==apache scripts==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[build@build rpm]$ rpm -q --scripts httpd&lt;br /&gt;
&lt;br /&gt;
preinstall scriptlet (using /bin/sh):&lt;br /&gt;
# Add the &amp;quot;apache&amp;quot; user&lt;br /&gt;
/usr/sbin/useradd -c &amp;quot;Apache&amp;quot; -u 48 \&lt;br /&gt;
        -s /sbin/nologin -r -d /var/www apache 2&amp;gt; /dev/null || :&lt;br /&gt;
&lt;br /&gt;
postinstall scriptlet (using /bin/sh):&lt;br /&gt;
# Register the httpd service&lt;br /&gt;
/sbin/chkconfig --add httpd&lt;br /&gt;
&lt;br /&gt;
preuninstall scriptlet (using /bin/sh):&lt;br /&gt;
if [ $1 = 0 ]; then&lt;br /&gt;
        /sbin/service httpd stop &amp;gt; /dev/null 2&amp;gt;&amp;amp;1&lt;br /&gt;
        /sbin/chkconfig --del httpd&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Verify System Packages ==&lt;br /&gt;
&lt;br /&gt;
Crackers frequently hack system utilities to hide their presence&lt;br /&gt;
on the system, particularly things like /bin/ps, /bin/login,&lt;br /&gt;
/bin/netstat (pretty much anything in the /bin, /usr/bin, /sbin,&lt;br /&gt;
and /usr/sbin directories).  For a quick list of rpm packages&lt;br /&gt;
that might be affected you can do:&lt;br /&gt;
&lt;br /&gt;
 rpm -qf /bin/* /sbin/* | sort -u &amp;gt; /tmp/critpackages&lt;br /&gt;
&lt;br /&gt;
Then a quick check for changed files.  This doesn&amp;#039;t show the&lt;br /&gt;
package names, but that&amp;#039;s easy to find with ``rpm -qf fname&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
 rpm -V `cat /tmp/critpackages`&lt;br /&gt;
&lt;br /&gt;
Source: [http://lists.centos.org/pipermail/centos/2008-December/069596.html CentOS - OT: Ping failed (SOLVED)]&lt;br /&gt;
&lt;br /&gt;
== Check Dependencies ==&lt;br /&gt;
&lt;br /&gt;
rpmcheck.pl:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/perl&lt;br /&gt;
&lt;br /&gt;
use strict;&lt;br /&gt;
use warnings;&lt;br /&gt;
&lt;br /&gt;
my $result=0;&lt;br /&gt;
my @packagelist=`rpm -qa --queryformat &amp;quot;%{NAME}-%{VERSION}.%{RELEASE} (%{ARCH})\n&amp;quot; | sort`;&lt;br /&gt;
&lt;br /&gt;
PACKAGES:&lt;br /&gt;
foreach my $package (&amp;lt;DATA&amp;gt;) {&lt;br /&gt;
  foreach my $item (@packagelist) {&lt;br /&gt;
    next PACKAGES if ( &amp;quot;$package&amp;quot; eq &amp;quot;$item&amp;quot; );&lt;br /&gt;
  }&lt;br /&gt;
  print &amp;quot;Package missing: $package&amp;quot;;&lt;br /&gt;
  $result=1;&lt;br /&gt;
}&lt;br /&gt;
exit $result;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__DATA__&lt;br /&gt;
binutils-2.17.50.0.6.9.el5 (x86_64)&lt;br /&gt;
compat-db-4.2.52.5.1 (i386)&lt;br /&gt;
compat-db-4.2.52.5.1 (x86_64)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
simplerpmcheck.pl:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/perl&lt;br /&gt;
&lt;br /&gt;
use strict;&lt;br /&gt;
use warnings;&lt;br /&gt;
&lt;br /&gt;
my $result=0;&lt;br /&gt;
my @packagelist=`rpm -qa --queryformat &amp;quot;%{NAME}\n&amp;quot;`;&lt;br /&gt;
&lt;br /&gt;
PACKAGES:&lt;br /&gt;
foreach my $package (&amp;lt;DATA&amp;gt;) {&lt;br /&gt;
  foreach my $item (@packagelist) {&lt;br /&gt;
    next PACKAGES if ( &amp;quot;$package&amp;quot; eq &amp;quot;$item&amp;quot; );&lt;br /&gt;
  }&lt;br /&gt;
  print &amp;quot;Package missing: $package&amp;quot;;&lt;br /&gt;
  $result=1;&lt;br /&gt;
}&lt;br /&gt;
exit $result;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__DATA__&lt;br /&gt;
compat-libstdc++-33&lt;br /&gt;
elfutils-libelf&lt;br /&gt;
elfutils-libelf-devel&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Issues ==&lt;br /&gt;
&lt;br /&gt;
=== Error: rpmdb open failed ===&lt;br /&gt;
&lt;br /&gt;
Error:&lt;br /&gt;
 Error: rpmdb open failed&lt;br /&gt;
&lt;br /&gt;
Solution: [http://linuxhostingsupport.net/blog/yum-update-error-rpmdb-open-failed]&lt;br /&gt;
 yum clean all&lt;br /&gt;
 rm -f /var/lib/rpm/__db*&lt;br /&gt;
 rpm --rebuilddb&lt;br /&gt;
 yum update&lt;br /&gt;
&lt;br /&gt;
=== error: cannot open Packages database ===&lt;br /&gt;
&lt;br /&gt;
Error:&lt;br /&gt;
 error: cannot open Packages database in /var/lib/rpm&lt;br /&gt;
&lt;br /&gt;
Solution: [http://linuxhostingsupport.net/blog/yum-update-error-rpmdb-open-failed]&lt;br /&gt;
 yum clean all&lt;br /&gt;
 rm -f /var/lib/rpm/__db*&lt;br /&gt;
 rpm --rebuilddb&lt;br /&gt;
 yum update&lt;br /&gt;
&lt;br /&gt;
== keywords ==&lt;br /&gt;
&lt;br /&gt;
[[Category:Linux]]&lt;/div&gt;</summary>
		<author><name>Kenneth</name></author>
	</entry>
</feed>