CentOS Icon CentOS Logo
CentOS Text
   
  
www.centos.org Forum Index
   CentOS 5 - Software Support
  Can yum be used to update a directory instead of the running system?

 

 Bottom   Previous Topic   Next Topic
12>
  •  Rate Thread
      Rate this Thread
      Excellent
      Good
      Average
      Bad
      Terrible
Poster Thread
  •  pschaff
      pschaff
Re: Can yum be used to update a directory instead of the running system?
#21
Moderator
Joined: 2006/12/13
From Tidewater, Virginia, North America
Posts: 18773
Try a google on yum Seth Vidal.
_________________
Phil

Recommended reading: FAQ & Readme first ; Search hint: google "your topic site:centos.org"; Smart Questions
Posted on: 2012/3/6 22:57
Create PDF from Post Print
Top
  •  cadi
      cadi
Re: Can yum be used to update a directory instead of the running system?
#20
Peeking in the Member Window
Joined: 2012/3/1
From
Posts: 13
Can you please point me some documentation about how yum works, as deep as possible?

I suppose I can look into the source code but I would like to avoid that if there any kind of higher-level description of the logic/actions that yum implements.

Thanks,
Adi
Posted on: 2012/3/6 22:42
Create PDF from Post Print
Top
  •  TrevorH
      TrevorH
Re: Can yum be used to update a directory instead of the running system?
#19
Moderator
Joined: 2009/9/24
From Brighton, UK
Posts: 6560
Yum doesn't check a directory but perhaps you could do "clever" tricks with substituting different /var/lib/rpm directories though this sounds somewhat dangerous and unpredictable to me.
_________________
Linux/VoIP Systems Administrator
Posted on: 2012/3/2 9:10
Create PDF from Post Print
Top
  •  cadi
      cadi
Re: Can yum be used to update a directory instead of the running system?
#18
Peeking in the Member Window
Joined: 2012/3/1
From
Posts: 13
Yes, that is true, but this is what was trying to avoid by having, as I said, a way to convince yum to check a directory that contains the rpms that the client's OS would contain and give me the updates for those.
Posted on: 2012/3/2 4:17
Create PDF from Post Print
Top
  •  TrevorH
      TrevorH
Re: Can yum be used to update a directory instead of the running system?
#17
Moderator
Joined: 2009/9/24
From Brighton, UK
Posts: 6560
I think we're back to yum-downloadonly on your copy of the system. If you maintain a VM image of what you shipped to the client then it should match what they have and the RPMS that are downloaded can then be copied to a CD/DVD.
_________________
Linux/VoIP Systems Administrator
Posted on: 2012/3/2 0:03
Create PDF from Post Print
Top
  •  pschaff
      pschaff
Re: Can yum be used to update a directory instead of the running system?
#16
Moderator
Joined: 2006/12/13
From Tidewater, Virginia, North America
Posts: 18773
DoD also does not like removable media such as USB keys. Not sure what exceptions there may be. Makes life a lot harder.
_________________
Phil

Recommended reading: FAQ & Readme first ; Search hint: google "your topic site:centos.org"; Smart Questions
Posted on: 2012/3/1 23:12
Create PDF from Post Print
Top
  •  cadi
      cadi
Re: Can yum be used to update a directory instead of the running system?
#15
Peeking in the Member Window
Joined: 2012/3/1
From
Posts: 13
You are right and your suggestions are good. We actually have a custom interface for the administration of that appliance. However, they are still going in via other ways and get a shell. I would not go so far to change so many things in a system to make it nearly impossible to get a shell as this will bring the same problems of maintenance.

A "sufficiently cluefull" individual as you nicely put it is actually a little bit more dangerous than a clueless one (that also realizes his cluelessness) or than a really cluefull one that would be wise enough to stay away from customized stuff that he has no idea about. These are usually the individuals that believe they can play with anything but we have a proprietary, modified, customized etc. system (not as much on the OS part as on some of the services that runs on it) which will behave as expected only if you know its particularities. That's the part they don't really get.... but this is another story.

And also, I still need to supply patches for the systems that are not connected to Internet. I can't ask someone from DoD (for example) to get internet on our appliance, in their "super" secure environment because it needs to be updated....
Posted on: 2012/3/1 22:58
Create PDF from Post Print
Top
  •  pschaff
      pschaff
Re: Can yum be used to update a directory instead of the running system?
#14
Moderator
Joined: 2006/12/13
From Tidewater, Virginia, North America
Posts: 18773
That's additional information you did not previously reveal. If the problem is the clients messing with yum then there are options that would protect them from themselves while allowing you to use the optimal tools to manage the systems:

1. Just give them sudo access with a limited set of commands.
2. Create a script that disables yum by moving the executable, moving it off the standard path, etc. Create another script the reverse the process when you want to update.
3. Create scripts to remove yum and dependencies, and to reinstall them when you need them.

