How to create a new Virtuozzo Container

Posted: 3p in Virtuozzo
Tags: ,

How to create a new Virtuozzo Container

The 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:

[root@vzhost01 ~]# vzlist -a
CTID NPROC STATUS IP_ADDR HOSTNAME
1 96 running 67.219.*.* ServiceCT
6646 55 running 216.36.*.* server.renjithtest.com

Step 2:
Create a container with an open ID#. In this example we will use 6648.

[root@vzhost01 ~]# vzctl create 6648 –ostemplate centos-5-x86
Creating Container private area (centos-5-x86)
Container is mounted
Postcreate action done
Container is unmounted
Container private area created
Container registered succesfully

[root@vzhost01 ~]# vzlist -a
CTID NPROC STATUS IP_ADDR HOSTNAME
1 96 running 67.219.*.* ServiceCT
6646 55 running 216.36.*.* server.renjithtest.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:

[root@vzhost01 ~]# less /etc/sysconfig/vz-scripts/6648.conf

Step 4:
Add parameters necessary for managing the Container:

[root@vzhost01 ~]# 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

[root@vzhost01 ~]# vzctl set 6648 –diskspace 10G –save
Saved parameters for Container 6648

Addingt RAM memory 2GB to the container:

[root@vzhost01 ~]# vzctl set 6648 –physpages 262144 –save
Saved parameters for Container 6648

[root@vzhost01 ~]# vzctl set 6648 –privvmpages 262144 –save
Saved parameters for Container 6648

[root@vzhost01 ~]# vzctl set 6648 –oomguarpages 262144 –save
Saved parameters for Container 6648

[root@vzhost01 ~]# vzctl set 6648 –vmguarpages 262144 –save
Saved parameters for Container 6648

Step 5:
Start the container:

[root@vzhost01 ~]# 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:

[root@vzhost01 ~]# 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
—–

[root@vzhost01 ~]# 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

=========================================================>

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s