LXC Project Part 2: Setting up LXC
By EricMesa
- 2 minutes read - 260 wordsI’m continuing on from yesterday’s post to get the VM ready to host LXC. I’m starting with Centos 7 so the first thing I had to do was enable the epel repos:
yum install epel-release
Then, according to the guide I was following, I had to also install these package:
yum install debootstrap perl libvirt
That installed a bunch of stuff. I also get that they’re trying to break out what they’re doing, but they probably could have installed both that and the LXC stuff below in one blow:
yum install lxc lxc-templates
Then start the services we just installed:
systemctl start lxc.service
systemctl start libvirtd
Then, a good thing to do to make sure everything’s working correctly is to run the following:
lxc-checkconfig
If you get all “enabled” (in Centos 7 it’s also green), then you’re in good shape. You can see which templates you have installed with the following command:
ls -alh /usr/share/lxc/templates/
When I did that, I had alpine, altlinux, busybox, centos, cirros, debian, fedora, gentoo, openmandriva, opensuse, oracle, ubuntu, and ubuntu-cloud.
As my last act of this post, I’ll create my first container:
lxc-create -n lemmy -t centos
This is going to run Cockpit to keep an eye on servers on my network. After running that command, it looked like a yum or dnf install was happening. Then it did some more stuff and then told me what the root password was. It also told me how to change it without having to start the container. So I did that. Next time…starting and running a container.