Home > Uncategorized > More OpenVZ and CentOS 5

More OpenVZ and CentOS 5

This was much more difficult, annoying really, than it should have been. While the OpenVZ wiki is generally excellent, with clear, easy-to-follow instructions describing how to install VPSes based on a variety of operating systems, there are none specifically for CentOS 5.

I have a CentOS 5 host (HN) and need to install several CentOS 5 containers (VPS). First problem: there is no official prebuilt CentOS 5 template cache or metadata. While the community contributed CentOS 5 template cache is okay, it’s missing the metadata necessary to use vzyum.

Eventually I found this discussion which produced to this working CentOS template RPM. To install:

rpm -ivh vztmpl-centos-5-2.0-3.i386.rpm

Build the template cache:

vzpkgcache -f centos-5-minimal

Template building is much faster with a local yum repository, enabled in /etc/yum.repos.d/CentOS-Media.repo. To loop mount the CentOS 5 installation DVD iso:

mount -o loop  /downloads/CentOS-5.1-i386-bin-DVD.iso /media/CentOS

Create the VPS:

vzctl create 101 --ostemplate centos-5-i386-minimal
vzctl set 101 --ipadd --save
vzctl set 101 --nameserver --save
vzctl start 101

To enter, stop or destroy the container:

vzctl enter 101
vzctl stop 101
vzctl destroy 101

To add packages to the container using vzyum:

vzyum 101 install package-name

**NB** The above still didn’t work until I initialized the container’s rpm database:

vzctl exec 101 rpm -vv --initdb

Hope this helps – enjoy.

Categories: Uncategorized Tags:
  1. No comments yet.
  1. No trackbacks yet.