CentOS 7.x installing lxc
From Notes_Wiki
<yambe:breadcrumb>CentOS_7.x_lxc|CentOS 7.x lxc</yambe:breadcrumb>
CentOS 7.x installing lxc
To install lxc use following steps:
- Install lxc package using
- yum -y install epel-release
- yum -y install debootstrap perl libvirt libcap-devel libcgroup wget bridge-utils
- yum -y install lxc lxc-templates lxc-extra
- Check that system supports lxc
- lxc-checkconfig
- Before booting a new kernel its support for lxc-can be checked using:
- CONFIG=/boot/config-3.10.0-514.2.2.el7.x86_64 /bin/lxc-checkconfig
- where config-3.10.0-514.2.2.el7.x86_64 should be replaced with configuration file for new kernel
- Start and enable lxc on boot
- systemctl start lxc.service
- systemctl enable lxc.service
- systemctl status lxc.service
- Reboot base host for more stability
Refer:
- http://www.tecmint.com/install-create-run-lxc-linux-containers-on-centos/
- http://www.itzgeek.com/how-tos/linux/centos-how-tos/setup-linux-container-with-lxc-on-centos-7-rhel-7.html
Get more space for lxc containers
To get more space for lxc-containers from other partition which by default use /var use following steps: (Replace /mnt/data1 in below steps and commands with mount-point where more space is available in your installation)
- Stop all running containers. Verify 'lxc-ls --active'
- mkdir /mnt/data1/lxc-files
- mkdir /mnt/data1/lxc-files/{var_cache_lxc,var_lib_lxc}
- mv /var/cache/lxc/* /mnt/data1/lxc-files/var_cache_lxc/
- rmdir /var/cache/lxc
- ln -s /mnt/data1/lxc-files/var_cache_lxc/ /var/cache/lxc
- mv /var/lib/lxc/* /mnt/data1/lxc-files/var_lib_lxc/
- rmdir /var/lib/lxc
- ln -s /mnt/data1/lxc-files/var_lib_lxc/ /var/lib/lxc
- lxc-ls
- Start a few containers and test
<yambe:breadcrumb>CentOS_7.x_lxc|CentOS 7.x lxc</yambe:breadcrumb>