Dobrica Pavlinušić's random unstructured stuff
vz-tools: Revision 10
Suite of perl scripts in spirit of "xen-tools"<http://www.xen-tools.org/> but for "OpenVZ"<http://openvz.org/>
{toc: } ^ Installation ^^ Install dependencies from Debian packages This step is optional. If you don't want to use perl modules from packages provided by your distribution, skip this step, and modules will be automatically installed in next one. .pre sudo apt-get install libio-prompt-perl libregexp-common-perl libdata-dump-perl .pre ^^ Checkout source .pre svn co svn://svn.rot13.org/vz-tools/trunk vz-tools .pre ^^ Check and install perl modules from CPAN .pre cd vz-tools perl Makefile.PL make .pre Please note that there is no need to run `make install` Tools are runnable from current directory. This will probably change in later versions. ^ Usage This is quick hand-on overview of commands to get you started. All commands must be started with `root` priviledges ^^ vz-create.pl This will perform following steps: * Create new virtual machine bootstraped using `debootstrap` * Change root password * Create single user * Make small custimization like installing `vim` and "apt-iselect"<http://www.rot13.org/~dpavlin/apt-iselect.html> All commands will be echoed on screen, *even passwords*. However, if you want to learn steps in creating OpenVZ VE, this is very helpful. To run interactive session which asks questions use: .pre ./vz-create.pl .pre Other alternative is to just enter hostname (defined in `/etc/hosts` for example) .pre ./vz-create.pl my-new-ve.exmple.com .pre or by specifing IP adress .pre ./vz-create.pl 192.168.42.42 .pre ^^ vz-optimize.pl ^^ vz-clone.pl .pre root@black:~/vz-tools# time ./vz-clone.pl create 1001 Clone VE 1001 -> 101001 found LV /dev/vg/vz for /vz vzquota : (warning) Quota is running, so data reported from quota file may not reflect current values quota for 1001 | 10485760 < 20971520 | usage: 7826792 using existing /dev/vg/vz-clone-101001 Mounting /dev/vg/vz-clone-101001 to /tmp/vz-clone-101001 rsync /vz/private/1001 -> /tmp/vz-clone-101001/private 101001 new IP number: 10.42.42.42 101001 new hostname: clone-42.example.com Please review config file: /etc/vz/conf/101001.conf Add NAT for new VE with: iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE Start clone of 1001 with: vzctl start 101001 real 1m57.347s user 0m2.252s sys 0m8.591s .pre ^ Source {fetchrss: http://svn.rot13.org/index.cgi/vz-tools/rss/trunk full} |