Install openvz machine on kvm centos 6.9

Environment:
KVM machine CentOS 6.9
Cpu Xeon 4114
RAM 12 GB
Disk 300 GB SSD

Here are the main steps from the main part of the operation: https://openvz.org/Quick_installation_(legacy)
And Google.

1 Step:Install openvz

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
yum update -y
yum install -y wget
wget -P /etc/yum.repos.d/ https://download.openvz.org/openvz.repo
rpm --import http://download.openvz.org/RPM-GPG-Key-OpenVZ
yum install -y vzkernel.x86_64
yum install -y vzctl vzquota ploop
 
sed -i 's/kernel.sysrq = 0/kernel.sysrq = 1/g' /etc/sysctl.conf
sed -i 's/net.ipv4.ip_forward = 0/net.ipv4.ip_forward = 1/g' /etc/sysctl.conf
echo 'net.ipv4.conf.default.proxy_arp = 0' >> /etc/sysctl.conf
echo 'net.ipv4.conf.all.rp_filter = 1' >> /etc/sysctl.conf
echo 'net.ipv4.conf.default.send_redirects = 1' >> /etc/sysctl.conf
echo 'net.ipv4.conf.all.send_redirects = 0' >> /etc/sysctl.conf
echo 'net.ipv4.icmp_echo_ignore_broadcasts=1' >> /etc/sysctl.conf
echo 'net.ipv4.conf.default.forwarding=1' >> /etc/sysctl.conf
sysctl -p
sed -i 's/NEI**OUR_DEVS=detect/NEI**OUR_DEVS=all/g' /etc/vz/vz.conf
sed -i 's/options nf_conntrack ip_conntrack_disable_ve0=1/options nf_conntrack ip_conntrack_disable_ve0=0/g' /etc/modprobe.d/openvz.conf
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/sysconfig/selinux
reboot

[[email protected]~]# uname -r
2.6.32-042stab123.9

2 Step:Install OpenVZ Web Panel

wget -O – https://raw.githubusercontent.com/sibprogrammer/owp/master/installer/ai.sh | sh

Open your browser,enter yourip:3000
username and password:admin/admin

After landing set ip easy to create machine.

OpenVZ Web Panel can be very convenient in the background to download the template to create delete chicks set cpu limit more can own experience.

Set nat:
iptables -t nat -A POSTROUTING -s 192.168.1.0/24 -o eth0 -j SNAT –to 8.8.8.8
8.8.8.8修改为你kvm的ip

Test whether the machine can access the external network
vzctl exec 100 ping 8.8.8.8 -c 4

Intranet port forwarding:
192.168.1.1 22 port forwarding to external network 2222 can be based on this forwarding 80 443 or other port
iptables -t nat -A PREROUTING -i eth0 -p tcp -m tcp –dport 2222 -j DNAT –to-destination 192.168.1.1:22

Save and restart iptables
service iptables save
service iptables restart

The biggest feeling is that openvz vps for the host business is completely transparent
vzctl enter ID
Go directly to your vps!