Obviously any technically savvy client can bypass any of the above, but there's no perfect solution to stop a sufficiently determined and knowledgeable person. One could hope that such an individual would be sufficiently cluefull not to break the system without malicious intent.
_________________
Phil

Recommended reading: FAQ & Readme first ; Search hint: google "your topic site:centos.org"; Smart Questions
Posted on: 2012/3/1 22:33
Create PDF from Post Print
Top
  •  cadi
      cadi
Re: Can yum be used to update a directory instead of the running system?
#13
Peeking in the Member Window
Joined: 2012/3/1
From
Posts: 13
I was not my choice either but having yum on our appliance that gets delivered to a client is getting me more problems then it solves as the client, as always, thinks he knows better and start updating the system when he should not and things would break and I have to fix them.

Unfortunately, that's how it is.

People here have been doing this for a few years and it works but now I am taking over the process and I need to automate it as much as possible... having yum on the appliance at the client it's not a solution; we have to get them the patches to update the platform/OS and our application...

I have a solution but it's not pretty or elegant and it is more time consuming than I would like: I will make a storage full of VMs created from ISO images for all the versions of our appliance that we are still supporting and so I will use scripting and ssh to start them, enable yum, use it to download the new rpms, and use these rpms to create the patches that will be shipped to the clients and applied there "offline"....

Thanks anyway for your time and help.
Posted on: 2012/3/1 22:16
Create PDF from Post Print
Top
  •  pschaff
      pschaff
Re: Can yum be used to update a directory instead of the running system?
#12
Moderator
Joined: 2006/12/13
From Tidewater, Virginia, North America
Posts: 18773
Quote:

cadi wrote:
Phil, I understand what you are saying but what I am trying to do has nothing to do with the repos.

Let's say you have a centOS system which does not have yum installed and you do not want it installed. How would you update it?

I would not choose to do it the hard way.
_________________
Phil

Recommended reading: FAQ & Readme first ; Search hint: google "your topic site:centos.org"; Smart Questions
Posted on: 2012/3/1 21:53
Create PDF from Post Print
Top
  •  cadi
      cadi
Re: Can yum be used to update a directory instead of the running system?
#11
Peeking in the Member Window
Joined: 2012/3/1
From
Posts: 13
Phil, I understand what you are saying but what I am trying to do has nothing to do with the repos.

Let's say you have a centOS system which does not have yum installed and you do not want it installed. How would you update it?

I would update it with rpm -Uvh providing that I have all the rpms that I need (for dependencies etc.). To have all the rpms that I need, I would use yum as it can figure out reliably and fast what rpms are newer and what dependencies are there and how to solve those dependencies. The problem is I cannot use yum on the system that I need to update as yum is not installed and it won't be. So I need to use it on another system but make it aware of the fact that I am not trying to update the system on which it is installed but another one which can be represented by a directory with rpm files, for example.

It's like when you use a linux 64 bit machine and compile a program for a linux 32 bit machine and for AIX, for example...
Posted on: 2012/3/1 21:50
Create PDF from Post Print
Top
  •  pschaff
      pschaff
Re: Can yum be used to update a directory instead of the running system?
#10
Moderator
Joined: 2006/12/13
From Tidewater, Virginia, North America
Posts: 18773
Seem to me that you are not quite grasping the nature of the problem and the feasibility of potential solutions. The easiest (and perhaps the only) way to make sure you cover all the bases is to create and maintain a mirror of all CentOS repos you use - as a minimum probably base, updates, and extras. Anything else is going to be a maintenance nightmare, or just plain impossible. There is no way (that I know of) to anticipate what updates any particular system will need in advance. You need to run "yum update" against the current metadata. You also cannot anticipate what additional packages might need to be installed on any particular system. Creating a full local mirror of the repos you need is the only way I can suggest to work the problem you have laid out for non-uniform systems. You can sync the repos over the network with rsync, using systems that do have Internet access, or use an external hard disk, or a USB stick with sufficient capacity to hold the repos.

