Saturday, August 4, 2012

Create a Virtual Server with OpenVZ in Linux

Create a Virtual Server

Once you have OpenVZ installed you will be able to begin the process of installing individual containers.

Using the vzctl command you will be able to create a virtual server in less than 5 minutes.  One of the steps that must be completed before you begin is to move the template you will use into the /vz/template/cache.

The first command uses a template and sets the configuration as a vps.basic.  The 26 is a identifier for the vps.  It makes sense to use the last octet of the IP Address for this identifier.  Thus this is used for 192.168.4.26.  In the example the centos template is used.

# vzctl create 26 – -ostemplate centos-5 –config vps.basic

Creating VE private area (centos-5-i386-default)
Performing postcreate actions
VE private area was created
This setting provides for the VE to start on boot.  This is probably what you want.  However, the default is not to start a VE on boot so if you do not use this setting it will remain off.

# vzctl set 26 – -onboot yes –save
# vzctl set 26 – -hostname admin26–save
# vzctl set 26 – -ipadd 192.168.4.26 –save
# vzctl set 26 – -nameserver 12.32.34.32 –save
# vzctl start 26

Starting VE …
VE is mounted
Adding IP address(es): 192.168.4.26
Setting CPU units: 1000
Set hostname: admin26
File resolv.conf was modified
VE start in progress…

# vzctl set 26 – -userpasswd root:bcrY67LD3 –save

Changing password for user root.
passwd: all authentication tokens updated successfully.
Saved parameters for VE 26
Now use vzlist to show which virtual servers are running.

# vzlist -a

VEID      NPROC STATUS  IP_ADDR         HOSTNAME
26         16 running 192.168.4.26    admin26

2 comments:

  1. Hello there, I do believe your site could possibly be having internet browser compatibility issues.

    Whenever I take a look at your web site in Safari, it looks fine but when opening
    in Internet Explorer, it has some overlapping issues.
    I merely wanted to give you a quick heads up! Other than that,
    great site!
    Here is my site - uk based web hosting

    ReplyDelete
  2. Thank you a lot for sharing this with all folks you actually recognize what you're speaking approximately! Bookmarked. Please also consult with my site =). We could have a link trade contract among us
    Feel free to visit my blog post - Ipad Squeeze

    ReplyDelete