Difference between revisions of "LXC Host"
Jump to navigation
Jump to search
Michael.mast (talk | contribs) |
Michael.mast (talk | contribs) |
||
| Line 1: | Line 1: | ||
==CentOS 7== | ==CentOS 7== | ||
| + | ===Basic Install=== | ||
<ref>http://www.tecmint.com/install-create-run-lxc-linux-containers-on-centos/</ref><ref>https://stgraber.org/2013/12/27/lxc-1-0-container-storage/</ref> | <ref>http://www.tecmint.com/install-create-run-lxc-linux-containers-on-centos/</ref><ref>https://stgraber.org/2013/12/27/lxc-1-0-container-storage/</ref> | ||
<pre> | <pre> | ||
| Line 5: | Line 6: | ||
[root@web ~]# yum install debootstrap perl libvirt | [root@web ~]# yum install debootstrap perl libvirt | ||
[root@web ~]# yum install lxc lxc-templates | [root@web ~]# yum install lxc lxc-templates | ||
| + | </pre> | ||
| + | ===ImportError: No module named 'lxc'=== | ||
| + | I ran into a problem when trying to list my containers. | ||
| + | <pre> | ||
| + | [root@nas ~]# lxc-ls | ||
| + | Traceback (most recent call last): | ||
| + | File "/usr/bin/lxc-ls", line 31, in <module> | ||
| + | import lxc | ||
| + | ImportError: No module named 'lxc' | ||
| + | |||
| + | </pre> | ||
| + | I assumed this was a kernel module which really messed me up. After a lot of wasted time I found out that this is a python module<ref>http://lxc-users.linuxcontainers.narkive.com/R1ziqqL4/lxc-ls-question</ref> | ||
| + | <br> | ||
| + | At this point I searched for the package but could not find it. | ||
| + | <pre> | ||
| + | [root@nas ~]# yum search python | grep python | grep lxc | ||
| + | python2-lxc.x86_64 : Python2 bindings for LXC | ||
| + | python34-lxc.x86_64 : Python binding for lxc | ||
| + | </pre> | ||
| + | Looks like python34-lxc is what I need. So I check my installed packages | ||
| + | <pre> | ||
| + | [root@nas ~]# yum list installed | grep python | grep lxc | ||
| + | python34-lxc.x86_64 | ||
| + | </pre> | ||
| + | It is already installed. So lets try re-installing | ||
| + | <pre> | ||
| + | [root@nas ~]# yum reinstall python34-lxc | ||
| + | Loaded plugins: fastestmirror | ||
| + | Loading mirror speeds from cached hostfile | ||
| + | * base: mirrors.usinternet.com | ||
| + | * epel: mirror.rnet.missouri.edu | ||
| + | * extras: centos2.zswap.net | ||
| + | * nux-dextop: li.nux.ro | ||
| + | * updates: mirror.atlanticmetro.net | ||
| + | Resolving Dependencies | ||
| + | --> Running transaction check | ||
| + | ---> Package python34-lxc.x86_64 0:1.0.11-1.el7 will be reinstalled | ||
| + | --> Finished Dependency Resolution | ||
| + | |||
| + | Dependencies Resolved | ||
| + | |||
| + | =================================================================================================================================================================================================================== | ||
| + | Package Arch Version Repository Size | ||
| + | =================================================================================================================================================================================================================== | ||
| + | Reinstalling: | ||
| + | python34-lxc x86_64 1.0.11-1.el7 epel 25 k | ||
| + | |||
| + | Transaction Summary | ||
| + | =================================================================================================================================================================================================================== | ||
| + | Reinstall 1 Package | ||
| + | |||
| + | Total download size: 25 k | ||
| + | Installed size: 54 k | ||
| + | Is this ok [y/d/N]: y | ||
| + | Downloading packages: | ||
| + | python34-lxc-1.0.11-1.el7.x86_64.rpm | 25 kB 00:00:00 | ||
| + | Running transaction check | ||
| + | Running transaction test | ||
| + | Transaction test succeeded | ||
| + | Running transaction | ||
| + | Installing : python34-lxc-1.0.11-1.el7.x86_64 1/1 | ||
| + | Verifying : python34-lxc-1.0.11-1.el7.x86_64 1/1 | ||
| + | |||
| + | Installed: | ||
| + | python34-lxc.x86_64 0:1.0.11-1.el7 | ||
| + | Complete! | ||
| + | </pre> | ||
| + | Now lets try again | ||
| + | <pre> | ||
| + | [root@nas ~]# lxc-ls | ||
| + | [root@nas ~]# | ||
</pre> | </pre> | ||
| + | I think we have success! | ||
Revision as of 10:11, 22 September 2018
CentOS 7
Basic Install
[root@web ~]# yum install epel-release [root@web ~]# yum install debootstrap perl libvirt [root@web ~]# yum install lxc lxc-templates
ImportError: No module named 'lxc'
I ran into a problem when trying to list my containers.
[root@nas ~]# lxc-ls
Traceback (most recent call last):
File "/usr/bin/lxc-ls", line 31, in <module>
import lxc
ImportError: No module named 'lxc'
I assumed this was a kernel module which really messed me up. After a lot of wasted time I found out that this is a python module[3]
At this point I searched for the package but could not find it.
[root@nas ~]# yum search python | grep python | grep lxc python2-lxc.x86_64 : Python2 bindings for LXC python34-lxc.x86_64 : Python binding for lxc
Looks like python34-lxc is what I need. So I check my installed packages
[root@nas ~]# yum list installed | grep python | grep lxc python34-lxc.x86_64
It is already installed. So lets try re-installing
[root@nas ~]# yum reinstall python34-lxc Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirrors.usinternet.com * epel: mirror.rnet.missouri.edu * extras: centos2.zswap.net * nux-dextop: li.nux.ro * updates: mirror.atlanticmetro.net Resolving Dependencies --> Running transaction check ---> Package python34-lxc.x86_64 0:1.0.11-1.el7 will be reinstalled --> Finished Dependency Resolution Dependencies Resolved =================================================================================================================================================================================================================== Package Arch Version Repository Size =================================================================================================================================================================================================================== Reinstalling: python34-lxc x86_64 1.0.11-1.el7 epel 25 k Transaction Summary =================================================================================================================================================================================================================== Reinstall 1 Package Total download size: 25 k Installed size: 54 k Is this ok [y/d/N]: y Downloading packages: python34-lxc-1.0.11-1.el7.x86_64.rpm | 25 kB 00:00:00 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : python34-lxc-1.0.11-1.el7.x86_64 1/1 Verifying : python34-lxc-1.0.11-1.el7.x86_64 1/1 Installed: python34-lxc.x86_64 0:1.0.11-1.el7 Complete!
Now lets try again
[root@nas ~]# lxc-ls [root@nas ~]#
I think we have success!