openvz

sudo apt-get update && sudo apt-get install e2fsprogs
apt-get install e2fsprogs uml-utilities screen


sudo ip tuntap add tap0 mode tap
sudo ip addr add 10.0.0.1/24 dev tap0
sudo ip link set tap0 up
sudo iptables -P FORWARD ACCEPT
sudo iptables -t nat -A POSTROUTING -o venet0 -j MASQUERADE
sudo iptables -t nat -A PREROUTING -p tcp --dport 22 -j RETURN
sudo iptables -t nat -A PREROUTING -p tcp --dport 33333 -j RETURN
sudo iptables -t nat -A PREROUTING -i venet0 -j DNAT --to-destination 10.0.0.2

iptables-save

cd /

wget http://soft.91yun.org/uml/64/uml.tar.xz
tar xvJf uml.tar.xz

cd /uml-64
resize2fs rootfs 3G

nohup ./vmlinux ubda=rootfs eth0=tuntap,tap0 mem=256m &disown
cd /uml-64

screen /dev/pts/1

screen -r

apt update


apt-get install python3
update-alternatives --install /usr/bin/python python /usr/bin/python3.4 2
python --version


开机载入UML:
1
编辑 /etc/rc.local , 在 “exit 0” 之前加入命令 /bin/su root -c “/usr/bin/screen -dmS vmlinux bash -c ‘/opt/uml-64/run.sh; exec bash'”

....................

2
在新增一个 /opt/uml-64/run.sh 命令档, 填入以下内容, 并给予可执行权限: chmod +x /opt/uml-64/run.sh.
#!/bin/sh
/opt/uml-64/vmlinux ubda=/opt/uml-64/rootfs eth0=tuntap,tap0 mem=384m