TEXT   72

rpm change path

Guest on 1st June 2022 01:49:47 PM

  1. Install the RPM package to the specified directory
  3. How to install an RPM package to a different directory?
  4. Solution:
  5. Not all RPM packages can be installed to another directory. An RPM package that can be installed into a different directory is relocatable. To check if a package can be relocated, use this command:
  7. rpm -qpi rpm-package | head -1
  9. For example, these two packages: redhat-lsb-1.3-3.1.EL3.i386.rpm and rsync-2.5.7-5.3E.i386.rpm
  10. # rpm -qpi redhat-lsb-1.3-3.1.EL3.i386.rpm | head -1
  11. Name : redhat-lsb Relocations: (not relocatable)
  12. # rpm -qpi rsync-2.5.7-5.3E.i386.rpm | head -1
  13. Name : rsync Relocations: /usr
  15. It can be seen that the redhat-lsb package cannot be relocated, but the rsync package can. This means that you can install the rsync package to a different directory, such as /opt, using the rpm option --prefix, like this:
  17. rpm -ivh --prefix=/opt rsync-2.5.7-5.3E.i386.rpm
  19. To verify that it was actually installed to /opt, use the command rpm -ql rsync. Here is an example output:
  21. # rpm -ql rsync
  22. /etc/xinetd.d/rsync
  23. /opt/bin/rsync
  24. /opt/share/doc/rsync-2.5.7
  25. /opt/share/doc/rsync-2.5.7/COPYING
  26. /opt/share/doc/rsync-2.5.7/README
  27. /opt/share/doc/rsync-2.5.7/tech_report.tex
  28. /opt/share/man/man1/rsync.1.gz
  29. /opt/share/man/man5/rsyncd.conf.5.gz
  31. Now, if I do this with redhat-lsb, I get an error message:
  33. # rpm -ivh --prefix=/opt redhat-lsb-1.3-3.1.EL3.i386.rpm
  34. error: package redhat-lsb is not relocatable

Raw Paste

Login or Register to edit or fork this paste. It's free.