This page is part 3/6 in our A server with DTC-Xen tutorial.
(Make sure you follow the step one after the other)
1 - Setup a DTC control panel
This won't be detailed here. Note that you can do this inside one of the VMs of your Xen Server, that's no problem. Later in this how-to, we will let you know how to set up the first domU by hand in the shell using the dtc_reinstall_os script provided by DTC-Xen.
2 - Naming conventions
Your Xen Server dom0 MUST have a node name like nodeXXXX.your-domain.com, or alpha.example.com. In earlier versions of DTC-Xen, it was required to use numbering with nodeXXXX (with X being with 4 to 5 characters) and being the host names. This has not been required since version 0.5.x of DTC-Xen. You can now use any naming scheme you like.
At GPLHost, we use the phone number prefix for the first 2 or 3 characters, and then the last 2 increase. If you will have only one xen server, 00001 is fine. We will use 1212 in this example, and my-host.com as the domain name, so this will be: node1212.my-host.com, and 188.8.131.52 as the IP of the dom0 of your xen server.
3 - Preparing the dom0
Your dom0 MUST be able to find 184.108.40.206 when it tries to resolve node1212.my-host.com. Best is to setup /etc/hosts the following way:
220.127.116.11 node1212.my-host.com node1212
And check that /etc/hostname has node1212, and hostname --fqdn returns node1212.my-host.com.
4 - Installing the dtc-xen package
Add one of the GPLHost repository to your dom0 in your /etc/apt/sources.list:
deb ftp://ftp.gplhost.com/debian lenny main # US main ftp
deb ftp://ftp.gplhost.sg/debian lenny main # Singapore mirror (for asian users)
deb ftp://ftp.gplhost.fr/debian lenny main # Paris mirror (for european users)
The full repository list is available from here.
After apt-get update, it's time to install dtc-xen:
apt-get install dtc-xen
Answer its questions. The current package does not support weird characters (e.g., " ") in the password. Best is to use a randomly generated password for the SOAP server and cut & paste it into the debconf screen when it asks for a password. (dtc can do it for you in the general config -> VPS server screen.) Make sure you keep this password somewhere, as it will be encrypted and you will need to enter it in your DTC panel interface.
Then run the dtc-xen_finish_install and issue /etc/init.d/ssh restart. (Don't worry, the later will NOT disconnect you from ssh)(apt-get install ssh.) If you don't understand why you need to do these 2 steps, please read the README.Debian in the doc folder of dtc-xen.
After you have CAREFULLY read the /etc/dtc-xen/dtc-xen.conf and edited it according to your needs (especially, the MAC address prefix), restart DTC-Xen, otherwise Debian installs of your domU wont work:
You can also install the anti-DoS firewall script of DTC-Xen:
apt-get install dtc-xen-firewall
The configuration files for this script is in /etc/dtc-xen as well. Feel free to customize them to your needs.
5 - Installing your first domU VM
Once DTC-Xen is setup, you can use the dtc_reinstall_os script to setup your first domU, where you might install the DTC web interface. Before you do it, you should create your VM's disks:
dtc_setup_vps_disk 01 15000 512 lvm
This will create a 15G partition and a 512 MB swap.
Then you can install the operating system. There's a man page for it, so feel free to read it. For example, (type this on one line):
""Important notice""; Your root password should start with a regular ascii character. (a-z, 0-9, NO & characters, etc, else the command will fail.)
dtc_reinstall_os -v -vpsid 01 -ram 512
-nic 192.168.2.176,255.255.255.0,192.168.2.255 -pass MyRootPass
-os debian-dtc -gw 192.168.2.1 -dns 192.168.2.1
This will set up a VM named xen01 with 512 MB of RAM, using 192.168.2.176 as IP address, 255.255.255.0 as netmask, 192.168.2.255 as broadcast address, 192.168.2.1 for the gateway, and the same IP for the DNS. At the first boot, you will see that it will install DTC for you.
Once the script has finished the installation of your VM, you can install DTC in it. To do this, follow the instructions here: Installing DTC in Debian
- Todo: next to explain how to test and prove.
6 - Adding the Xen Server to the DTC panel, and provisioning some VPS
Now that the dtc-xen package is set up and the DTC web interface is installed, you can connect them together. Go into dtc's general config screen of dtc, click on the IP pool editor. Add your IP pools there. Then open the vps server tab, and enter the following in the fields:
A.A.A.A / node12456.example.com / dtc-xen / XXXXXXX / YYYYYYYYY
where XXXXXXX is the SOAP password you have just entered during the setup, and YYYYYYYYY is the location of the Xen server that will show up when somebody registers. (Something like "foo data center in bar country" is fine.) Note that if there is more than one server with the exact same location, the panel will show only one entry in the registration popup, which is rather nice. A.A.A.A is the IP of your dom0.
Note: When defining your VPS numbers, use 01, 02, 03, etc, not Xen01, Xen02, etc, the Xen bit gets appended for your automatically.
7 - Provisioning some IPs, VMs and editing in the package manager
Next, you should click on "edit ip addresses" and add some VPS IPs to your Xen servers. Add as much as you can, and they will be able to be taken by your customers when they register with DTC.
Then you should go in the Package manager and create some VPS package. Nothing special to say here, except that you need to create some renewal package as well to enable recurring possibility(?).
Note that DTC will account for all individual IPs you enter in it, so it will be impossible to use the same IP address in multiple places, which is a nice way to avoid IP conflicts.
8 - Preparing the server for setting-up other distributions
If DTC uses debootstrap and yum to set up, respectively, Debian and CentOS, you still need to use images for the setup of other distributions. In our repositories and their mirrors, you will find lots of Debian package containing the images. Simply do a "apt-cache search dtc-xen-os" and you will find these packages. Note that for the case of NetBSD, the package contains only the 2 NetBSD5 kernels and nothing more, as it is enough to do the setup. You will also find some appliances if you do "apt-cache search dtc-xen-app". Install of of these packages if you like. (Currently, it takes about 1GB in your /usr to have them all in your dom0.)
9 - popularity-contest
If you want to help us and "vote" for dtc-xen in Debian, please apt-get install popcon to participate to the Debian package popularity contest.
1. Can the DTC instance talk to DTC-Xen?
DTC-Xen-Firewall can block the cURL from accessing the SOAP server. Turn the firewall off and retest if you have issues (/etc/init.d/dtc-xen-firewall stop).
Prove that you can access the SOAP server on the Dom0 machine - (eg wget https://vpsserver01.home.bowenvale.co.nz:8089/(approve sites) )
If that does connect, then prove you can do the same from the 'server' running your DTC instance. In my case, I was running DTC from DomU1 and was not able to connect to the SOAP server until I disabled the firewall.
Is your htpasswd set correctly? /etc/dtc-xen/htpasswd has the password and user combinations in it.
To change the password, on the DomU machine where the SOAP server is running: # htpasswd htpasswd dtc-xen
You don't need to reset/start anything for the new password to take effect.