Editing Install vzpkg2 and pkg-cacher

Jump to: navigation, search

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision Your text
Line 1: Line 1:
=== Introduction ===
+
This is a place holder for the page BurnMage is going to update with instructions culled from the OpenVZ Users mailing list... from emails by Robert Nelson on how to install vzpkg2 and pkg-cacher.
 
 
Robert Nelson has created a couple new utilities to make managing and updating templates and containers easier, vzpkg2 pkg-cacher.  So far they will create and update a large range of containers, including both 32bit and 64bit of the following:
 
   
 
* Centos 4 and 5,
 
* Fedora 7, 8 and 9,
 
* Debian Sarge and Etch,
 
* Ubuntu Feisty, Gutsy and Hardy.
 
 
 
 
 
Pkg-cacher is a transparent caching proxy daemon optimized for Debian and RPM packages.  In other terms, pkg-cacher is a service that runs on a machine that other machines and containers, or "clients", use to update themselves instead of each of them directly hitting the package repositories.  Pkg-cacher only downloads a file once and then gives that to all its clients, instead of each of the clients downloading the file from the Internet at large.  It is based on [http://www.nick-andrew.net/projects/apt-cacher/ apt-cacher], available with Debian.  This version has been modified to understand RedHat RPM repositories.  It also adds support for the HTTP Range header and deals correctly with files which have the same name but different content on different distributions or in some cases different versions of the same distribution. 
 
 
 
Robert has setup repositories for Fedora, CentOS and Debian.
 
 
 
====Screencast====
 
 
 
Scott Dowdle has recorded a good screencast overview of vzpkg2 and pkg-cacher at:
 
 
 
http://www.montanalinux.org/vzpkg2-screencast.html
 
 
 
===Installation===
 
 
 
 
 
====Centos & Fedora installs:====
 
 
 
=====<u>Remove Old Packages</u>=====
 
If this is an '''existing''' install, uninstall your vzpkg and vztmpl-* packages:
 
 
 
yum remove vzpkg vztmpl-*
 
 
 
and backup & remove your current template directory:
 
 
 
tar cjf /some/backup/location/old_templates.tbz /vz/template
 
rm -r /vz/template
 
 
 
If this is a '''new''' install, you should probably review the [http://download.openvz.org/doc/OpenVZ-Users-Guide.pdf OpenVZ User's Guide] and the wiki's [[Quick installation]] page.  The only way you would vary your installation setups is declining to install the default vzpkg package, and instead using vzpkg2 here.
 
 
 
=====<u>Download the repository file for your OS</u>=====
 
 
 
For CentOS:
 
    wget http://repo.opensource-sw.net/centos/ossw.repo -P /etc/yum.repos.d
 
 
 
For Fedora:
 
    wget http://repo.opensource-sw.net/fedora/ossw.repo -P /etc/yum.repos.d
 
 
 
You may wish to edit the repository file, perhaps to add a priorities setting. 
 
 
 
=====<u>Install vzpkg2 and pkg-cacher</u>=====
 
 
 
Once the repository is added in /etc/yum.repos.d, you can now install the new vzpkg2 and pkg-cacher from it:
 
 
 
yum install vzpkg2 vztmpl2-centos vztmpl2-fedora vztmpl2-debian vztmpl2-ubuntu
 
yum install pkg-cacher-sa debootstrap
 
 
 
=====<u>Configure vzpkg2</u>=====
 
 
 
Open /etc/vz/vzpkg.conf in an editor.  Replace 'hostname' with the hostname or IP of the machine you are installing this on for VZPKG_CACHE_HOST, make sure not to use 'localhost', because this name is what OpenVZ Containers will use to access the pkg-cacher daemon:
 
 
 
VZPKG_CACHE_HOST=hostname:3142
 
 
 
While you are here, review this file to ensure it makes sense for your setup.  In particular, you will probably have to update the VZPKG_DNS line with IP addresses of DNS servers you use.
 
 
 
VZPKG_DNS=192.168.1.2,192.168.1.3
 
 
 
=====<u>Configure pkg-cacher</u>=====
 
 
 
Edit /etc/pkg-cacher/pkg-cacher.conf.  You should read the included documentation in the file to ensure it is appropriate for your setup.  Mostly the defaults will work just fine.  By default pkg-cacher will let any system use its cache.  You will probably want to limit it to your own systems on the line:
 
 
 
allowed_hosts=*
 
 
 
Once you have checked and updated pkg-cacher.conf, simply restart it by running as root:
 
 
 
service pkg-cacher restart
 
 
 
=====<u>Generate the new template cache</u>=====
 
 
 
Now everything should be ready to go!  Make sure both the 'vz' service and 'pkg-cacher' service are running.
 
 
 
To build an individual OS Template just run the 'vzpkgcache' command and pass it the name of the OS Template you want to build.  For a list of OS Templates you can build, run the 'vzpkgls' command.  Example:
 
 
 
vzpkgcache centos-5-i386-default
 
 
 
If you'd like to build all OS Templates available, just run the 'vzpkgcache' command without any parameters.  Example:
 
 
 
  vzpkgcache
 
 
 
vzpkg2 should get to work generating your initial caches.  Now you can run 'vzctl create' and use them.
 
 
 
====Debian Installs:====
 
 
 
=====<u>Remove Old Packages</u>=====
 
If this is an '''existing''' install, uninstall your vzpkg and vztmpl-* packages:
 
 
 
apt-get erase vzpkg vzctl-ostmpl-*
 
 
 
and backup & remove your current template directory:
 
 
 
tar cjf /some/backup/location/old_templates.tbz /vz/template
 
rm -r /vz/template
 
 
 
If this is a '''new''' install, you should probably review the [http://download.openvz.org/doc/OpenVZ-Users-Guide.pdf OpenVZ User's Guide] and the wiki's [[Installation on Debian]] page.  The only way you would vary your installation setups is declining to install the default vzpkg package, and instead using vzpkg2 here.
 
 
 
=====<u>Add the deb repositories to your /etc/apt/sources.list:</u>=====
 
 
 
Add the following lines to your /etc/apt/sources.list:
 
 
 
Etch:
 
    deb http://repo.opensource-sw.net/debian/ etch openvz
 
    deb-src http://repo.opensource-sw.net/debian/ etch openvz
 
 
 
Sarge:
 
    deb http://repo.opensource-sw.net/debian/ sarge openvz
 
    deb-src http://repo.opensource-sw.net/debian/ sarge openvz
 
 
 
Then do:
 
    apt-get update
 
    apt-get install pkg-cacher-sa vzpkg2
 
 
 
=====<u>Adding New Templates:</u>=====
 
 
 
Install the desired OS Template Metadata packages:
 
 
 
    apt-get install vztmpl2-centos vztmpl2-fedora vztmpl2-ubuntu vztmpl2-debian
 
 
 
=====<u>Configure vzpkg2</u>=====
 
 
 
Open /etc/vz/vzpkg.conf in an editor.  Replace 'hostname' with the hostname or IP of the machine you are installing this on for VZPKG_CACHE_HOST, make sure not to use 'localhost', because this name is what OpenVZ Containers will use to access the pkg-cacher daemon:
 
 
 
VZPKG_CACHE_HOST=hostname:3142
 
 
 
While you are here, review this file to ensure it makes sense for your setup.  In particular, you will probably have to update the VZPKG_DNS line with IP addresses of DNS servers you use.
 
 
 
VZPKG_DNS=192.168.1.2,192.168.1.3
 
 
 
=====<u>Configure pkg-cacher</u>=====
 
 
 
Edit /etc/pkg-cacher/pkg-cacher.conf.  You should read the included documentation in the file to ensure it is appropriate for your setup.  Mostly the defaults will work just fine.  By default pkg-cacher will let any system use its cache.  You will probably want to limit it to your own systems on the line:
 
 
 
allowed_hosts=*
 
 
 
Once you have checked and updated pkg-cacher.conf, simply restart it.
 
 
 
=====<u>Generate the new template cache</u>=====
 
 
 
Now everything should be ready to go!  Make sure both the 'vz' service and 'pkg-cacher' service are running
 
 
 
To get a list of what OS Templates you may now use, type the following:
 
 
 
vzpkgls
 
 
 
That will produce a list of available OS Templates.  Use any name given in the list as a parameter to vzpkgcache to build that OS Template.  Example:
 
 
 
vzpkgcache centos-5-i386-default
 
 
 
If you want to build all OS Templates you can simply run vzpkgcache without any paramters:
 
 
 
vzpkgcache
 
 
 
vzpkg2 should get to work generating your initial caches.  Now you can run 'vzctl create' and use them.
 
 
 
===Source===
 
 
 
The source for the new vzpkg2 and templates is available on http://git.opensource-sw.net.  In order to clone the updated source use the command:
 
git clone http://git.opensource-sw.net/git/vzpkg 
 
 
 
The templates are available using:
 
git clone http://git.opensource-sw.net/git/vztmpl
 

Please note that all contributions to OpenVZ Virtuozzo Containers Wiki may be edited, altered, or removed by other contributors. If you don't want your writing to be edited mercilessly, then don't submit it here.
If you are going to add external links to an article, read the External links policy first!

To edit this page, please answer the question that appears below (more info):

Cancel Editing help (opens in new window)