
Operations on Virtual Private Servers
33
Choosing OS Template
Next, you shall decide on which OS template you want to base the new VPS. There might be
several OS templates installed on the Hardware Node; use the
vzpkgls
command to find out
the templates installed on your system:
# vzpkgls
fedora-core-3
fedora-core-4
centos-4
Creating Virtual Private Server
After the VPS ID and the installed OS template have been chosen, you can create the VPS
private area with the
vzctl create
command. The private area is the directory containing
the private files of the given VPS. The private area is mounted to the
/vz/root/
vpsid
/
directory on the Hardware Node and provides VPS users with a complete Linux file system tree.
The
vzctl create
command requires only the VPS ID and the name of the OS template as
arguments; however, in order to avoid setting all the VPS resource control parameters after
creating the private area, you can specify a sample configuration to be used for your new Virtual
Private Server. The sample configuration files are residing in the
/etc/sysconfig/vz-
scripts
directory and have names with the following mask:
ve-
config_name
.conf-
sample
. The most commonly used sample is the
ve-vps.basic.conf-sample
file; this
sample file has resource control parameters suitable for most web site Virtual Private Servers.
Thus, for example, you can create a new VPS by typing the following string:
# vzctl create 101 --ostemplate fedora-core-4 -–config vps.basic
Creating VPS private area
VPS private area was created
In this case, OpenVZ will create a Virtual Private Server with ID 101, the private area based on
the
fedora-core-4
OS template, and configuration parameters taken from the
ve-vps.basic.conf-sample
sample configuration file.
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/sysconfig/vz
. So
you can set the default values in this file using your favorite text file editor, for example:
DEF_OSTEMPLATE="fedora-core-4"
CONFIGFILE="vps.basic"
and do without specifying these parameters each time you create a new VPS.
Now you can create a VPS with ID 101 with the following command:
# vzctl create 101
Creating VPS private area: /vz/private/101
VPS is mounted
Postcreate action done
VPS is unmounted
VPS private area was created