I have made a Busybox/uClibc OpenVZ template [message #43257] |
Mon, 15 August 2011 15:49 |
samiam
Messages: 15 Registered: July 2011
|
Junior Member |
|
|
One annoyance I have had with OpenVZ is that there is not a small
template based on Busybox out there. So, in the spirit of open source,
I solved this problem by making my own tiny OpenVZ template based on
Busybox and uClibc.
This OpenVZ template is fully GPL compliant. Not only does it include
the source code, but I spent all weekend burning the midnight oil to
make the system self-hosting: It is possible to compile every program
that makes up the system inside of the container. I even have a script
that will (given enough time) compile all of the bits and clone the
entire TinyVZ tree in a subdirectory.
This is a work in progress. Right now, the system is for hard core
UNIX/Linux gurus: The only editor is a miniature version of vi
included with Busybox (actually, I also compiled in Busybox's version
of the "ed" editor, for those who feel vi pampers the user too much);
all configuration is done by editing text files. In addition, the
compiler can only compile C programs, and can not compile C++
programs.
While things currently have not been set up to allow the vzctl program
can not make this container reset its IP or hostname, it is possible
to edit the file /etc/sysinit.sh to have it use the IP assigned to it
by OpenVZ. For example:
-----8<-----8<-----8<-----8<-----8<-----8<-----8<-----
#!/bin/sh
IP=192.168.1.163
HOSTNAME=nightfly
hostname $HOSTNAME
mkdir /proc
mount /proc
mount /dev/pts
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin
export PATH
ifconfig lo 127.0.0.1
ifconfig venet0 $IP
route add -net 127.0.0.0 dev lo
route add -net 0.0.0.0 dev venet0
# MaraDNS (Deadwood)
duende Deadwood
-----8<-----8<-----8<-----8<-----8<-----8<-----8<-----
This script is one that I am using on a tiny little DNS "toaster"
OpenVZ container. By getting rid of the entire compiler toolchain (all
of /usr/lib, the binutils in /usr/bin, the header files in
/usr/include and /usr/src, the gcc library in /lib, the source code in
/build, etc.), I was able to get this container to use under two
megabytes of space.
A tarball of this template can be looked at here:
http://samiam.org/TinyVZ/
I hope people find this template useful.
- Sam
|
|
|