OpenVZ Forum


Home » General » Support » yum.repo per VE
yum.repo per VE [message #21728] Mon, 15 October 2007 12:54 Go to next message
ntenev is currently offline  ntenev
Messages: 13
Registered: December 2005
Location: Bulgaria
Junior Member

Hi all,
is there any way to set yum repo personally for a VE ? For example:
I have HN with 3 VE, all of them are with centos-4 template. 2 of them (let's be named 1001 and 1002) uses standart centos packages and updates and in this case initial yum.conf for vzyum is more than perfect. But in third VE (1003) I wish to use some packages from external for centos repository (example: amavisd-new from dag). I know that is possible to download necessary rpms from repo and install them by rpm command but this is little dependancy hell (because so many additional perl modules needed) and is more problematic for future support. I know that can add repo to global yum.conf file but then this repo will be for all VEs. Do is possible to make it available only from one of all VE ?

Best regards and sorry for my bad english !
Re: yum.repo per VE [message #21735 is a reply to message #21728] Mon, 15 October 2007 14:45 Go to previous messageGo to next message
maratrus is currently offline  maratrus
Messages: 1495
Registered: August 2007
Location: Moscow
Senior Member
Hi,

vzyum is a yum wrapper and it's main benefit that you can share yum cache between VPSes. If you want to install the same packet on 2 VPSes you don't have to download it 2 times, because vzyum uses the common cache. So it uses the same conf files for all VPSes.

You can install yum on VPS(1003), make into VPs your own repo file and use yum inside VPS.

[Updated on: Mon, 15 October 2007 14:48]

Report message to a moderator

Re: yum.repo per VE [message #21736 is a reply to message #21728] Mon, 15 October 2007 15:07 Go to previous messageGo to next message
ntenev is currently offline  ntenev
Messages: 13
Registered: December 2005
Location: Bulgaria
Junior Member

Hi maratrus,
technicaly you are right, and this is one of first things that I try. But with this solution have some disadvantages:

1) yum (inside VE) detect all packages, including that are installed on HN and upgrade them all (locally for VE). It's not big problem, VE still works fine, but I search a little more "clean" solution.

2) vzyum is perfect "central" solution. If I install yum inside VE then it will be "second tool for separate case" wich is something that I wish to not use at this time.

But nevertheless - thank you for your replay !
Re: yum.repo per VE [message #21826 is a reply to message #21728] Tue, 16 October 2007 15:48 Go to previous messageGo to next message
ntenev is currently offline  ntenev
Messages: 13
Registered: December 2005
Location: Bulgaria
Junior Member

By presumption that say "something is better for nothing" will post my solution og this case. It's ugly but useful for me Smile

In file /usr/share/vzyum/lib/yum/__init__.py in YumBase -> getReposFromConfig somewhere after line 105 ~ 106 I added next code:

  vpsrepospath = ('/etc/yum.repos.vps/%s' % self.conf.vps)

  if os.path.isdir(vpsrepospath):
      self.conf.reposdir.append(vpsrepospath)


Then in /etc/yum.repos.vps/1003/ I can create .repo file that contain required additional repos and ... I'm happy Smile

vzyum 1001/1002 ... read repo only from /vz/template/centos/4/i386/config/yum.conf but vzyum 1003 adds and repos from /etc/yum.repos.vps/1003/*.repo filed. Cashe is still the same for one OS tempalte.

I'm not skilled python developer ... even I'm not developer at all. May be have some other good solutions for this case. First I was try to make it like a vzyum plugin (yum plugin ideed) but fail ... maybe because old API (version 2.1), maybe because I don't have enough developer skills


That's all folks Smile




Re: yum.repo per VE [message #21918 is a reply to message #21736] Wed, 17 October 2007 22:02 Go to previous messageGo to next message
dowdle is currently offline  dowdle
Messages: 261
Registered: December 2005
Location: Bozeman, Montana
Senior Member
ntenev wrote on Mon, 15 October 2007 09:07


1) yum (inside VE) detect all packages, including that are installed on HN and upgrade them all (locally for VE). It's not big problem, VE still works fine, but I search a little more "clean" solution.


What? If your VPS needs updates, you should do them... rather than just using yum to install new packges only. You do have the overhead of having yum, it's deps, and the database it maintains... but if you do a "yum clean all" after you do package installs, it frees up a bit of disk space.

Quote:


2) vzyum is perfect "central" solution. If I install yum inside VE then it will be "second tool for separate case" wich is something that I wish to not use at this time.


An ugly way to achieve this, I think... would be to make a separate yum config for each scenerio... put it where it needs to go and then tack on .scenerioname to the end of it... which scenerioname being some arbitrary word that helps you identify which file is for which usage case. When working in scenerio one, copy the whatever.repo.scenerio1 to whatever.repo and do your work. So basically you are have one config file that applies to all of them but you keep change it depending on which VPS you are working with at the time.


--
TYL, Scott Dowdle
Belgrade, Montana, USA
Re: yum.repo per VE [message #23704 is a reply to message #21728] Thu, 22 November 2007 23:25 Go to previous message
Sambo is currently offline  Sambo
Messages: 2
Registered: November 2007
Junior Member
Hi.. this is the way I achieved this.. for better or worse:

Firstly, I copied the yum.conf file from /vz/templates/centos/4/i386/conf/ into the /etc directory of the VE itself and call it vzyum.conf (e.g: /vz/private/211/etc/vzyum.conf )

Then I made a small change to the yum_conf() function in /usr/share/vzpkg/functions script, as follows:

# Returns -c parameters needed for yum.
function yum_conf()
{
        local tdir=$1
        local template=$TEMPLATE
        if test -z "$template"; then
                template=`get_vz_var TEMPLATE`
        fi
        local cfg=$tdir/config/yum.conf
        local spcfg=$VE_ROOT/etc/vzyum.conf  ## PER-VE conf file
        # FIXME: check for osset-specific yum.conf
        test -f $cfg || abort "yum repository config file " \
                "($cfg) not found!"
        ## USE Per-VE conf file if exists
        #echo "-c $cfg"
        if [ -f $spcfg ]; then
                echo "-c $spcfg"
        else
                echo "-c $cfg"
        fi
}



It was just a quick hack.. could probably be cleaned up (eg the file existence test logic).

The downside is that it means a process on the hardware node itself is accessing a file inside the VE, which I'm not sure is a good idea.

The upside is that migrating the VE from one node to another doesn't affect it, as the vzyum.conf file travels with it.

This means that each VE can have it's own specific set of repositories (rpmforge, etc) and updates can be managed from the hardware node taking advantage of caching, etc. A script to mass-update all VE's becomes trivial.

The only thing to watch is that an update doesn't overwrite the functions file, which could inadvertantly down-grade packages on the VE. It would be better if a permenant solution was put in place.

cheers
sam

[Updated on: Thu, 22 November 2007 23:36]

Report message to a moderator

Previous Topic: Fail to compile 2.6.18-028stab049.1 on amd64 machine
Next Topic: sysctl, kernel.sem, kernel.shmmax etc.
Goto Forum:
  


Current Time: Sun Aug 11 14:45:28 GMT 2024

Total time taken to generate the page: 0.03044 seconds