0

The RHEL source code RPM package is installed in ~/rpmbuild by default. I want use --prefix option to change the installed directory:

[root@nan nan]# rpm -ivvh --prefix=/home/nan kernel-3.10.0-290.el7.src.rpm
D: ============== kernel-3.10.0-290.el7.src.rpm
D: loading keyring from pubkeys in /var/lib/rpm/pubkeys/*.key
D: couldn't find any keys in /var/lib/rpm/pubkeys/*.key
D: loading keyring from rpmdb
D: opening  db environment /var/lib/rpm cdb:0x401
D: opening  db index       /var/lib/rpm/Packages 0x400 mode=0x0
D: locked   db index       /var/lib/rpm/Packages
D: opening  db index       /var/lib/rpm/Name 0x400 mode=0x0
D: Expected size:     82747446 = lead(96)+sigs(180)+pad(4)+data(82747166)
D:   Actual size:     82747446
D: kernel-3.10.0-290.el7.src.rpm: Header SHA1 digest: OK (96b97dc2dc445b69a5337a0df2c51aad0ec90e10)
D:      added source package [0]
D: found 1 source and 0 binary packages
D: Expected size:     82747446 = lead(96)+sigs(180)+pad(4)+data(82747166)
D:   Actual size:     82747446
D: kernel-3.10.0-290.el7.src.rpm: Header SHA1 digest: OK (96b97dc2dc445b69a5337a0df2c51aad0ec90e10)
Updating / installing...
   1:kernel-3.10.0-290.el7            ################################# [100%]
D: ========== Directories not explicitly included in package:
D:          0 /root/rpmbuild/SOURCES/
D:          1 /root/rpmbuild/SPECS/
D: ==========
......

The source code is still installed in ~/rpmbuild directory. How can I change the installed directory?

0

--prefix works only with relocatable packages, to change destination directory for binary files

In your case, you should use --buildroot parameter instead.

  • It doesn't work: rpm: --buildroot=/home/nan: unknown option. – Nan Xiao Jul 24 '15 at 10:23
  • It should work when used with one of --bX parameters, check this link for the details: rpm.org/max-rpm/rpm.8.html – Tomasz Klim Jul 24 '15 at 10:30
  • What is the meaning of --bX? Thanks! – Nan Xiao Jul 24 '15 at 10:33
  • Sorry, -bX, not --bX - and this means -bs, -ba etc. as explained in the below link. – Tomasz Klim Jul 24 '15 at 10:39
  • Thanks very much for your help! But RPM in my RHEL7 doesn't have --buildroot nor -bX options. Its options are here:https://gist.github.com/NanXiao/3cc7283c7eba05f2cedb. – Nan Xiao Jul 27 '15 at 1:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.