RPMs - The HOWTO Short Story
If you like the latest and greatest version of everything and you use an RPM based system you probably want to learn how to create RPMs. You don't have to, you can just download the latest source and compile and install it in /usr/local. This of course leaves your system in a state where your RPM database does not accurately reflect what is installed on your system. Again, this will work, but building RPMs isn't (usually at least) that difficult.
First create some directories in your home directory:
$ mkdir ~/rpm $ mkdir -p ~/rpm/SOURCES $ mkdir -p ~/rpm/SPECS $ mkdir -p ~/rpm/BUILD $ mkdir -p ~/rpm/SRPMS $ mkdir -p ~/rpm/RPMS
Next create an RPM macros file in your home directory:
$ echo "%_topdir $HOME/rpm" > $HOME/.rpmmacros
Now, get the source RPM for the program you want to upgrade. This is often the step that seems like a roadblock because if you can find the source RPM for your distro then you can usually get the compiled RPM and so there'd be no need to build it. So really this step is: create the source RPM for the program. The easy way to do this is to get the source RPM for the version that you have installed and modify it:
- Download the source RPM for the version you have installed or the latest version that you can find for your distro. Let's say you have version 2.3.4-55 of abc on your system, so find and download abc-2.3.4-55.src.rpm.
- Download the source code for the new version of the program. So goto abc.org and download abc-2.4.1.tar.gz and save it to ~/rpm/SOURCES.
- Install the source RPM (as a regular user):
$ rpm -i abc-2.3.4-55.src.rpm
This should create a file ~/rpm/SPECS/abc.spec - Edit the spec file and change the old version information to the new version. There may be a few places that need changing, so take a second to examine the file and find all the places that you need to change. You may want to change the "Release" value to something "special," say 2001, so that you'll recognize it as one of yours in the future. You may also want to put a comment in the changelog section of the spec file.
- Build the RPM:
$ cd ~/rpm/SPECS $ rpmbuild -ba abc.spec
If you have all the required tools and dependencies installed, and if luck is with you this will create RPM files in ~/RPMS/i586 or ~/RPMS/x86_64 (or something appropriate for you architecture). - Install the newly created RPM:
$ sudo rpm -U ~/RPMS/i586/abc-2.4.1-2001.i586.rpm
One of the things that may give you problems are patch files. RPMs can automatically apply patches during the build process, often when upgrading to a new version some of the patches are already included in the new source distribution and so the build tries to install them again. To fix this, edit the spec file and remove the application of the patch.
If you're trying to install a program that isn't included in your distro (or the version you're currently running) you can try using a spec file from another distro or a spec file from a newer version of your distro, but this often doesn't work without a lot of spec file modification. Distros have different builtin RPM macros and assume different locations for certain things and so the spec files often need tweaking. This can even be true between different versions of the same distro, things can get rearranged and break compatibility.
With this in hand you can keep your system and your RPM database in sync, and if you can't well at least you're still running Linux.
Mitch Frazier is an Associate Editor for Linux Journal.
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Sponsored by AMD
Built-in forensics, incident response, and security with Red Hat Enterprise Linux 6
Every security policy provides guidance and requirements for ensuring adequate protection of information and data, as well as high-level technical and administrative security requirements for a system in a given environment. Traditionally, providing security for a system focuses on the confidentiality of the information on it. However, protecting the data integrity and system and data availability is just as important. For example, when processing United States intelligence information, there are three attributes that require protection: confidentiality, integrity, and availability.
Learn more about catching the bad guy in this free white paper.
Sponsored by DLT Solutions
| Designing Electronics with Linux | May 22, 2013 |
| Dynamic DNS—an Object Lesson in Problem Solving | May 21, 2013 |
| Using Salt Stack and Vagrant for Drupal Development | May 20, 2013 |
| Making Linux and Android Get Along (It's Not as Hard as It Sounds) | May 16, 2013 |
| Drupal Is a Framework: Why Everyone Needs to Understand This | May 15, 2013 |
| Home, My Backup Data Center | May 13, 2013 |
- I once had a better way I
3 hours 13 min ago - Not only you I too assumed
3 hours 31 min ago - another very interesting
5 hours 24 min ago - Reply to comment | Linux Journal
7 hours 17 min ago - Reply to comment | Linux Journal
14 hours 11 min ago - Reply to comment | Linux Journal
14 hours 27 min ago - Favorite (and easily brute-forced) pw's
16 hours 18 min ago - Have you tried Boxen? It's a
22 hours 10 min ago - seo services in india
1 day 2 hours ago - For KDE install kio-mtp
1 day 2 hours ago
Enter to Win an Adafruit Pi Cobbler Breakout Kit for Raspberry Pi

It's Raspberry Pi month at Linux Journal. Each week in May, Adafruit will be giving away a Pi-related prize to a lucky, randomly drawn LJ reader. Winners will be announced weekly.
Fill out the fields below to enter to win this week's prize-- a Pi Cobbler Breakout Kit for Raspberry Pi.
Congratulations to our winners so far:
- 5-8-13, Pi Starter Pack: Jack Davis
- 5-15-13, Pi Model B 512MB RAM: Patrick Dunn
- 5-21-13, Prototyping Pi Plate Kit: Philip Kirby
- Next winner announced on 5-27-13!
Featured Jobs
| Linux Systems Administrator | Houston and Austin, Texas | Host Gator |
| Senior Perl Developer | Austin, Texas | Host Gator |
| Technical Support Rep | Houston and Austin, Texas | Host Gator |
| UX Designer | Austin, Texas | Host Gator |
| Web & UI Developer (JavaScript & j Query) | Austin, Texas | Host Gator |
Free Webinar: Hadoop
How to Build an Optimal Hadoop Cluster to Store and Maintain Unlimited Amounts of Data Using Microservers
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Some of key questions to be discussed are:
- What is the “typical” Hadoop cluster and what should be installed on the different machine types?
- Why should you consider the typical workload patterns when making your hardware decisions?
- Are all microservers created equal for Hadoop deployments?
- How do I plan for expansion if I require more compute, memory, storage or networking?



Comments
Building Packages in Fedora
http://fedoraproject.org/wiki/Docs/Drafts/BuildingPackagesGuide