How to create a new Virtuozzo ContainerThe following steps will walk you through setting up a new container on a Virtuozzo server, if you are not familiar with a command line interface
Step 1:Check the list of containers on your host:
# vzlist -a
CTID NPROC STATUS IP_ADDR HOSTNAME
1 96 running 67.219.*.* ServiceCT
6646 55 running 216.36.*.* server.example.com
Step 2:Create a container with an open ID#. In this example we will use 6648.
# vzctl create 6648 –ostemplate centos-5-x86
Creating Container private area (centos-5-x86)
Container is mounted
Post create action done
Container is unmounted
Container private area created
Container registered successfully
# vzlist -a
CTID NPROC STATUS IP_ADDR HOSTNAME
1 96 running 67.219.*.* ServiceCT
6646 55 running 216.36.*.* server.example.com
6648 – stopped – –
Immediately after creation the VZ will be in the stopped state. If you are not sure what packages are installed you can use the vzpkgls command, this will show you a listing of installed virtuozzo OS and Application packages on the server. In our example we used a red hat template, but Virtuozzo will support several different OS’s including RedHat, CentOS, Debian, Fedora Core, and SuSe.
Step 3:Review the default configuration and make changes if necessary for the container:
# less /etc/sysconfig/vz-scripts/6648.conf
Step 4:Add parameters necessary for managing the Container:
# vzctl set 6648 –ipadd 216.36.*.* –hostname server1test.com –save
Hostname for Container set: server1test.com
Adding IP address(es) to pool: 216.36.*.*
Adding IP address(es): 216.36.*.*
Saved parameters for Container 6648
# vzctl set 6648 –diskspace 10G –save
Saved parameters for Container 6648
Adding RAM memory 2GB to the container:
# vzctl set 6648 –physpages 262144 –save
Saved parameters for Container 6648
# vzctl set 6648 –privvmpages 262144 –save
Saved parameters for Container 6648
# vzctl set 6648 –oomguarpages 262144 –save
Saved parameters for Container 6648
# vzctl set 6648 –vmguarpages 262144 –save
Saved parameters for Container 6648
Step 5:Start the container:
# vzctl start 6648
Starting Container …
Container is mounted
Setting devperms 20002 dev 0x7d00
Adding port redirection to Container(1): 4643 8443
Adding IP address(es) to pool:
Adding IP address(es): 216.36.*.*
Hostname for Container set: server1test.com
Configure meminfo: 393216
Container start in progress…
Step 6:Install yum packages to the container:
# vzpkg install 6648 -p yum
Loading “rpm2vzrpm” plugin
Cleaning up xml metadata
16 metadata files removed
Loading “rpm2vzrpm” plugin
Making cache files for all metadata files.
This may take a while depending on the speed of this computer
Setting up repositories
—–
# vzctl enter 6648
entered into Container 6648
-bash-3.2# hostname
server1test.com
-bash-3.2# hostname -i
216.36.*.*
This concludes basic setup of a new Virtuozzo Container via the command line