![](https://img.haomeiwen.com/i6044565/84fa91af63ee5120.png)
Virtualization and Container
![](https://img.haomeiwen.com/i6044565/d06b9dc9e505d0a0.png)
KVM/LXC
![](https://img.haomeiwen.com/i6044565/8ee9cbe46757a7ea.png)
LXC Architecture
ls /proc/sys/
ls /proc/sys/kernel/
cat /proc/sys/kernel/hostname
按需 配给
yum info lxc*
yum -y install lxc lxc-templates
rpm -ql lxc| less
rpm -ql lxc-templates
/usr/share/lxc/templates/lxc-centos 创建centos的模板文件
lxc-checkconfig
lxc-create -h
lxc-create -n c1 -t /usr/share/lxc/templates/lxc-centos 创建lxc虚拟机c1
chroot /var/lib/lxc/c1/rootfs passwd 修改密码
lxc-start -n c1 启动c1,输入账号和密码即可登录,如下图1
c1上操作
ip a 显示:eth0@if7--192.168.122.96/24
ping www.qq.com 可以ping通
yum -y install lrzsz
rz 上传epel-release-latest-7.noarch.rpm包
yum repolist
yum -y install nginx
lxc-create -n c2 -t /usr/share/lxc/templates/lxc-centos
chroot /var/lib/lxc/c1/rootfs passwd 修改密码
lxc-start -n c2 启动c2
c2操作
ip a 显示:eth0@if9--192.168.122.45/24
ping www.qq.com
ping 192.168.122.96
yum -y install lrzsz
rz 上传epel-release-latest-7.noarch.rpm包
yum repolist
yum -y install nginx
node1上操作
lxc-info --name c1/c2
lxc-top
yum -y install git
git clone https://github.com/lxc-webpanel/LXC-Web-Panel.git
yum -y install python-flask
cd LXC-Web-Panel/
python lwp.py
显示: * Running on http://0.0.0.0:5000/
浏览器:http://192.168.1.7:5000/
账号和密码是admin/admin
![](https://img.haomeiwen.com/i6044565/548cf95b8b3290c3.png)
图1
![](https://img.haomeiwen.com/i6044565/3592907c5204a728.png)
图2
![](https://img.haomeiwen.com/i6044565/bec543c85d00330d.png)
图3
网友评论