Openvz7 : Install and Basics
This article relied to openvz7/virtuozzo.
You may use ovz7 on RHEL7/Centos7 x64 OS. But we used to download exact openvz7 iso and install bare metal system : info: https://openvz.org/Virtuozzo ISO: https://download.openvz.org/virtuozzo/releases/7.0/x86_64/iso/
Once the system installed make sure it's updated
yum update&&yum upgrade
check kernel&OS build and install corresponding openvz
uname -a cat /etc/issue
Assuming you've used minimal ISO/netinstall so you need to download/install openvz,example link:
yum localinstall https://download.openvz.org/virtuozzo/releases/openvz-7.0.6-518/x86_64/os/Packages/o/openvz-release-7.0.6-5.vz7.x86_64.rpm
- in some cases (mostly on x32 systems ) you'll get an error of missed dep. "python_subprocess32". you can install it if required:
#wget http://cbs.centos.org/kojifiles/packages/python-subprocess32/3.2.6/7.el7/x86_64/python-subprocess32-3.2.6-7.el7.x86_64.rpm #rpm -i python-subprocess32-3.2.6-7.el7.x86_64.rpm
Virtuozzo/openvz 7 config located as in previous versions:
cat /etc/vz/vz.conf
Install openvz kernel.
(Check the cat /boot/grub2/grub.cfg before and after you'll see the changes after installing)
yum install vzkernel
Reboot system
We are using tolls from epel repo so we'll add it:
yum install epel-release
Check the repolist you have:
yum repolist Loaded plugins: fastestmirror, openvz, priorities, product-id, rhsm-auto-add-pools, search-disabled-repos, vzlinux Trying to discover and attach new pools Loading mirror speeds from cached hostfile * epel: nl.mirror.babylon.network * openvz-os: ftp.nluug.nl * openvz-updates: ftp.nluug.nl 557 packages excluded due to repository priority protections repo id repo name status !epel/x86_64 Extra Packages for Enterprise Linux 7 - x86_64 11,882+460 !openvz-os OpenVZ 198 !openvz-updates OpenVZ Updates 11 !virtuozzolinux-base VirtuozzoLinux Base 10,147+98 !virtuozzolinux-factory VirtuozzoLinux Factory 0 !virtuozzolinux-factory-debuginfo VirtuozzoLinux Factory debug packages 0 !virtuozzolinux-updates VirtuozzoLinux Updates
Install prtctl (used instead of vzctl, that also may be installed) and ploop
yum install prlctl prl-disp-service ploop
Now you need to install EZ OS Templates. The openvz7 have rather differ "understanding" of OS templates that makes life easier: Check available EZ OS Templates:
vzpkg list --available centos-6-x86_64 openvz-os centos-7-x86_64 openvz-os debian-7.0-x86_64 openvz-os debian-8.0-x86_64 openvz-os debian-9.0-x86_64 openvz-os fedora-23-x86_64 openvz-os sles-11-x86_64 openvz-os sles-12-x86_64 openvz-os suse-42.1-x86_64 openvz-os suse-42.2-x86_64 openvz-os suse-42.3-x86_64 openvz-os ubuntu-14.04-x86_64 openvz-os ubuntu-16.04-x86_64 openvz-os ubuntu-17.10-x86_64 openvz-os vzlinux-6-x86_64 openvz-os vzlinux-7-x86_64 openvz-os
Install template package, like:
vzpkg install template centos-7-x86_64
For some templates you need to configure additional parameters in map file /etc/vztt/url.map Check https://docs.virtuozzo.com/virtuozzo_7_users_guide/managing-virtual-machines-and-containers/creating-virtual-machines-and-containers.html for details. For example fro SLES template you need to set the $RCE parameter and SUSE repository credentials.
We'll skip it coz we use usual Centos7
ALso EZ template could be installed using
yum install centos-7-x86_64-ez
and removed in the same way for example
yum remove centos-7-x86_64-ez
Next create template cache:
vzpkg create cache centos-7-x86_64
Now you can create the container:
prlctl create 101 --vmtype ct --ostemplate centos-7-x86_64
Old style also should work:
vzctl create 102 --ostemplate centos-7-x86_64
Check container list:
prlctl list -i
Start container:
prlctl start 101
As you may note the containers private area usually locates /vz/private/CTID/ Containers config located in /etc/vz/config/ but used EnvID instead old_ID , like
cat /etc/vz/conf/9ae18ebf-0e6c-4f7f-8c3d-5dc683da7da4.conf
as we did not change default OS template and not using any management software at this point we need to add IP to the CT manually in config file. open the file specified above (the exact EnvID will be differ) and add the next lines depending on your network:
IP_ADDRESS="191.111.201.11" HOSTNAME="testCT.vpsget.com" NAMESERVER="8.8.8.8"
restart container
prlctl restart 101
To enter inside container you may use the next commands:
prlctl enter 101
or
vzctl enter 101
Also entering by exact ID working as well:
vzctl enter 9ae18ebf-0e6c-4f7f-8c3d-5dc683da7da4
To exit from CT type :
exit
you also may use vzlist command to display list of containers:
vzlist
Virtual Machines usage KVM based/virtio.
Openvz7 allow us to use VirtualMachines (VM) as well as containers! Try to create the new windows VM:
prlctl create winTest --distribution win-10 --vmtype vm
the required VM files will be placed at the next dir:
/vz/vmprivate/<UUID
The next step you need to install OS in VM using VNC. Enable VNC for VM created above:
prlctl set winTest --vnc-mode manual --vnc-port 5901 --vnc-passwd VNCPass1test
Start VM:
prlctl start winTest
Delete All suspended CMs/CTs:
prlctl list -a | grep suspended | awk '{print $1}' | xargs -L1 prlctl delete
...in proggress