Difference between revisions of "Install vzpkg2 and pkg-cacher"

From OpenVZ Virtuozzo Containers Wiki
Jump to: navigation, search
Line 1: Line 1:
 
=== Introduction ===
 
=== Introduction ===
 +
 +
2008/11/19: This is still unfinished, a work in progress, give me a couple days or email me through wiki if you have questions or concerns -BurnMage
  
 
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:
 
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:
Line 11: Line 13:
 
Pkg-cacher is a transparent caching proxy daemon optimized for Debian and RPM packages.  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.
 
Pkg-cacher is a transparent caching proxy daemon optimized for Debian and RPM packages.  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 an RPM repository for Fedora and CentOS installs, but when this document was written there were no repositories for Ubuntu or Debian setup yet.
+
Robert has setup an RPM repository for Fedora and CentOS installs, but when this document was written there were no repositories for Ubuntu or Debian setup yet. FIXME
 +
 
 +
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
  
 
===Installation===
 
===Installation===
Line 38: Line 46:
  
 
For CentOS:
 
For CentOS:
     wget http://repo.opensource-sw.net/ossw_centos.repo -P /etc/yum.repos.d
+
     wget http://repo.opensource-sw.net/centos/ossw.repo -P /etc/yum.repos.d
  
 
For Fedora:
 
For Fedora:
     wget http://repo.opensource-sw.net/ossw_fedora.repo -P /etc/yum.repos.d
+
     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.   
 
You may wish to edit the repository file, perhaps to add a priorities setting.   
Line 50: Line 58:
  
 
  yum install vzpkg2 vztmpl2-centos vztmpl2-fedora vztmpl2-debian vztmpl2-ubuntu
 
  yum install vzpkg2 vztmpl2-centos vztmpl2-fedora vztmpl2-debian vztmpl2-ubuntu
  yum install pkg-cacher
+
  yum install pkg-cacher-sa
 +
 
 +
=====<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:
 
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:
Line 60: Line 70:
 
  VZPKG_DNS=192.168.1.2,192.168.1.3
 
  VZPKG_DNS=192.168.1.2,192.168.1.3
  
===Source===
+
=====<u>Configure pkg-cacher</u>=====
 +
 
 +
 
 +
====Debian Installs:====
  
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:
+
=====<u>Remove Old Packages</u>=====
git clone http://git.opensource-sw.net/git/vzpkg   
+
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>=====
 +
 
 +
At the time of writing the OS templates were only available in RPM formatTo be able to install them, install yum:
 +
 
 +
    apt-get install yum
 +
 
 +
Then fetch the templates and install them:
 +
 
 +
    wget http://repo.opensource-sw.net/centos/5/i386/vztmpl2-centos-0.9.0-1.noarch.rpm
 +
    wget http://repo.opensource-sw.net/centos/5/i386/vztmpl2-fedora-0.9.0-1.noarch.rpm
 +
    wget http://repo.opensource-sw.net/centos/5/i386/vztmpl2-debian-0.9.0-1.noarch.rpm
 +
 +
    rpm -i --nodeps vztmpl2-*.rpm
 +
 
 +
Then move the templates to where Debian expects them:
 +
 
 +
    mv /vz/template/* /var/lib/vz/template/
 +
 
 +
Edit the /var/lib/vz/template/{centos,fedora,debian}/config/vzpkg.conf files as well to reference where Debian expects them.  Change the line:
 +
    baseurl=file:///vz/template/$OS_NAME/$OS_VER/$OS_ARCH/vz-addons/
 +
to:
 +
    baseurl=file:///var/lib/vz/template/$OS_NAME/$OS_VER/$OS_ARCH/vz-addons/
 +
 
 +
 
 +
=====<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
  
The templates are available using:
+
=====<u>Configure pkg-cacher</u>=====
git clone http://git.opensource-sw.net/git/vztmpl
 

Revision as of 18:53, 20 November 2008

Introduction

2008/11/19: This is still unfinished, a work in progress, give me a couple days or email me through wiki if you have questions or concerns -BurnMage

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. It is based on 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 an RPM repository for Fedora and CentOS installs, but when this document was written there were no repositories for Ubuntu or Debian setup yet. FIXME

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

Installation

Remove Old Packages & Templates

  • Backup your existing /vz/template directory and clear it out.
  • Uninstall vzpkg and any vztmpl-* packages.


Centos & Fedora installs:

Remove Old Packages

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 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.

Download the repository file for your OS

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.

Install vzpkg2 and pkg-cacher

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
Configure vzpkg2

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
Configure pkg-cacher

Debian Installs:

Remove Old Packages

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 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.

Add the deb repositories to your /etc/apt/sources.list:

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
Adding New Templates:

At the time of writing the OS templates were only available in RPM format. To be able to install them, install yum:

   apt-get install yum
  

Then fetch the templates and install them:

   wget http://repo.opensource-sw.net/centos/5/i386/vztmpl2-centos-0.9.0-1.noarch.rpm 
   wget http://repo.opensource-sw.net/centos/5/i386/vztmpl2-fedora-0.9.0-1.noarch.rpm
   wget http://repo.opensource-sw.net/centos/5/i386/vztmpl2-debian-0.9.0-1.noarch.rpm

   rpm -i --nodeps vztmpl2-*.rpm

Then move the templates to where Debian expects them:

   mv /vz/template/* /var/lib/vz/template/

Edit the /var/lib/vz/template/{centos,fedora,debian}/config/vzpkg.conf files as well to reference where Debian expects them. Change the line:

   baseurl=file:///vz/template/$OS_NAME/$OS_VER/$OS_ARCH/vz-addons/

to:

   baseurl=file:///var/lib/vz/template/$OS_NAME/$OS_VER/$OS_ARCH/vz-addons/


Configure vzpkg2

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
Configure pkg-cacher