OpenVZ- Create a Container

To create a container, you have to
-Choose the container ID
-Choose the OS template to use for the Container

Choose a container id greater than 100. CTID 0-100 are reserver.

# vzlist -a
    -To list all the containers in the Hardware Node. You can choose a ID other than in the list.

# ls /vz/template/cache/
   centos-5-x86_64.tar.gz
   fedora-7-x86_64.tar.gz
   suse-10.3-x86_64.tar.gz
  
   -To list all the OS templates in the Hardware Node.

               After the Container ID and the installed OS template have been chosen, you can create the Container private area with the vzctl create command. The private area is the directory containing the actual files of the given Container; it is usually residing in /vz/private/CTID/. The private area is mounted to the /vz/root/CTID directory on the Hardware Node and provides Container users with a complete Linux file system tree.

              The vzctl create command requires only the Container ID and the name of the OS template as arguments; however, in order to avoid setting all the Container resource control parameters after creating the private area, you can specify a sample configuration to be used for your new Container. The sample configuration files are residing in the /etc/vz/conf directory and have names with the following mask: ve-configname.conf-sample. The most commonly used sample is the ve-basic.conf-sample file; this sample file has resource control parameters suitable for most Containers.


# vzctl create <CTID>  --ostemplate centos-5-x86 -–config basic

            If you specify neither an OS template nor a sample configuration, vzctl will try to take the corresponding values from the global OpenVZ configuration file (/etc/vz/vz.conf).

Now the VPS is created. We can now configure the VPS with the start-up and network parameters.