Question

How to change a default mirror for templates?

Answer

Default mirror customization is performed in /etc/vztt/url.map, this file contains the list of replacements to apply to files repositories and mirrorlist. For example, to change Debian security repository, one can configure the replacement:

~# vzpkg info debian-7.0-x86_64 repositories
repositories:
        ftp://ftp.de.debian.org/debian wheezy main contrib non-free
        ftp://ftp.de.debian.org/debian-security wheezy/updates main contrib non-free
~# grep debian /etc/vztt/url.map
$DEB_SERVER     ftp://ftp.de.debian.org
~# echo 'ftp://ftp.de.debian.org/debian-security http://security.debian.org/' >> /etc/vztt/url.map
~# vzpkg info debian-7.0-x86_64 repositories
repositories:
        ftp://ftp.de.debian.org/debian wheezy main contrib non-free
        http://security.debian.org/ wheezy/updates main contrib non-free

Note: the string to replace is checked to be a substring of the line. Thus, one cannot replace only "ftp://ftp.de.debian.org/debian" in the first line and not to replace the second line with the -security suffix.

Note: among replacement lines the first one has priority over the next ones, therefore the shorter replacement string should be defined in the end.

~# echo 'ftp://ftp.de.debian.org/debian-security http://security.debian.org/' >> /etc/vztt/url.map
~# echo 'ftp://ftp.de.debian.org/debian http://ftp.us.debian.org/debian' >> /etc/vztt/url.map
~# vzpkg info debian-7.0-x86_64 repositories
repositories:
    http://ftp.us.debian.org/debian wheezy main contrib non-free
    http://security.debian.org/ wheezy/updates main contrib non-free

Internal content