How can I install in a different directory with my RPM file?
Paul Johnson
pauljohn32 at gmail.com
Thu Jul 21 17:35:02 UTC 2011
On Wed, Jul 20, 2011 at 4:03 AM, kali c <direct2kali at gmail.com> wrote:
> Hi,
> I have created a SPEC file that contains the lines,
> %files
> /usr/bin/myFile1
> /usr/bin/myFile2
> And I can build the SPEC file without any errors. But after installing the
> RPM package through "yum", the files reside as such specified in the files
> section.
> By that I mean, myFile1 resides in /usr/bin and myFile2 resides in /usr/bin,
> rightly so.
> But if while installing can i specify some path, so that it resides in the
> specified directory.
> Say can I specify a directory /disk1/myFolder so that the installed files
> will be like, /disk1/myFolder/myFile1 and so..
> How can I specify a user defined directory while installing it and what
> changes I have to make in the SPEC file to achieve that?
> --
> Regards,
> Kali
>
I do not believe this can be done to packages through yum.
But, if you look at the RPM packages and interact with them through
the rpm program, it is very doable. We used to have to do it all the
time. I'm in a Debian system right now so I can't run a demo for you,
but "man rpm" will tell you what you need. But if you google "rpm
relocate prefix" you will find help
http://www.rpm.org/max-rpm/ch-rpm-install.html
suggestion "rpm -i some.rpm --relocate /usr/local=/usr" will try to
relocate files that should be installed in
/usr/local(/bin,/lib,/etc,/etc) to /usr(/bin,/lib,/etc,/etc).
This is one of the few cases where doing rpm -i is different from rpm
-U to install. If you do -U, it will remove the old and install the
new. If you do -i, it will allow you to install 2 versions of package
with same name, as long as locations of installed files don't
conflict.
Some programs are not relocatable, of course, but most of the ordinary
things that you run, especially ones just installed in /usr/bin, will
probably work. If you end up installing shared libraries in someplace
besides /usr/lib.. etc (or other places listed in /etc/ld.so.conf)
then you have to manually set the LD_LIBRARY_PATH.
pj
--
Paul E. Johnson
Professor, Political Science
1541 Lilac Lane, Room 504
University of Kansas
More information about the Rpm-list
mailing list