#summary Adding applications to OpenVZ containers

= Adding applications to OpenVZ containers =

To do research, you will want to populate your nodes (OpenVZ containers) with new applications.  It is important to understand what is going on with the file systems and per-node requirements for your application to run correctly in this environment.

If you do not use the core-root template for OpenVZ, and instead just create OpenVZ containers the typical way, you will have a separate file system for each OpenVZ container.  What this means is that if you want to install some application on each container (e.g. BitTorrent, iperf, etc.), you will need to install it on each instance of the container, after it is created.  Or, you can get by with putting it in the template, and then later entering each container and editing the per-node configuration files.

If you use the core-root template for creating OpenVZ containers, following these instructions:  [LinuxOpenVZTemplateCreation Instructions for creating your own template cache], you can avoid having independent file systems at each node.  This is often more convenient to manage for large topologies, and is more space efficient.  However, you need to be aware of how to manage the per-node information that is unique to each node.  This varies on an application by application basis.

For instance, consider quagga routing.  It suffices to have each OpenVZ container use the same binary, so if quagga binaries are installed in /openvz/private/core-root/usr/sbin, each container can use it.

However, consider that quagga needs to be able to store these files that must be unique from node to node:
 * configuration file (e.g Quagga.conf or zebra.conf)
 * logs (typically in /var/log/quagga)
 * process ids (typically in /var/run/quagga)

So, you need to make sure that the location for these files is not shared across containers.   These requirements will differ from application to application.

Recall that /root in each container maps to a unique directory, so if you can make sure that your per-node files end up in /root, you will be fine.  Otherwise, you need to edit the template and make sure that there are symlinks to somewhere in /root for other directories or file locations.  So, for instance, /vz/private/core-root will, by default (since it has already been set up to support Quagga), contain these symlinks:
{{{
lrwxrwxrwx  1 root root    13 Jun  2 13:27 var/log -> /root/var/log
lrwxrwxrwx  1 root root    13 Jun  2 13:27 var/run -> /root/var/run
lrwxrwxrwx  1 root root 15 Jun  2 13:27 etc/quagga/Quagga.conf -> /root/boot.conf
}}}

If you want to do something similar for a different application, edit /vz/private/core-root/ directory before you start to instantiate containers.