Difference between revisions of "VServer Control Daemon HowTo"

From Linux-VServer

Jump to: navigation, search
(cl move the lucid section before libserver. Build order should now work from top to bottom.)
(A. Description: typo)
Line 17: Line 17:
  
 
==A. Description==
 
==A. Description==
* [http://dev.croup.de/ Developer side] with short description for vcd (former vserver-utils) and libvserver
+
* [http://dev.croup.de/ Developer site] with short description for vcd (former vserver-utils) and libvserver
 
*  [http://coocoon.eu/manual.pdf VServer Control Daemon Reference Manual] (under construction)
 
*  [http://coocoon.eu/manual.pdf VServer Control Daemon Reference Manual] (under construction)
 
*[http://dev.croup.de/proj/vserver-utils vserver-utils] = vcd
 
*[http://dev.croup.de/proj/vserver-utils vserver-utils] = vcd

Revision as of 10:32, 7 March 2007

Contents

VServer Control Daemon - vcd


  • MySystem:
    • AMD Athlon(tm) 64 Processor 3000+ 2000 MHz
    • Gentoo Base System version 1.12.5 (stable)
    • Kernel 2.6.17.8-vs2.1.1-rc29

WARNING it is not recommended to install vcd in tandem with util-vserver on one system!

A. Description





B. Installation

I. Kernel


If you haven't booted a kernel which is patched with Linux VServer Patch till yet, please go first to Step-by-Step Guide 2.6 and follow the instructions there,
before you go further with this HowTo!

1. Main focus to the following emphases:

#Getting the sources:
 
very important is to look for getting the right kernel version 
@ http://www.kernel.org/pub/linux/kernel/v2.6/ which is supported from 
→ experimental vserver patch >= 2.1.1-rc29 @ http://vserver.13thfloor.at/Experimental/



for example:

→ lets use the experimental 'patch-2.6.17.13-vs2.1.1-rc35.diff'
wget http://vserver.13thfloor.at/Experimental/patch-2.6.17.13-vs2.1.1-rc35.diff

→ so we must use the kernel version '2.6.17.13'
wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.17.13.tar.bz2



#Configuring the kernel:

#Building the kernel:

#Installing the kernel and rebooting:

II. VServer Control Daemon


First I wanted to say that VServer Control Daemon is in trunk state and therefore it is a little bit buggy, but all of you are invited to find and post bugs, that this program will become stable as soon as possible.


Now I can proceed, that you have successfully compiled and booted a kernel with 


→ experimental vserver patch >= 2.1.1-rc29

1. Base Installation

If u use another Linux system than gentoo, try to install the needed releases with the package manager of the linux distribution!

And edit this HowTo for others! ;-)


a. Solve dependencies
For Debian
aptitude install libconfuse-dev libxmlrpc-c3-dev libsqlite3-dev sqlite3 subversion

There are many depedancies to these packages (most needed).

If you have not installed any build tools:

aptitude install make gcc libtool 
create installation source dir
1. create ~/srcvcd dir

mkdir ~/srcvcd


1.1 cd into dir

cd ~/srcvcd
xmlrpc-c
2. download Xmlrpc-c stable from http://xmlrpc-c.sourceforge.net/downloading.php 


2.1 extract xmlrpc-c-1.06.05.tgz

tar xzvf xmlrpc-c-1.06.05.tgz


2.2 cd into dir 

cd ~/srcvcd/xmlrpc-c-1.06.05


2.3 install xmlrpc-c

./configure && make && sudo make install
libconfuse
3. download libconfuse

wget http://download.savannah.gnu.org/releases/confuse/confuse-2.5.tar.gz


3.1 extract confuse-2.5.tar.gz

tar xzvf confuse-2.5.tar.gz

3.2 cd into dir 

cd ~/srcvcd/confuse-2.5


3.3 install confuse

./configure && make && sudo make install
sqlite
4. install sqlite please have a look @ http://www.sqlite.org/
libdbi
5. download libdbi from http://libdbi.sourceforge.net/download.html


5.1 libdbi-0.8.1.tar.gz

tar xzvf libdbi-0.8.1.tar.gz

5.2 cd into dit

cd ~/srcvcd/libdbi-0.8.1


5.3 install libdbi

./configure && make && sudo make install
libtar
6.1 download libtar 

wget ftp://ftp.feep.net/pub/software/libtar/libtar-1.2.11.tar.gz

6.2 extract libtar-1.2.11.tar.gz

tar xzvf libtar-1.2.11.tar.gz

6.3 cd into dir

cd ~/srcvcd/libdbi-0.8.1

6.4 install libtar

./configure && make && sudo make install
b. Install vcd related repos
lucid
8. checkout lucid

svn co http://dev.croup.de/repos/lucid/trunk lucid


8.1 cd into dir

cd ~/srcvcd/lucid


8.2 install lucid

make -f Makefile.svn && ./configure --prefix=/usr && make && sudo make install
libvserver
7. checkout libvserver

svn co http://svn.linux-vserver.org/svn/libvserver/trunk libvserver


7.1 cd into dir

cd ~/srcvcd/libvserver


7.2 install libvserver

make -f Makefile.svn && ./configure --prefix=/usr && make && sudo make install
vcd
9.checkout vcd

svn co http://svn.linux-vserver.org/svn/vcd/trunk vcd 


9.1 cd into dir

cd ~/srcvcd/vcd


9.2 install vcd

make -f Makefile.svn && ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var/lib --vserverdir=/vservers && make && sudo make install
vwrappers
10.1 checkout vwrappers

svn co http://svn.linux-vserver.org/svn/vwrappers/trunk vwrappers


10.2 cd into dir

cd ~/srcvcd/vwrappers


10.3 install vwrappers

make -f Makefile.svn && ./configure --prefix=/usr && make && sudo make install


If everything is installed you can proceed with III. Configuring VServer Control Daemon

2. Gentoo Installation


Because of there are no gentoo ebuilds for vcd available at this moment we must use layman to install the vps overlay!


1. Install layman

emerge layman -va


2. Configure /etc/make.conf for using layman

echo "source /usr/portage/local/layman/make.conf" >> /etc/make.conf


3. Download overlays

layman -f


4. Download vps overlay

layman -a vps


----

###Architecture dependencies###

→ amd64

5.1 Prepare portage for using latest xmlrpc

echo "dev-libs/xmlrpc-c ~amd64" >> /etc/portage/package.keywords 


5.2 Prepare portage for using vcd-svn

echo "sys-cluster/vcd-svn" ~amd64" >> /etc/portage/package.keywords


→ x86

5.1 Prepare portage for using latest xmlrpc

echo "dev-libs/xmlrpc-c ~x86" >> /etc/portage/package.keywords


5.2 Prepare portage for using vcd-svn

echo "sys-cluster/vcd-svn ~x86" >> /etc/portage/package.keywords

----


6. Prepare portage for using libtar

echo "dev-libs/libtar ~x86" >> /etc/portage/package.keywords → works also on amd64


7.1 Prepare portage for installing vcd-svn with clients and server support

echo "sys-cluster/vcd-svn client server" >> /etc/portage/package.use


7.2 Prepare portage for installing vcd-svn only with server support

echo "sys-cluster/vcd-svn server" >> /etc/portage/package.use


7.3 Prepare portage for installing vcd-svn only with client support

echo "sys-cluster/vcd-svn server" >> /etc/portage/package.use


8. Prepare portage for installing xmlrpc server with curl support

echo "dev-libs/xmlrpc-c curl" >> /etc/portage/package.use


9. Install vcd and needed packages

emerge libvserver-svn lucid-svn vcd-svn vwrappers-svn -va




III. Configuring VServer Control Daemon

1. Import vxdb.sql to sqlite DB

I use sqlite3 here in this example, so have a look which version you use 

10. import the vxdb file

sudo sqlite3 /var/lib/vcd/vxdb < /usr/share/vcd/vxdb.sql


11. use vxpassword for changing hash to whirlpool

vxpasswd  /var/lib/vcd/vxdb <YourUsername> <YourPassword>

2. Standard /etc/vcd.conf

/* example vcd configuration */

/* IP adress & port to listen on */
#host = 127.0.0.1
#port = 13386

/* Client timeout */
#timeout = 30

/* Logfile */
#logfile = /var/log/vcd.log

/* PID file */
#pidfile = /var/run/vcd.pid

/* Directory for VXDB, templates and run-time data */
#datadir    = /var/lib/vcd

/* Base vserver directory */
#vserverdir = /vservers

Change it to your needs! ;-)




C. Security

I. ATTENTION

For security reason it is recommended to remove the standard 'user' 'admin' and his 'password' and add new 'username' and 'password' → [http://www.sqlite.org/lang.html sqlite SYNTAX], or use a DB manager!<br>

II. ATTENTION

You must have a look for, that the 'uid' of your created 'user' has the 'uid 1', this is important for accessing the vcd

III. ATTENTION

please do not remove the 'vshelper' 'user', but change the standard assigned 'password' with 

       → vxpasswd /var/lib/vcd/vxdb vshelper <YourPassword>


12. check if vcd installation and configuration was successful, do a


vcd -d


if all works fine the output should look like below (I use standard settings for testing)

[debug] vcd[6163]: [trace] vxdb_init (vxdb.c:60)
[debug] vcd[6163]: [trace] vxdb_sanity_check (vxdb.c:32)
[debug] vcd[6163]: [trace] vxdb_prepare (vxdb.c:95)
[debug] vcd[6163]: [vxdb] SELECT uid FROM user WHERE admin = 1
[debug] vcd[6163]: [trace] vxdb_prepare (vxdb.c:95)
[debug] vcd[6163]: [vxdb] SELECT uid FROM user WHERE name = 'vshelper'
[debug] vcd[6163]: [trace] method_registry_init (methods.c:54)
[info ] vcd[6163]: Accepting incomming connections on 127.0.0.1:13386




D. Using VServer Control Daemon

I. Interacting with VServer Control Client - vcc

1. Configuring vcc

The standard vcc config file is stored @ /etc/vcc.conf there you must have a look for, if the username and the password are set correct to your changes, which you have made in vxdb with the commands above!
Standard /etc/vcc.conf
/* example vcc configuration */
host = localhost
port = 13386

user = admin
pass = MySecret

b. Set up for using tar archived templates

At this moment no package manager is implemented, but we can create vserver guests with tar archived vserver templates, so let's start!


13. create template folder

sudo mkdir /var/lib/vcd/templates


14. create lock folder 

sudo mkdir /var/lib/vcd/lock


15. copy tar templates into this folder

cp <template>.tar /var/lib/vcd/templates


16. create template.conf

sudo touch /var/lib/vcd/templates/<templatename>.conf


17. configure template.conf

sudoedit /var/lib/vcd/templates/<templatename>.conf

18. insert 
archive = <template>.tar

2. Create your first vserver

sudo vcc create test1 <templatename>


II. Interacting with VServer Control E - vce

1. Configuring vce

The standard vce config file is stored @ /etc/vce.conf there you must have a look for, if the username and the password are set correct to your changes, which you have made in vxdb with the commands above!
Standard /etc/vce.conf
/* example vce configuration */
host = localhost
port = 13386

user = admin
pass = MySecret


III. Interacting with VServer Helper - vshelper

1. Configuring vcc

The standard vshelper config file is stored @ /etc/vshelper.conf there you must have a look for, if the username and the password are set correct to your changes, which you have made in vxdb with the commands above!
Standard /etc/vshelper.conf
/* example vshelper configuration */
host = localhost
port = 13386

user = vshelper
pass = MySecret

logfile = /var/log/vshelper.log

IV. Interacting with vstatd

Standard /etc/vstatd.conf
/* example vstatd configuration */

/* Logfile */
#logfile = /var/log/vstatd.log

/* PID file */
#pidfile = /var/run/vstatd.pid

/* Directory for VXDB, templates and run-time data */
#datadir    = /var/lib/vstatd
Personal tools