yum update, how to make rpm package updateable
Solution 1
The only thing you need to do to make it work is make sure the version number or release number for the same version in the .spec file is higher then the current version installed. Then when added to your repo and a createrepo
is run yum will pick it up and update
Solution 2
The answer is not as simple as sticking an RPM with a newer revision in the repo.
There are things to be done on the server side and on the client side.
Server Side
- Copy RPM to repo
- cd /path/to/repo (let's assume /var/www/html/repo)
sudo createrepo --update .
This will update the repo's database to include the new RPMsudo chmod -R ugo+rX /var/www/html/repo/
This will make the new RPM visible
Client Side
sudo yum clean all
This will get rid off all the cached info related to the repo.sudo yum info rpmname
You should now see that the latest rpm version is available.sudo yum -y update rpmname
You should be updated.
I got very frustrated with all the answers (here, there, and everywhere) that glossed over all of these details. Anyone going through the process of creating a repo with updates is going to test it. The test will go like this:
Server Side, Add new RPM to repository, run createrepo, change permissions Client Side, yum -y install rpmname. User, "Cool it worked. Now let's try doing and update."
Server Side, Add RPM with newer revision, run createrepo, change permissions Client Side, yum -y upgrade rpmname, "No Packages marked for Update" User, "What the #?!@ I just followed all of the instructions I found on the web and this didn't work!"
On the client side, yum will cache information about the repository including the newest available release. The next time the client does an update
or info
command yum will not go back to the internet and check the repository. Yum will use the cached version of the repo.
Solution 3
If the RPM's version is greater than the installed version it will update.
Related videos on Youtube
b0x0rz
Updated on September 18, 2022Comments
-
b0x0rz over 1 year
need a link or tutorial on how to make an rpm package work with
yum UPDATE
. i have it and already works withyum INSTALL
andyum ERASE
, but is there somewhere info on how to make rpm package work when usingyum UPDATE
(what code to add, in what files, etc...)?thnx a lot
-
Admin over 11 yearsSome manuals are available in the web, for some RPM based distributions. For example: Fedora Project: http://docs.fedoraproject.org/en-US/Fedora/14/html/Software_Management_Guide/Uso_del_comando_yum.html CentOS: http://wiki.centos.org/PackageManagement/Yum
-
-
b0x0rz over 11 yearswhat happens with files that are changed after install, for example config files that are delivered on install? do they get overwritten?
-
Aaron Copley over 11 yearsIt depends on how the RPM is written, but well behaving RPMs won't clobber your configuration. The new configuration file is usually written as
somefile.conf.rpmnew
. If there is a significant update/change that causes the package to overwrite your config, yours will be backed up assomefile.conf.rpmsave
. -
b0x0rz over 11 yearsthnx for the info. i can only try it tomorrow though :P will let you know how it goes. thnx a lot. probably i'll have to do something so that the config files remain as-is...
-
Mike over 11 yearsdepends how the spec file is written if it uses
%config(noreplace)
to set the config in the rpm it will not be overwritten on an update. The rpm from the update will be given a an extension on the filename. I think it is like file.rpmnew -
Aaron Copley over 11 yearsAny update on this?
-
b0x0rz over 11 yearssorry was unable to try it, other tasks got precedence, this task got relegated a bit. i have not forgotten. however, we will have the same version usually, but the revision will be different, so that is another variable in the mix ;)
-
b0x0rz over 11 yearsi was unable to try it as of yet, other tasks got precedence, this task got relegated a bit. i have not forgotten. however, we will have the same version usually, but the revision will be different, so that is another variable in the mix ;)
-
Mike over 11 yearsrevsion is the same as release its the number after the - so it would be package-version-release.arch.rpm
-
b0x0rz over 11 yearsk that "seems" to work as you said, but during the update it seems that postinstall.in script is not executed. is this normal for an update?
-
b0x0rz over 11 yearsk that "seems" to work as you said, but during the update it seems that postinstall.in script is not executed. is this normal for an update?
-
Mike over 11 yearsyes it is since it's not an install
-
Steve Goodman almost 7 yearspart 1, step 3 should be 'sudo createrepo --update .', not 'suod'
-
Annihilannic almost 4 yearsOne more detail that would be good to mention is that the package would update without having to do a
yum clean all
if you just waited long enough for the cache to expire. By default this is 6 hours, unless it is overriden in youryum.conf
. Seemetadata_expire
on theman yum.conf
page for details.