In the previous blog post, I mainly talked about the simple management of lxc container on Linux. For a review, please refer to https://www.cnblogs.com/qiuhom-1874/p/12901493.html Today we will introduce lxc's image management tool, LXC WEB Panel;
Project download address: https://github.com/lxc-webpanel/LXC-Web-Panel.git;
1. Install Python flask
[root@lxc ~]# yum install python-flask Loaded plugins: fastestmirror base | 3.6 kB 00:00:00 epel | 4.7 kB 00:00:00 extras | 2.9 kB 00:00:00 updates | 2.9 kB 00:00:00 (1/2): epel/x86_64/updateinfo | 1.0 MB 00:00:00 (2/2): epel/x86_64/primary_db | 6.8 MB 00:00:01 Loading mirror speeds from cached hostfile * base: mirrors.aliyun.com * extras: mirrors.aliyun.com * updates: mirrors.aliyun.com Resolving Dependencies --> Running transaction check ---> Package python-flask.noarch 1:0.10.1-5.el7_7 will be installed --> Processing Dependency: python-werkzeug for package: 1:python-flask-0.10.1-5.el7_7.noarch --> Processing Dependency: python-jinja2 for package: 1:python-flask-0.10.1-5.el7_7.noarch --> Processing Dependency: python-itsdangerous for package: 1:python-flask-0.10.1-5.el7_7.noarch --> Running transaction check ---> Package python-itsdangerous.noarch 0:0.23-2.el7 will be installed ---> Package python-jinja2.noarch 0:2.7.2-4.el7 will be installed --> Processing Dependency: python-babel >= 0.8 for package: python-jinja2-2.7.2-4.el7.noarch --> Processing Dependency: python-markupsafe for package: python-jinja2-2.7.2-4.el7.noarch ---> Package python-werkzeug.noarch 0:0.9.1-2.el7 will be installed --> Running transaction check ---> Package python-babel.noarch 0:0.9.6-8.el7 will be installed ---> Package python-markupsafe.x86_64 0:0.11-10.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved ========================================================================================== Package Arch Version Repository Size ========================================================================================== Installing: python-flask noarch 1:0.10.1-5.el7_7 extras 205 k Installing for dependencies: python-babel noarch 0.9.6-8.el7 base 1.4 M python-itsdangerous noarch 0.23-2.el7 extras 24 k python-jinja2 noarch 2.7.2-4.el7 base 519 k python-markupsafe x86_64 0.11-10.el7 base 25 k python-werkzeug noarch 0.9.1-2.el7 extras 562 k Transaction Summary ========================================================================================== Install 1 Package (+5 Dependent packages) Total download size: 2.7 M Installed size: 12 M Is this ok [y/d/N]: y Downloading packages: (1/6): python-flask-0.10.1-5.el7_7.noarch.rpm | 205 kB 00:00:00 (2/6): python-itsdangerous-0.23-2.el7.noarch.rpm | 24 kB 00:00:00 (3/6): python-babel-0.9.6-8.el7.noarch.rpm | 1.4 MB 00:00:00 (4/6): python-markupsafe-0.11-10.el7.x86_64.rpm | 25 kB 00:00:00 (5/6): python-jinja2-2.7.2-4.el7.noarch.rpm | 519 kB 00:00:00 (6/6): python-werkzeug-0.9.1-2.el7.noarch.rpm | 562 kB 00:00:00 ------------------------------------------------------------------------------------------ Total 3.0 MB/s | 2.7 MB 00:00:00 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : python-werkzeug-0.9.1-2.el7.noarch 1/6 Installing : python-itsdangerous-0.23-2.el7.noarch 2/6 Installing : python-babel-0.9.6-8.el7.noarch 3/6 Installing : python-markupsafe-0.11-10.el7.x86_64 4/6 Installing : python-jinja2-2.7.2-4.el7.noarch 5/6 Installing : 1:python-flask-0.10.1-5.el7_7.noarch 6/6 Verifying : python-markupsafe-0.11-10.el7.x86_64 1/6 Verifying : python-babel-0.9.6-8.el7.noarch 2/6 Verifying : python-itsdangerous-0.23-2.el7.noarch 3/6 Verifying : python-jinja2-2.7.2-4.el7.noarch 4/6 Verifying : 1:python-flask-0.10.1-5.el7_7.noarch 5/6 Verifying : python-werkzeug-0.9.1-2.el7.noarch 6/6 Installed: python-flask.noarch 1:0.10.1-5.el7_7 Dependency Installed: python-babel.noarch 0:0.9.6-8.el7 python-itsdangerous.noarch 0:0.23-2.el7 python-jinja2.noarch 0:2.7.2-4.el7 python-markupsafe.x86_64 0:0.11-10.el7 python-werkzeug.noarch 0:0.9.1-2.el7 Complete! [root@lxc ~]#
Tip: LXC WEB Panel is developed with the flash framework, so it depends on the python flash package. Of course, it can also be downloaded with pip
Pip to install flash, first install Python pip
[root@docker_node1 ~]# yum install python-pip Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirrors.aliyun.com * extras: mirrors.aliyun.com * updates: mirrors.aliyun.com Resolving Dependencies --> Running transaction check ---> Package python2-pip.noarch 0:8.1.2-12.el7 will be installed --> Processing Dependency: python-setuptools for package: python2-pip-8.1.2-12.el7.noarch --> Running transaction check ---> Package python-setuptools.noarch 0:0.9.8-7.el7 will be installed --> Processing Dependency: python-backports-ssl_match_hostname for package: python-setuptools-0.9.8-7.el7.noarch --> Running transaction check ---> Package python-backports-ssl_match_hostname.noarch 0:3.5.0.1-1.el7 will be installed --> Processing Dependency: python-ipaddress for package: python-backports-ssl_match_hostname-3.5.0.1-1.el7.noarch --> Processing Dependency: python-backports for package: python-backports-ssl_match_hostname-3.5.0.1-1.el7.noarch --> Running transaction check ---> Package python-backports.x86_64 0:1.0-8.el7 will be installed ---> Package python-ipaddress.noarch 0:1.0.16-2.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved ======================================================================================== Package Arch Version Repository Size ======================================================================================== Installing: python2-pip noarch 8.1.2-12.el7 epel 1.7 M Installing for dependencies: python-backports x86_64 1.0-8.el7 base 5.8 k python-backports-ssl_match_hostname noarch 3.5.0.1-1.el7 base 13 k python-ipaddress noarch 1.0.16-2.el7 base 34 k python-setuptools noarch 0.9.8-7.el7 base 397 k Transaction Summary ======================================================================================== Install 1 Package (+4 Dependent packages) Total download size: 2.1 M Installed size: 9.4 M Is this ok [y/d/N]: y Downloading packages: (1/5): python-backports-1.0-8.el7.x86_64.rpm | 5.8 kB 00:00:00 (2/5): python-ipaddress-1.0.16-2.el7.noarch.rpm | 34 kB 00:00:00 (3/5): python-backports-ssl_match_hostname-3.5.0.1-1.el7.noarch. | 13 kB 00:00:00 (4/5): python-setuptools-0.9.8-7.el7.noarch.rpm | 397 kB 00:00:00 (5/5): python2-pip-8.1.2-12.el7.noarch.rpm | 1.7 MB 00:00:00 ---------------------------------------------------------------------------------------- Total 2.3 MB/s | 2.1 MB 00:00 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : python-backports-1.0-8.el7.x86_64 1/5 Installing : python-ipaddress-1.0.16-2.el7.noarch 2/5 Installing : python-backports-ssl_match_hostname-3.5.0.1-1.el7.noarch 3/5 Installing : python-setuptools-0.9.8-7.el7.noarch 4/5 Installing : python2-pip-8.1.2-12.el7.noarch 5/5 Verifying : python-ipaddress-1.0.16-2.el7.noarch 1/5 Verifying : python-setuptools-0.9.8-7.el7.noarch 2/5 Verifying : python2-pip-8.1.2-12.el7.noarch 3/5 Verifying : python-backports-1.0-8.el7.x86_64 4/5 Verifying : python-backports-ssl_match_hostname-3.5.0.1-1.el7.noarch 5/5 Installed: python2-pip.noarch 0:8.1.2-12.el7 Dependency Installed: python-backports.x86_64 0:1.0-8.el7 python-backports-ssl_match_hostname.noarch 0:3.5.0.1-1.el7 python-ipaddress.noarch 0:1.0.16-2.el7 python-setuptools.noarch 0:0.9.8-7.el7 Complete! [root@docker_node1 ~]# pip -V pip 8.1.2 from /usr/lib/python2.7/site-packages (python 2.7) [root@docker_node1 ~]#
Tip: the default pip of yum installation is 8.1.2 of python2.7. If we use pip to install flask, we will be prompted that the PIP version is low. If you don't want to see the prompt that the PIP version is too low, you can choose pip install --upgrade pip command to update the PIP version
Install flask
[root@docker_node1 ~]# pip install flask Collecting flask Downloading https://files.pythonhosted.org/packages/f2/28/2a03252dfb9ebf377f40fba6a7841b47083260bf8bd8e737b0c6952df83f/Flask-1.1.2-py2.py3-none-any.whl (94kB) 100% |████████████████████████████████| 102kB 11kB/s Collecting Jinja2>=2.10.1 (from flask) Downloading https://files.pythonhosted.org/packages/30/9e/f663a2aa66a09d838042ae1a2c5659828bb9b41ea3a6efa20a20fd92b121/Jinja2-2.11.2-py2.py3-none-any.whl (125kB) 100% |████████████████████████████████| 133kB 10kB/s Collecting itsdangerous>=0.24 (from flask) Downloading https://files.pythonhosted.org/packages/76/ae/44b03b253d6fade317f32c24d100b3b35c2239807046a4c953c7b89fa49e/itsdangerous-1.1.0-py2.py3-none-any.whl Collecting click>=5.1 (from flask) Downloading https://files.pythonhosted.org/packages/d2/3d/fa76db83bf75c4f8d338c2fd15c8d33fdd7ad23a9b5e57eb6c5de26b430e/click-7.1.2-py2.py3-none-any.whl (82kB) 100% |████████████████████████████████| 92kB 10kB/s Collecting Werkzeug>=0.15 (from flask) Downloading https://files.pythonhosted.org/packages/cc/94/5f7079a0e00bd6863ef8f1da638721e9da21e5bacee597595b318f71d62e/Werkzeug-1.0.1-py2.py3-none-any.whl (298kB) 100% |████████████████████████████████| 307kB 9.8kB/s Collecting MarkupSafe>=0.23 (from Jinja2>=2.10.1->flask) Downloading https://files.pythonhosted.org/packages/fb/40/f3adb7cf24a8012813c5edb20329eb22d5d8e2a0ecf73d21d6b85865da11/MarkupSafe-1.1.1-cp27-cp27mu-manylinux1_x86_64.whl Installing collected packages: MarkupSafe, Jinja2, itsdangerous, click, Werkzeug, flask Successfully installed Jinja2-2.11.2 MarkupSafe-1.1.1 Werkzeug-1.0.1 click-7.1.2 flask-1.1.2 itsdangerous-1.1.0 You are using pip version 8.1.2, however version 20.1 is available. You should consider upgrading via the 'pip install --upgrade pip' command. [root@docker_node1 ~]# pip list|grep "Flask" Flask (1.1.2) You are using pip version 8.1.2, however version 20.1 is available. You should consider upgrading via the 'pip install --upgrade pip' command. [root@docker_node1 ~]#
Tip: you can see that flash has been installed, and the version is 1.1.2
2. Install debootstrap
[root@docker_node1 ~]# yum install -y debootstrap Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirrors.aliyun.com * extras: mirrors.aliyun.com * updates: mirrors.aliyun.com Resolving Dependencies --> Running transaction check ---> Package debootstrap.noarch 0:1.0.109-2.el7 will be installed --> Processing Dependency: dpkg for package: debootstrap-1.0.109-2.el7.noarch --> Running transaction check ---> Package dpkg.x86_64 0:1.18.25-9.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved ======================================================================================== Package Arch Version Repository Size ======================================================================================== Installing: debootstrap noarch 1.0.109-2.el7 epel 84 k Installing for dependencies: dpkg x86_64 1.18.25-9.el7 epel 1.3 M Transaction Summary ======================================================================================== Install 1 Package (+1 Dependent package) Total download size: 1.4 M Installed size: 6.2 M Downloading packages: (1/2): debootstrap-1.0.109-2.el7.noarch.rpm | 84 kB 00:00:00 (2/2): dpkg-1.18.25-9.el7.x86_64.rpm | 1.3 MB 00:00:00 ---------------------------------------------------------------------------------------- Total 2.6 MB/s | 1.4 MB 00:00 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : dpkg-1.18.25-9.el7.x86_64 1/2 Installing : debootstrap-1.0.109-2.el7.noarch 2/2 Verifying : debootstrap-1.0.109-2.el7.noarch 1/2 Verifying : dpkg-1.18.25-9.el7.x86_64 2/2 Installed: debootstrap.noarch 0:1.0.109-2.el7 Dependency Installed: dpkg.x86_64 0:1.18.25-9.el7 Complete! [root@docker_node1 ~]#
Tip: when creating ubuntu containers, you need to rely on debootstrap;
3. Install LXC components
Please refer to https://www.cnblogs.com/qiuhom-1874/p/12901493.html ; if your host is already installed, you can skip this step
4. Clone LXC WEB Panel project to local
[root@docker_node1 ~]# git clone https://github.com/lxc-webpanel/LXC-Web-Panel.git Cloning into 'LXC-Web-Panel'... remote: Enumerating objects: 243, done. remote: Total 243 (delta 0), reused 0 (delta 0), pack-reused 243 Receiving objects: 100% (243/243), 198.33 KiB | 205.00 KiB/s, done. Resolving deltas: 100% (108/108), done. [root@docker_node1 ~]# ls LXC-Web-Panel [root@docker_node1 ~]# cd LXC-Web-Panel/ [root@docker_node1 LXC-Web-Panel]#
5. Start LXC WEB Panel
Prompt: after the LXC WEB Panel is successfully started, it will prompt us to access the 5000 port of the machine as shown in the figure above;
Now the LXC WEB Panel is set up. Next, we can access port 5000 and log in to LXC WEB Panel to manage our LXC container;
Tip: the default user name and password are admin
Tip: after logging in LXC WEB Panel, we will be prompted to create a container when there is no container. Note here that if there is no virtual bridge on your host, you need to create a bridge and create a new container. Otherwise, the new container cannot be started;
New bridge please refer to https://www.cnblogs.com/qiuhom-1874/p/12901493.html If I use the graphical interface to create the network, I will report an error. I don't know the reason. I have to manually create it on the Linux shell terminal;
After creating the bridge, start the container you just created, and it will start normally
Tip: you can see that after we create the bridge, we can start the container normally; if you have other bridges on your host, we can edit u1 to match the bridges and types on your host, give an ip address, and then start it without any problem; as shown below
Note: other types of link s should be noted. The docker0 bridge and virbr0 bridge above are both virtual bridges, so the type is veth; It should also be noted here that if the type is filled incorrectly, the service will be unavailable. The solution is to delete the directory corresponding to the container name of / var/lib/lxc / and restart LXC web portal. The above is the simple management of LXC image management LXC web portal. More management can build a play by themselves;