Oskar Stolc's Howto Collection

Articles in the OpenVZ category

OpenVZ - How to detect OpenVZ

This howto shows how to detect OpenVZ support on the host and in the container.

#!/bin/bash

if [ -f /proc/user_beancounters ] ; then
        envID=$(cat /proc/1/status |grep envID |cut -f 2)
        if [ $envID -eq 0 ] ; then
                echo "OpenVZ Host"
        else
                echo "OpenVZ Guest"
        fi
else
        echo "Not OpenVZ"
fi …

OpenVZ - Create a Container on ploop

This howto shows how to create an OpenVZ container on ploop

If you want all newly created containers to use ploop add this to /etc/vz/vz.conf

VE_LAYOUT=ploop

If you want to create only one container on ploop add '--layour ploop' to 'vzctl create' command

vzctl create CTID …

OpenVZ - Create a Container with VENET Interface

This howto shows how to create an OpenVZ container with VENET interface.

Create the container

vzctl create 10221 --ostemplate centos-6-x86_64 --config vswap-1g

Configure the container

vzctl set 10221 --save --name server10221
vzctl set 10221 --save --onboot yes
vzctl set 10221 --save --hostname server10221.example.com
vzctl set 10221 --save --ipadd …

OpenVZ - Create a Container with VETH Interface

This howto shows how to create an OpenVZ container with VETH interface.

Create the container

vzctl create 10221 --ostemplate centos-6-x86_64 --config vswap-1g

Configure the container

vzctl set 10221 --save --name server10221
vzctl set 10221 --save --onboot yes
vzctl …

OpenVZ on CentOS 6

This howto shows how to install OpenVZ on CentOS 6.

Assumptions

  • SELinux is disabled
  • Firewall is disabled
  • Containers are on the same subnet as the physical host

Installation Steps

Install the OpenVZ yum repo and ensure it points to the right repo (RHLE6)

wget -O /etc/yum.repos.d/openvz …