[Lxc-users] Alternative to Debian Testing? No Prompt upon lxc-console execution

Terry--gmail terry.kemmerer at gmail.com
Thu Feb 23 00:42:58 UTC 2012


Hey! I think I have it working! While waiting for comments, I tried a 
different approach. I can ping out to anything on the Internet from my 
container and in from my LAN on which my Host Node computer is setting, 
to my test container. Seems....perfect!

Here's what my container says:

root at vm101:~# cat /etc/issue
Debian GNU/Linux 6.0 \n \l

So, it appears I have a squeeze container now.  Thanks guys!

And for anyone curious on how I put this together from scratch, or for 
checking that I actually did it in an acceptable manner, below is my 
step by step howto:

Thanks for all your help! :)

*KEY:*

*# * <------ HOST NODE root command

*VM# *<------ VM CONTAINER root command


*INSTALL THE FOLLOWING ON YOUR DEBIAN SQUEEZE HOST NODE:*

# *aptitude install bridge-utils debootstrap lxc*


*CREATE cgroup MOUNT POINT:*

# *mkdir -p /var/local/cgroup*

# *echo "cgroup /var/local/cgroup cgroup defaults 0 0" >> /etc/fstab*

# *mount -a*


*CREATE A BRIDGE FOR THE HOST NODE (static)*

# *nano /etc/network/interfaces*

<Then change the entries to look like this:>


# The loopback network interface

auto lo

iface lo inet loopback


# The primary network interface

#allow-hotplug eth0

#iface eth0 inet dhcp


auto br0

iface br0 inet static

bridge_ports eth0

bridge_fd 0

     address 192.168.2.100

     netmask 255.255.255.0

     gateway 192.168.2.1

     dns-nameservers 192.168.2.1


Change the above addressing numbers as appropriate to your Host Node.


Then restart the network:

*/etc/init.d/networking restart*


*SETUP FOR CREATING SQUEEZE BASED CONTAINERS:*

First, we save a lenny version of the present lxc-debian script:

*# cp /usr/lib/lxc/templates/lxc-debian 
/usr/lib/lxc/templates/lxc-debian-lenny*

Second, we remove the lenny lxc-debian script:

*# rm /usr/lib/lxc/templates/lxc-debian*

Third, we need a altered script for squeeze containers:

(The modified source can be inspected and downloaded

from http://www.jotschi.de/download/lxc-debian ), or-

*# cd /usr/lib/lxc/templates*

*# wget http://www.jotschi.de/download/lxc-debian*

*# chmod +x lxc-debian*

*#./lxc-debian*

*( *NOTE: You can edit the new lxc-debian file to contain most your IP 
addressing info*)*

*CREATE A NEW CONTAINER:*

*# cd /usr/lib/lxc/templates*

*form= ./lxc-debian squeeze <your vm name here><IP/container number>*

*# ./lxc-debian squeeze vm101101*

( Your container with the above entered name will be installed in 
/var/lib/lxc )


*-OR- *you can use lxc-create command, but I haven't figured out yet how 
to use it as shown here-

***# *lxc-create -t debian -n foo<--OR--> lxc-create -n foo -f lxc.conf 
-t debian


*EDIT THE FOLLOWING FILES TO FIT YOUR UNIQUE ADDRESSING:*

*# nano /var/lib/lxc/vm101/rootfs/etc/network/interfaces*


auto lo

iface lo inet loopback


auto eth0

iface eth0 inet static

     address 192.168.2.101

     netmask 255.255.255.0

     gateway 192.168.2.1


*# nano /var/lib/lxc/vm101/rootfs/etc/resolv.conf*


nameserver 192.168.2.1


Then BEGIN the setting up of hostname.domain.com- make the changes shown 
below the command

*# nano /var/lib/lxc/vm101/rootfs/etc/hosts/*


# Auto-generated hostname. Please do not remove this comment.

192.168.2.101 vm101.firewall.com


*NOTE:*it appears to me that the**/*/var/lib/lxc/*//*<your vm name 
here>*//*/config*/**file is now pretty much automatically filled out and 
has been changed anyway from what it was(i think), as this setup appears 
to work without editing this file:

*
CONFIGURE CONTAINER:*

*S**TART* the Container (VM):

***#****lxc-start -n **vm101**-d *<----- “-d” starts it in background. 
Without “-d” you are thrown inside it.

Is it *RUNNING?*:

# *lxc-info -n **vm101*

*ENTER* container:

# *lxc-console -n **vm101*

Type <*Ctrl+a q*> to *EXIT* the console

login = root , password = root

Then change *PASSWORD*:

VM# *passwd*

Then UPDATE /etc/apt/sources.list – (just to be sure)-

VM# *apt-get update && apt-get upgrade*

Then FINISH setting up *hostname.domain.com*from inside the 
Container—change for you needs--

VM# *echo **vm101.firewall.com**> /etc/hostname*

VM# */etc/init.d/hostname.sh start*

Then TEST to see if it worked:

VM# *hostname*

vm101.firewall.com <---or whatever it should be showing

VM# *hostname -f*

vm101.firewall.com <---or whatever it should be showing



*If anyone has anything to add to this or corrections, I'd appreciate 
adding them to my notes!  Thanks again!*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxcontainers.org/pipermail/lxc-users/attachments/20120222/41721f31/attachment.html>


More information about the lxc-users mailing list