[Lxc-users] Regarding creating a LXC container in fedora 17
Michael H. Warfield
mhw at WittsEnd.com
Tue May 14 21:10:00 UTC 2013
On Tue, 2013-05-14 at 11:58 +0530, Ajith Adapa wrote:
> Hi,
> Sorry for my basic question as I am new to LXC.
> I would like to know the steps to create a LXC container using lxc in
> fedora 17.
> I have searched for the same in google but I am not able to find any useful
> posts to do the same.
> It would be more helpful if anyone can share the steps if they got any.
Reference other messages about lxc-create.
Fedora 17 has lxc 0.7.5 in the repos, which is NOT going to work.
You're going to run into multiple problems which, basically, you will
not be able to resolve thanks to systemd (init) running in the host and
systemd running in the container. Fundamentally 0.7.5 is not compatible
with systemd. You will need at least 0.9.0 (current) to get this to
work.
The Fedora template is not (yet) fully updated to support systemd in a
container. After creating the container with lxc-create, you have to
edit the container config in /var/lib/lxc/{Container}/config and add an
entry as follows:
lxc.autodev = 1
Steps:
What I would recommend as steps on Fedora 17...
Download lxc-0.9.0 here:
http://lxc.sourceforge.net/download/lxc/lxc-0.9.0.tar.gz
You should have rpm-build and friends installed via yum on your system.
Build the lxc rpms by running rpmbuild (as any user) as follows:
rpmbuild -ta lxc-0.9.0
Resolve any dependencies until it builds and gives you a cluster of rpms
under ~/rpmbuild/RPMS/{arch}/.
Everything here down should now be done as root...
Install the lxc and lxc-libs rpm files using "yum localupdate" (file
names will be printed near the end of the rpmbuild command run above).
[Optional - install the lxc-devel package as well.]
It should looks sometime like this:
yum localupdate ~user/rpmbuild/RPMS/x86_64/lxc-libs-0.9.0-1.fc17.x86_64.rpm ~user/rpmbuild/RPMS/x86_64/lxc-0.9.0-1.fc17.x86_64.rpm
Doing this with rpmbuild and yum will properly update the existing
binary packages and documentation while retaining your ability to update
and maintain once it hits the official repos.
Now create your container...
lxc-create -t fedora -n Fedora17 -R 17
(The -R 17 is the default if you're on Fedora 17 and you can leave it
off.)
That should run and create your container.
Now edit the container.
vi /var/lib/lxc/Fedora17/config
And add this line in the file somewhere (if it doesn't already exist):
lxc.autodev = 1
You should now be able to start the container:
"lxc-start -n Fedora17"
I still need to submit the patches for the Fedora template for the
autodev support and the ARM / Raspberry Pi support. They'll eventually
get in there. :-P
> Regards,
> Ajith
Regards,
Mike
--
Michael H. Warfield (AI4NB) | (770) 985-6132 | mhw at WittsEnd.com
/\/\|=mhw=|\/\/ | (678) 463-0932 | http://www.wittsend.com/mhw/
NIC whois: MHW9 | An optimist believes we live in the best of all
PGP Key: 0x674627FF | possible worlds. A pessimist is sure of it!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 482 bytes
Desc: This is a digitally signed message part
URL: <http://lists.linuxcontainers.org/pipermail/lxc-users/attachments/20130514/d7bbc124/attachment.pgp>
More information about the lxc-users
mailing list