Build your own Asterisk@Home Xen domU
Aug 25, 2006 06:53 PM
Posted by Steve Blinch
There seems to be a bit of interest in DIY Asterisk@Home domU installations, so I've posted my notes for building your own A@H Xen domU. Read on for full instructions.
These are the notes I took while installing A@H in a Xen domU. It is assumed that you know enough about Linux administration that you can "fill in the gaps" and adapt the instructions as necessary for your own needs. Enjoy.

Building an A@H domU
  1. Grab Centos 4.2 domU image from
  2. Unpack the disk image and mount it in the dom0 with:

    mkdir /mnt/asterisk
    mount -o loop centos.4-2.img /mnt/asterisk

  3. If you need to make any networking changes, do so now. I personally did the following:

    1. Setup my router as the default gateway. Edit /mnt/asterisk/etc/sysconfig/network and add:


      Also, set your hostname in this file by changing the HOSTNAME line:


    2. Setup eth0 to use static IP. Edit /mnt/asterisk/etc/sysconfig/network-scripts/ifcfg-eth0 and add:


      Also change the BOOTPROTO line to:


    3. Since I'm not using DHCP, I also had to define my nameservers manually in /mnt/asterisk/etc/resolv.conf:


    4. Edit /mnt/asterisk/etc/yum.conf and replace all instances of "/centos/4.2/" with "/centos/4/".

  4. Edit /mnt/asterisk/etc/selinux/config and set:


  5. Unmount the disk image:

    umount /mnt/asterisk

  6. Boot the disk image under Xen.
  7. Login as root, and change the root password by running:


  8. Update your packages:

    yum update

  9. Install any packages you need. I used:

    yum install rsync vim-enhanced unzip make gcc g++

  10. If you want to use the ztdummy module (required for Music on Hold, conferencing, and IAX trunking), or if you want to use any Zaptel hardware (and can figure out a way to do so from a Xen domU), you'll need to also copy your Xen domU kernel source code to the Asterisk machine:

    mkdir -p /usr/src/kernels/
    rsync -avze ssh [dom0_ip]:/usr/src/xen-2.0/linux-2.6.11-xenU \
    rsync -avze ssh [dom0_ip]:/usr/src/xen-2.0/linux-2.6.11-xen-sparse \
    ln -s /usr/src/xen-2.0/linux-2.6.11-xenU /usr/src/linux

    You'll of course need to substitute your own kernel paths above.

  11. Download the latest version of Asterisk@Home (now Trixbox) from SourceForge. Get the .tar.gz version, NOT the .iso version. I used wget from the domU machine itself, eg:

    cd /tmp
    wget http://sourceforge-download-url/...

  12. Setup a directory to unpack A@H into. Note that you can't use a directory of your choice; it MUST be /var/aah_load or the installation will fail.

    mkdir /var/aah_load
    mv asteriskathome-x.x.tar.gz /var/aah_load
    cd /var/aah_load
    tar xvfz asteriskathome-x.x.tar.gz

    ... this will run for quite some time, and then reboot your machine. When it comes back up, proceed.

  13. Setup your passwords. Run:


  14. Edit /usr/sbin/safe_asterisk and change the "TTY=9" line to:


    That's the letters TTY followed by an "equals" sign. That's it.

  15. Start amportal. Run:

    amportal start

  16. Visit http:/// in your browser (replacing with your A@H IP address, of course)
  17. Click on FreePBX
  18. Enter the username 'maint' and the password you chose above
  19. Click Setup->Module Admin
  20. Click Install, then enable the modules you want. I chose:

    Applications, Core, Recordings, Asterisk Info, Asterisk Logs, Config Edit, System Status
At this point, you've reproduced the A@H Xen domU that I posted earlier. You can now configure Asterisk as usual.

One final note: some users have reported problems running Xen with the default HZ kernel setting. If you'd like to change this, you may find this post and this post useful -- they explain the process of increasing your HZ value to 1000.

Specifically, you'll want to change the HZ value to 1000 in the following kernel header files:


And that's it -- if all goes well, your Asterisk domU should be ready to go. I've had Asterisk running under Xen for several months now on my home's primary phone line, and have yet to have any problems. (I actually ended up ditching A@H-on-CentOS in favor of plain-Asterisk-on-Debian, though, but that's a different tutorial altogether!)

Last updated: -