Find the answer to your Linux question:
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 11
I have been reading up on how to make redhat RPMs. So far, I get them, but for what I am trying to do, I am not sure if it ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Apr 2014
    Posts
    10

    Redhat RPMs


    I have been reading up on how to make redhat RPMs. So far, I get them, but for what I am trying to do, I am not sure if it will work. I have used rpmbuild command to include one file. It does not have to compiled, that is, go through the %prep, %build, and %install stages. Once the package is built, I want to install it onto another system so that the file in the rpm package will overwrite the one on the system, i.e., update it. It should be noted that the system that the rpm is being installed on has software that was not originally installed using an RPM, so I do not think an rpm -u command will work. I am really confused, because I don't think an RPM can be used in this way, but my superiors say it can be. Thoughts?

  2. #2
    Trusted Penguin Irithori's Avatar
    Join Date
    May 2009
    Location
    Munich
    Posts
    3,398
    It can.
    The file in the rpm will overwrite the existing one in the filesystem.
    -u (update) will also work. Because this refers to packages not existing files.
    And as there is no previous package, "update" just tells the rpm system to not deinstall a previous package before installing the new one.

    One noteable exceptions are config files.
    If a file is marked as a configfile, then a rpm install will not overwrite an existing one.
    Directives For the %files list

    The rationale behind this behaviour:
    A package should provide a working default config but not undo a production config.
    Think: A apache server installation.
    You must always face the curtain with a bow.

  3. #3
    Linux Engineer
    Join Date
    Dec 2013
    Posts
    1,374
    If it wasn't originally installed from an RPM (or by extension yum) rpm -U isn't going to work. There won't be an entry in the RPM database for the -e option. You'll have to install then manually remove the old version.

    *I just read Irithori's post and agree with it. Upgrade won't fail but won't do the cleanup.

  4. #4
    Just Joined!
    Join Date
    Apr 2014
    Posts
    10
    I want to make sure that I am getting this right: The file that I want to include must be in the SOURCES file? Then once the rpm package is built, all I have to do is rpm -U package-name.rpm?

  5. #5
    Linux Engineer
    Join Date
    Dec 2013
    Posts
    1,374
    Here's a really simple example for creating binary rpm's: LOSURS :: Documentation :: The Trick to Creating RPM's from Binaries Directly

    The link Irithori has provided is an excellent one.

  6. #6
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    11,639
    You create an rpm with rpmbuild, and that requires a proper rpm .spec file, plus some pre-create work to put the files you want in the rpm in the proper places in ~/rpmbuild so it can create the rpm for you properly. Unfortunately, the available documentation is not really great - it has taken me about a year to get semi-competent in doing this. My wife is an expert, and when I asked her where there was some good documentation on this process, she just laughed and went back to her ipad game...

    That said, there IS documentation on the web, from Red Hat and others, which helps, but no "RPM building for Dummies". As I said, after a year of effort, I have 1/2 of a clue.

    Maybe I can write a "Building RPM's for Dummies, by One" book!

    All of that aside, you can extract the .spec file from an rpm, and there are a lot of them on the net that you can download and learn from. Just be patient!
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  7. #7
    Just Joined!
    Join Date
    Apr 2014
    Posts
    10
    Does anyone know where an RPM package is installed by default using the rpm -i command?

  8. #8
    Trusted Penguin Irithori's Avatar
    Join Date
    May 2009
    Location
    Munich
    Posts
    3,398
    The content of an rpm is potentially installed anywhere in the filesystem tree.
    Or the other way around, the file/directory destinations get defined in the spec file.

    You can list the contents of a rpm via
    Code:
    rpm -qpl <RPM_PACKAGE>
    and see where the files/directories would be if the package would be installed.
    You must always face the curtain with a bow.

  9. #9
    Just Joined!
    Join Date
    Apr 2014
    Posts
    10
    Where does the rpm -i command install rpm packages? I have been trying to find where this command deploys files but to no avail. When I tried the above command, I got the my tar.gz file and spec file, which was test.spec. I did not see any indication of where they might be installed. Maybe I have to specify this in the spec file itself?

  10. #10
    Trusted Penguin Irithori's Avatar
    Join Date
    May 2009
    Location
    Munich
    Posts
    3,398
    tar.gz and spec?
    Did you run rpm -qpl against a source rpm?

    On a binary rpm, it should list you where the files/dirs will be after install.
    You can also use rpm -ql against already installed packages.
    e.g.:
    Code:
    # rpm -ql ntp
    /etc/dhcp/dhclient.d
    /etc/dhcp/dhclient.d/ntp.sh
    /etc/ntp.conf
    /etc/ntp/crypto
    /etc/ntp/crypto/pw
    /etc/rc.d/init.d/ntpd
    /etc/sysconfig/ntpd
    /usr/bin/ntpstat
    /usr/sbin/ntp-keygen
    /usr/sbin/ntpd
    /usr/sbin/ntpdc
    /usr/sbin/ntpq
    /usr/sbin/ntptime
    /usr/sbin/tickadj
    /usr/share/doc/ntp-4.2.6p5
    /usr/share/doc/ntp-4.2.6p5/COPYRIGHT
    /usr/share/doc/ntp-4.2.6p5/ChangeLog
    /usr/share/doc/ntp-4.2.6p5/NEWS
    /usr/share/man/man5/ntp.conf.5.gz
    /usr/share/man/man5/ntp_acc.5.gz
    /usr/share/man/man5/ntp_auth.5.gz
    /usr/share/man/man5/ntp_clock.5.gz
    /usr/share/man/man5/ntp_decode.5.gz
    /usr/share/man/man5/ntp_misc.5.gz
    /usr/share/man/man5/ntp_mon.5.gz
    /usr/share/man/man8/ntp-keygen.8.gz
    /usr/share/man/man8/ntpd.8.gz
    /usr/share/man/man8/ntpdc.8.gz
    /usr/share/man/man8/ntpq.8.gz
    /usr/share/man/man8/ntpstat.8.gz
    /usr/share/man/man8/ntptime.8.gz
    /usr/share/man/man8/tickadj.8.gz
    /var/lib/ntp
    /var/lib/ntp/drift
    /var/log/ntpstats
    You must always face the curtain with a bow.

Page 1 of 2 1 2 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •