Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

need a link or tutorial on how to make an rpm package work with yum UPDATE. i have it and already works with yum INSTALL and yum ERASE, but is there somewhere info on how to make rpm package work when using yum UPDATE (what code to add, in what files, etc...)?

thnx a lot

share|improve this question
2  
Some 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/Us‌​o_del_comando_yum.html CentOS: http://wiki.centos.org/PackageManagement/Yum –  Subv3rsion Oct 3 '12 at 12:53

3 Answers 3

up vote 5 down vote accepted

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

share|improve this answer
    
what happens with files that are changed after install, for example config files that are delivered on install? do they get overwritten? –  b0x0rz Oct 3 '12 at 12:27
3  
depends 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 –  Mike Oct 3 '12 at 14:37
    
i 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 ;) –  b0x0rz Oct 5 '12 at 18:31
1  
revsion is the same as release its the number after the - so it would be package-version-release.arch.rpm –  Mike Oct 5 '12 at 20:58
1  
yes it is since it's not an install –  Mike Oct 15 '12 at 13:35

If the RPM's version is greater than the installed version it will update.

share|improve this answer
    
what happens with files that are changed after install, for example config files that are delivered on install? do they get overwritten? –  b0x0rz Oct 3 '12 at 12:27
1  
It 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 as somefile.conf.rpmsave. –  Aaron Copley Oct 3 '12 at 12:39
    
thnx 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... –  b0x0rz Oct 3 '12 at 12:52
    
Any update on this? –  Aaron Copley Oct 4 '12 at 19:22
    
sorry 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 Oct 5 '12 at 18:29

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

  1. Copy RPM to repo
  2. cd /path/to/repo
  3. createrepo --update . This will update the repo's database to include the new RPM
  4. sudo chmod -R ugo+rX /var/www/html/repo/ This will make the new RPM visible

Client Side

  1. yum clean all This will get rid off all the cached info related to the repo.
  2. yum info rpmname You should now see that the latest rpm version is available.
  3. 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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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