Installing src.rpm files

So I’m a bit of a Linux n00b. I can find my way around the system, but I don’t have vast expanses of knowledge regarding how to use it properly like a normal Computer Scientist should. So Google normally helps me out when I’m trying to do bits of server admin at work. Unfortunately, this is one thing I always forget how to do, and I’ve found there are few decent resources on how to actually do this. So here’s one! It’s probably more for my own purpose than for anyone else, but maybe someone will find it useful.

Let’s say you’re trying to install a package, you’ve got the web address to the package and it’s a .src.rpm. You’ll want to do something like this:

  • Navigate to a directory that you can use to temporarily store the src file
  • Copy the address of the package to your clipboard
  • Type: wget URL_TO_PACKAGE, obviously replacing the URL_TO_PACKAGE with the address you copied a minute ago
  • Now in the directory you’ll a file called something.src.rpm. You’ll need root access for the rest of this – sudo or su will do fine.
  • Type: rpm -ivh something.src.rpm
  • This will have put a load of stuff under the /usr/src/redhat directories, where you’ll find folders called RPMS, SPECS, SOURCES, and BUILD. Go into the SPECS folder. You’ll see a file called something.spec
  • Type: rpmbuild -bb something.spec
  • This will produce a load of stuff on the terminal, and will have created the RPM in a subdirectory of the RPMS folder. If you look in there, you’ll see that there are different folders for the different architectures, i386, noarch etc. In the babble the last command (rpmbuild -bb) produced, it will tell you where it’s put the RPM. The line might look something like this: Wrote: /usr/src/redhat/RPMS/noarch/yum-2.4.3-1.noarch.rpm
  • Go into this folder – in this case RPMS/noarch. You’ll see something.rpm – which will relate to the one you just built. Type: rpm -ivh something.rpm, and the package will be installed!

And there we go! I would suggest however, this should be a final resort, especially for new comers to Linux. A much better solution is to use yum or apt, which do all the hard work for you. For example, using yum to install subversion, you do this as root: yum install subversion. How easy is that?

Comments ( 0 )

    Leave A Comment

    Your email address will not be published. Required fields are marked *