Fail count check in vps
cat /proc/user_beancounters
change the IP limit use the following from main node
vzctl set <container ID> --numiptent <limit> --save
(OR)
//edit the file
/etc/sysconfig/vz-scripts/<containerID>.conf
Script to check the load averages of every vps
cd /vz/root
for x in `ls`; do echo $x; vzctl exec $x w | grep load; done
Command to increasing memory in slm mode
vzctl set 181 --slmmemorylimit 512M:1024M --save
Install OpenVZ
*********************************************************************************************************************************************************
Create the following partitions on the Hardware Node:
Partition Description Typical size
/ Root partition containing all Hardware Node operating systemfiles 2-4 Gb
swap Paging partition for the Linux operating system 2 times RAM
/vz Partition to host OpenVZ templates and Virtual Private Servers all the remaining space on the hard disk
(suggested to use the ext3 file system for this)
Downloading and installing OpenVZ kernel
Download the apropriate kernel binery rpm from http://openvz.org/download/kernel/. depending on the hardware.
Example: RHEL5 + x86(i686)
wget http://download.openvz.org/kernel/branches/rhel5-2.6.18/028stab064.7/ovzkernel-2.6.18-128.2.1.el5.028stab064.7.i686.rpm
rpm -ivh ovzkernel-2.6.18-128.2.1.el5.028stab064.7.i686.rpm
configure the boot loader
In case you use the GRUB loader, it will be configured automatically. You should only make
sure that the lines below are present in the /boot/grub/grub.conf file on the Node
title Fedora Core (2.6.8-022stab029.1)
root (hd0,0)
kernel /vmlinuz-2.6.8-022stab029.1 ro root=/dev/sda5 quiet rhgb
initrd /initrd-2.6.8-022stab029.1.img
However, I recommend that you configure this file in the following way:
Change Fedora Core to OpenVZ (just for clarity, so the OpenVZ kernels will not bemixed up with non OpenVZ ones).
Remove all extra arguments from the kernel line, leaving only the root=... parameter.At the end, the modified grub.conf file should look as follows:
title OpenVZ (2.6.8-022stab029.1)
root (hd0,0)
kernel /vmlinuz-2.6.8-022stab029.1 ro root=/dev/sda5
initrd /initrd-2.6.8-022stab029.1.img
Setting sysctl parameters
There are a number of kernel limits that should be set for OpenVZ to work correctly. OpenVZ is
shipped with a tuned /etc/sysctl.conf file. Below are the contents of the relevant part of
/etc/sysctl.conf
# On Hardware Node we generally need
# packet forwarding enabled and proxy arp disabled
net.ipv4.ip_forward = 1
net.ipv4.conf.default.proxy_arp = 0
# Enables source route verification
net.ipv4.conf.all.rp_filter = 1
# Enables the magic-sysrq key
kernel.sysrq = 1
# TCP Explict Congestion Notification
#net.ipv4.tcp_ecn = 0
# we do not want all our interfaces to send redirects
net.ipv4.conf.default.send_redirects = 1
net.ipv4.conf.all.send_redirects = 0
Please edit the file as described. To apply the changes issue the following command:
# sysctl -p
Alternatively, the changes will be applied upon the following reboot.
It is also worth mentioning
that normally
you
should have forwarding
(net.ipv4.ip_forward) turned on since the Hardware Node forwards the packets destined
to or originating from the Virtual Private Servers.
After that, you should reboot your computer and choose "OpenVZ" on the boot loader menu
Downloadins and installing OpenVZ packages
After you have successfully installed and booted the OpenVZ kernel, you can proceed with installing the user-level tools for OpenVZ.
You should install the following OpenVZ packages:
vzctl: this package is used to perform different tasks on the OpenVZ Virtual Private Servers (create, destroy, start, stop, set parameters etc.).
vzquota: this package is used to manage the VPS quotas.
vzpkg: this package is used to work with OpenVZ templates.
You can download the corresponding binary RPMs from http://openvz.org/download/utils/.
Now you can launch OpenVZ. To this effect, execute the following command:
# /etc/init.d/vz start
This will load all the needed OpenVZ kernel modules. During the next reboot, this script will be
executed automatically
Installing OS templates
Template (or package set) is a set of package files to be installed into a VPS. Operating systemtemplates are used to create new Virtual Private Servers with a pre-installed operating system.
Therefore, you are bound to download at least one OS template fromhttp://openvz.org/download/template/ and install it.
I recommended you to install OS template by using .tar file. I think it is more better than RPM
Download the TAR file in /vz/template/cache/
Example: (For centos5)
wget http://download.openvz.org/template/precreated/centos-5-x86.tar.gz
Then
vzctl create 101 --ostemplate centos-5-x86
Other needed steps
# vzctl set 101 --onboot yes --save
# vzctl set 101 --hostname test101.my.org --save
# vzctl set 101 --ipadd 10.0.186.1 --save
# vzctl set 101 --nameserver 192.168.1.165 --save
# vzctl set 101 --userpasswd root:test
**********************************************************************************************************
Insert kernel modules
=================
modprobe -l ipt_MASQUERADE
cp /lib/modules/2.6.18-164.10.1.el5.028stab067.4/kernel/net/ipv4/netfilter/ipt_MASQUERADE.ko /vz/private/54280/lib/modules/2.6.18-028stab066.8/
vzctl enter 54280
@208.89.214.200
Fix for "Unable to open pty: No such file or directory'
=======================================
vzctl exec VEID /sbin/MAKEDEV pty
vzctl exec VEID /sbin/MAKEDEV tty
vzctl enter VEID
To Fix this issue permanently:
1. Edit the file /etc/rc.sysinit of the VPS server
2. Comment the line
#/sbin/start_udev
3. Add the following lines after /sbin/start_udev:
/sbin/MAKEDEV tty
/sbin/MAKEDEV pty
4. Reboot your VPS
vzctl restart VEID
(OR)
vzctl exec veid update-rc.d -f udev remove
vzctl restart veid