Changes
Jump to navigation
Jump to search
← Older edit
Newer edit →
LXC
(edit)
Revision as of 08:42, 18 September 2012
551 bytes added
,
08:42, 18 September 2012
no edit summary
Line 1:
Line 1:
−
=Requirements=
+
=Prepare a Linux Container (CT)=
+
=
=Requirements
=
=
* A console should be disabled (lxc.console = none)
* A console should be disabled (lxc.console = none)
* udev should not run in CT ($ mv /sbin/udevd{,.bcp})
* udev should not run in CT ($ mv /sbin/udevd{,.bcp})
−
=
Example
=
+
+
==
Prepare a host environment ==
+
+
* Mount cgroupfs
+
$ mount -t cgroup c /cgroup
+
* Create a network bridge
+
# cat /etc/sysconfig/network-scripts/ifcfg-br0
+
DEVICE=br0
+
TYPE=Bridge
+
BOOTPROTO=dhcp
+
ONBOOT=yes
+
DELAY=5
+
NM_CONTROLLED=n
+
$ cat /etc/sysconfig/network-scripts/ifcfg-eth0
+
DEVICE="eth0"
+
NM_CONTROLLED="no"
+
ONBOOT="yes"
+
BRIDGE=br0
+
==Create CT==
+
* Download an OpenVZ template and extract it.
+
curl http://download.openvz.org/template/precreated/centos-6-x86_64.tar.gz | tar -xz -C test-lxc
+
+
* Create a config files
$ cat ~/test-lxc.conf
$ cat ~/test-lxc.conf
lxc.console=none
lxc.console=none
Line 19:
Line 42:
none /root/test-lxc-root/dev/shm tmpfs defaults 0 0
none /root/test-lxc-root/dev/shm tmpfs defaults 0 0
+
* Register CT
$ lxc-create -n test-lxc -f test-lxc.conf
$ lxc-create -n test-lxc -f test-lxc.conf
−
$ mount -t cgroup c /cgroup
+
+
* Start CT
$ mount --bind test-lxc test-lxc-root/
$ mount --bind test-lxc test-lxc-root/
$ lxc-start -n test-lxc
$ lxc-start -n test-lxc
Avagin
Bureaucrats
,
Administrators
416
edits
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Request account
Log in
Namespaces
Page
Discussion
Variants
Views
Read
Edit
View history
More
Search
Navigation
Main page
Recent changes
Random page
Help
Tools
Special pages
Printable version
News
Twitter
YouTube
External resources
Github / source code
Issues / bugs
Mr. Jenkins
Open Hub
OpenVZ