For an idea of the space requirements:
[build@lynx ~]$ cd /share/CentOS/5.7
[build@lynx 5.7]$ ll
total 44
drwxrwxr-x. 5 build build 4096 May 14  2010 addons
drwxrwxr-x. 5 build build 4096 Nov 30 04:59 centosplus
drwxrwxr-x. 5 build build 4096 May 14  2010 contrib
drwxrwxr-x. 5 build build 4096 Sep 12 20:59 cr
drwxrwxr-x. 5 build build 4096 Feb  8 13:47 extras
drwxrwxr-x. 5 build build 4096 Dec  6 20:41 fasttrack
drwxrwxr-x. 4 build build 4096 Sep  8 11:41 isos
drwxrwxr-x. 8 build build 4096 Dec 10 15:18 local
drwxrwxr-x. 6 build build 4096 Feb 11 09:22 localtest
drwxrwxr-x. 5 build build 4096 Sep  8 11:41 os
drwxrwxr-x. 5 build build 4096 Sep  8 12:48 updates
[build@lynx 5.7]$ du -sh os/i386 extras/i386 updates/i386
4.0G	os/i386
146M	extras/i386
1.7G	updates/i386
[build@lynx 5.7]$ !!:gs/i386/x86_64/
du -sh os/x86_64 extras/x86_64 updates/x86_64
4.7G	os/x86_64
168M	extras/x86_64
1.9G	updates/x86_64
[build@lynx 5.7]$ du -sh .
31G	.
[build@lynx 5.7]$ du -sh *
84K	addons
1.5G	centosplus
36K	contrib
44K	cr
499M	extras
233M	fasttrack
18G	isos
313M	local
213M	localtest
7.3G	os
3.6G	updates
Note that local and localtest are my own repos and not part of the standard structure. For just os, updates, and extras, an 8GB USB stick for each architecture would be adequate, or 16GB for both, and you could still have a bit of room for other things like fasttrack and centosplus.
_________________
Phil

Recommended reading: FAQ & Readme first ; Search hint: google "your topic site:centos.org"; Smart Questions
Posted on: 2012/3/1 21:30
Create PDF from Post Print
Top
  •  cadi
      cadi
Re: Can yum be used to update a directory instead of the running system?
#9
Peeking in the Member Window
Joined: 2012/3/1
From
Posts: 13
Thanks, but how would this help me instruct yum what to update?

I really think no one yet understands what I am asking.
I'll try one more time:

On a centos system (call it SYS-A) yum is run and it looks at the local running system (the one we call SYS-A) and compares what it finds with what is available on whatever repo is configured - as a result yum comes up with a list of new packages that should be installed to update the old packages found on SYS-A.
This is how I update SYS-A.

If I want to update SYS-B and I cannot run yum on it I need a set of rpms to install on SYS-B with rpm -Uvh most probably.

On SYS-A, I have a list of what packages are currently installed on SYS-B (I can also have all these packages in a directory on SYS-A) and I need yum, which I will run on SYS-A, to look into this list/directory representing SYS-B but located on SYS-A and come up with the list of packages that I need to install on SYS-B to update it.

Can I do this with yum or in any other way?

Thanks,
I really hope I made myself clear as I am not trying to waste anyone's time here.
Posted on: 2012/3/1 21:21
Create PDF from Post Print
Top
  •  TrevorH
      TrevorH
Re: Can yum be used to update a directory instead of the running system?
#8
Moderator
Joined: 2009/9/24
From Brighton, UK
Posts: 6560
We are suggesting that you create a local mirror of ALL of the RPMs.
_________________
Linux/VoIP Systems Administrator
Posted on: 2012/3/1 20:49
Create PDF from Post Print
Top
  •  cadi
      cadi
Re: Can yum be used to update a directory instead of the running system?
#7
Peeking in the Member Window
Joined: 2012/3/1
From
Posts: 13
Phil,

Thanks for your detailed reply.

I understand that a repo can be local but this will only give me a local resource for the source of the new versions of the rpms.

What I need is to chose the source of the OLD rpms that yum should look into and then go to the repo and fetch the new versions if there are new versions.

So how can I tell yum: "THIS is the system I need you to update"? and by THIS I mean a local storage point of some kind where I can put the OLD rpms.
Posted on: 2012/3/1 19:55
Create PDF from Post Print
Top
  •  pschaff
      pschaff
Re: Can yum be used to update a directory instead of the running system?
#6
Moderator
Joined: 2006/12/13
From Tidewater, Virginia, North America
Posts: 18773
A yum repo can be on the local filesystem, or on removable media, such as DVD. See Creating Update Media for the DVD approach. Below is a sample CentOS-Base.repo file that uses a local filesystem that can be either on a local hard disk or NFS-mounted:

# cat /etc/yum.repos.d/CentOS-Base.repo 
# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the 
# remarked out baseurl= line instead.
#
#

[base]
name=CentOS-$releasever - Base
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
baseurl=file:///share/CentOS/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
priority=1

#released updates 
[updates]
name=CentOS-$releasever - Updates
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
baseurl=file:///share/CentOS/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
priority=1

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
#baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/
baseurl=file:///share/CentOS/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
priority=1

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
#baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
baseurl=file:///share/CentOS/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
priority=1

#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib
#baseurl=http://mirror.centos.org/centos/$releasever/contrib/$basearch/
baseurl=file:///share/CentOS/$releasever/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
priority=1
_________________
Phil

