How to Use lxc Virtual Machine on centos

Source: Internet
Author: User

I. What is lxc?

Lxc is abbreviated as Linux containers. It is an operating system-level virtualization technology, which is a user space interface for Linux kernel container functions. It packs an application software system into a software container containing the Code of the application software and the required operating system core and library. Allocate hardware resources available for different software containers through unified namespaces and shared APIs, and create an independent sandbox runtime environment for applications, this allows Linux users to easily create and manage systems or application containers.

2. Nic information in lxc.

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M01/48/39/wKioL1QGgn-iTTKWAACqjd_GcYQ489.jpg "Title =" virtual network card .png "alt =" wKioL1QGgn-iTTKWAACqjd_GcYQ489.jpg "/>

Make the host's physical network card into a bridge device (switch device). After the physical network card is made into a bridge device, the host does not have its own network card. Therefore, the host needs to virtualize its own virtual network card, at this time, the bridge device is the virtual machine's network card, the host's network card receives packets, he will work in the hybrid mode.

Iii. lxc configuration process

1) To make eth0 a bridge, ensure that the NetworkManager is switched off to ensure that the Network starts up.

 

Service NetworkManager stop service NetworkManager status # view Virtual Machine NetworkManager CD/etc/sysconfig/network-scriprs/CP ifcfg-eth0 ifcfg-br0 # create bridge device Vim ifcfg-bro # change configuration file device = "br0" # change to br0bootproto = "NONE" hwaddr = "00: 0C: 29: D3: F8: 8f "nm_controlled =" no "# Do not start nmonboot =" yes "# change the type to bridgetype =" bridge "UUID =" inherit "ipaddr =" 172.16.16.5 "netmask =" 255.255.255.0.0 "Gateway = "172.16.0.1"
2) Modify IP configuration information for the ifcfg-eth0
Device = "eth0" bootproto = "NONE" hwaddr = "00: 0C: 29: D3: F8: 8f "nm_controlled =" no "onboot =" yes "type =" Ethernet "UUID =" 5808601c-b6ce-496f-b9d0-c44a5ae9bd84 "bridge = br0 # Add bridge to other IP addresses in upper case, gateway, DNS, are deleted.
3)service network restart    ifconfig


4) install virtual machines

Download and install the Virtual Machine RPM package. Packages used for installation

Yum install libcgroup-y # Install the package group service cgconfig start # Start cgconfiglxc-checkconfigvim/etc/lxc/default. conflxc. network. type = vethlxc. network. link = br0 # change it to br0lxc. network. flags = upvim/usr/share/lxc/templates/lxc-centos # modify the yum Source Address to the local Yum source address. [Base] baseurl = # local Yum source address.

5) create a virtual machine

 

Lxc-create-N centos6-T/usr/share/lxc/templates/lxc-centos # create a VM

6) Start the VM.

 

Chroot/var/lib/lxc/centos6-1/rootfs/# Switch to the root directory to modify the VM Startup Password passwd # Run the command and enter the new password exit # exit the VM after modification important: lxc-start-N centos6 # Start the VM and add-D to start shutdown-H now in the background # disable the VM operation

 

OK. The installation of the VM on a Linux host has been completed.

This article is from the Slayer blog, please be sure to keep this source http://slayer.blog.51cto.com/4845839/1548263

How to Use lxc Virtual Machine on centos

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.