Linux installation and deployment of LXC method details

  

Linux Container container is a kernel virtualization technology, referred to as LXC, is a lightweight virtualization means, then how to install and deploy LXC? The following small series will introduce you to the installation and deployment method of LXC under Linux.

LXC Linux container tools is the Chinese name, the container can provide lightweight virtualization to isolate processes and resources, the advantages of using LXC is no need to install a lot of software packages, the course also It does not take up too much resources. This article introduces the establishment and management methods of LXC and the setting methods of virtual network interfaces step by step.

LXC relies on the cgroups (Control Groups) system of the Linux kernel for resource management. The cgroups system is a process group-based resource management framework provided by the Linux kernel that limits the resources available for a specific process group. . It was originally proposed by Google engineers and later integrated into the Linux kernel. Cgroups is also a resource management tool used by LXC to implement virtualization. LXC is now in the Linux kernel, which means LXC technology will be the most competitive lightweight virtual container technology available today.

1. Set up the first LXC virtual machine

#yum install lxc*

2. After installing the package, check the kernel support for LXC in the Linux distribution. You can use the following command

#lxc-checkconfig

#lxc-checkconfig After the command is checked, if all items show "ld"; enabled” means you can use LXC directly

3. Create A fedora Server LXC virtual computer system

#lxc-create -t ​​fedora -n testA

#here is a fedora template, template files are saved in /usr/lib/lxc/templates/Directory

After the above command is completed, the virtual machine testA

will be generated in the /var/lib/lxc directory. 4. Check the created virtual machine system

#tree - L 2 /var/lib/lxc/

5, start the LXC virtual machine

# lxc-start -n testA

After confirming the account and password, log in to the virtual machine
>

6. List all containers in the current system

# lxc-ls

7. Use console to board Container

#lxc-console -n testA –t 3

8. Stop running a container

# lxc-stop -n testA

9 Get the state of a container

# lxc-info -n ol6ctr1

10. Destroy a container

# lxc-destroy -n testA1

11. Copy a container

# lxc-clone -o testA -n ol6ctr2

12. Pause or resume a container

# lxc-freeze -n testA

# lxc-unfreeze -n testA

13. Modify the LXC network interface

# vi /etc/default/lxc

# Restart the network after the user changes Service

#service lxc-net restart

The above is the introduction of the LXC installation method in Linux system. LXC has entered the Linux kernel and it is necessary to build LXC for Linux system. If you want to install LXC, let's take a look.

Copyright © Windows knowledge All Rights Reserved