Recommended reading: FAQ & Readme first ; Search hint: google "your topic site:centos.org"; Smart Questions
Posted on: 2012/3/1 19:31
Create PDF from Post Print
Top
  •  cadi
      cadi
Re: Can yum be used to update a directory instead of the running system?
#5
Peeking in the Member Window
Joined: 2012/3/1
From
Posts: 13
Thank you all!

Unfortunately I have already looked into these options and none of them is a solution for me.

To answer to your recommendations:

- Having a local repository means that I will solve the problem if all the systems that need updates will be able to communicate with this local repo. This is not my case.
- --installroot option has nothing to do with the location used by yum to determine what rpm packages need updates
- I already use the --downloadonly --downloaddir=/some/path in order to store all the new rpms in a certain location but this is not what I need, it's just part of a possible solution.
- I have been using man yum, of course, and many other resources before asking this here

I will try to explain my problem a little better:

I need to update systems that are not under my control and which are located in many places, in many companies. My company is using a fairly standard rhel/centos distro as a base for a product and it needs to keep its clients up to date with OS updates. The machines running in our clients infrastructures, most of the time has no access to internet, and even if they would have, would not solve the problem due to other reasons (mainly security stuff...).

What yum does when I ask it to update a system, it to look for all the rpms installed in the running system and than go to a repository to find updates for each of those rpms. What I need it to do is to look into a certain location on the local hard disk (maybe a network drive, ftp/http/nfs server etc., but it has to be a location of my choosing NOT the running system only) instead of into the rpms installed in the running system and then go to the repo and find updates.

If I cannot do that, basically I would need an exact replica of each of the running systems we have at our clients in order to use yum to get the new rpms and then build some kind of a patch and deliver it to the client. This would be impossible.

Any other ideas on how to do do this?

Thank you!
Posted on: 2012/3/1 19:20
Create PDF from Post Print
Top
  •  pschaff
      pschaff
Re: Can yum be used to update a directory instead of the running system?
#4
Moderator
Joined: 2006/12/13
From Tidewater, Virginia, North America
Posts: 18773
Quote:

TrevorH wrote:
...
It'll go through all the steps of doing the download and then exit without doing the update, leaving all the rpms in /var/cache/yum

That's not going to work reliably unless all systems are identical, and still needs a way to distribute the packages and create metadata.

Quote:

Actually, depending on what you want to do, just creating your own yum repo might be a better bet. I expect the wiki has articles on it but you basically just rsync a CentOS mirror and do some stuff (tm) to it then make it available over http to your clients.

A Wiki search for Mirror will turn up several including the one I provided a link for above.
_________________
Phil

Recommended reading: FAQ & Readme first ; Search hint: google "your topic site:centos.org"; Smart Questions
Posted on: 2012/3/1 14:30
Create PDF from Post Print
Top
  •  TrevorH
      TrevorH
Re: Can yum be used to update a directory instead of the running system?
#3
Moderator
Joined: 2009/9/24
From Brighton, UK
Posts: 6560
How about the yum-downloadonly package?

yum install yum-downloadonly
yum --downloadonly update


It'll go through all the steps of doing the download and then exit without doing the update, leaving all the rpms in /var/cache/yum

Actually, depending on what you want to do, just creating your own yum repo might be a better bet. I expect the wiki has articles on it but you basically just rsync a CentOS mirror and do some stuff (tm) to it then make it available over http to your clients.
_________________
Linux/VoIP Systems Administrator
Posted on: 2012/3/1 2:26
Create PDF from Post Print
Top
  •  pschaff
      pschaff
Re: Can yum be used to update a directory instead of the running system?
#2
Moderator
Joined: 2006/12/13
From Tidewater, Virginia, North America
Posts: 18773
Why not create a Local Mirror? As more direct answer is "man yum" and look for
       --installroot=root
              Specifies an alternative installroot, relative to which all packages will be installed.
              Configuration Option: installroot
but I'm not sure if that is a good answer.
_________________
Phil

Recommended reading: FAQ & Readme first ; Search hint: google "your topic site:centos.org"; Smart Questions
Posted on: 2012/3/1 1:50
Create PDF from Post Print
Top
 Top   Previous Topic   Next Topic
12>

 


 You cannot start a new topic.
 You can view topic.
 You cannot reply to posts.
 You cannot edit your posts.
 You cannot delete your posts.
 You cannot add new polls.
 You cannot vote in polls.
 You cannot attach files to posts.
 You cannot post without approval.




"Linux" is a registered trademark of Linus Torvalds. | All other trademarks are property of their respective owners. | All other content is Copyright @ 2004-2009 by the CentOS Project or "each individual contributor (forums, comments, etc.) unless otherwise assigned".| Theme based on a theme by 7dana.com