Monday, January 18, 2010

Trixbox installation on Centos 5.3 (My journey)

I have been using Trixbox for a while and I think it is time to have documented how to install it without CD using a VPS.

First, Trixbox is a set of tools that help you to maintain Asterisk.
Asterisk is opensource PBX software. It allows you to have VOIP extensions using your network connections. For my case, I have deployed 5 extensions in 5 different location in 3 countries with no long distance charge. Moreover, I can use my VOIP extension anywhere as long as I have Internet connection.

I started to use Trixbox at home using virtual machine running on Citrix Xen, however with time you realize that your phone system needs to be reliable and keeping it at home makes that task complicated (power outage, hardware problems). So I decided to move it to a data center.
Trixbox installation at home was pretty simple task since you can get de ISO image and burn a CD. But the big question was how I can install it on server running Centos 5.3 (32 bits)*

Note: I have installed Trixbox on Centos 5.3 (64bit), however Trixbox was designed to work on 32bit so you will probably have some issues with libraries since the path on Trixbox has bee set up to /usr/lib instead of /usr/lib64.

Choosing Hosting provider. My current installation is running with Godaddy , the service has been excellent and the price is ok ($30 a month for 256Mb, 20GB server) however I found a hosting provider RackUnlimited that can provide you the same for only $8 a month. At this point, I have a server with RackUnlimited and I am going to show the process of installing Trixbox.

Installation Process

1- Login on the server and make sure you have all the basic tools that you need. RackUlimited provide me with a very slim version Centos 5.3 so I had to install some packages.

# yum -y install vim-minimal sudo postfix

Also I like to install webmin I grabbed the RPM form and I installed it.

2- Install essentials packages for Trixbox.

#yum -y install mysql mysql-server mysql-devel

MySQL database

#yum -y install httpd memcached php php-pear php-mysql
# pear install DB

Apache Server and PHP packages

Now we I have server with a LAMP enviroments

3- Add the Trixbox repo

#vi /etc/yum.repos.d/trixbox.repo

name=trixbox RPM Repository for CentOS and RHEL

#yum clean all

4- Install asterisk

#yum install asterisk
#mkdir /etc/asterisk
#cp /etc/asterisk- /etc/asterisk

5- Start all services.

#/etc/init.d/mysql start
#/etc/init.d/httpd start
#/etc/init.d/memcached start
#/etc/ini.d/asterisk start

6- Install Trixbox scripts.

#yum install tbm-pbxconfig

7- Create Databases and users.

#mysqladmin create asterisk
#mysqladmin create asteriskcdrdb
#mysql asterisk < /usr/src/tbm-pbxconfig/SQL/newinstall.sql
#mysql asteriskcdrdb < /usr/src/tbm-pbxconfig/SQL/cdr_mysql_table.sql


mysql> GRANT ALL PRIVILEGES ON asteriskcdrdb.* TO asteriskuser@localhost IDENTIFIED BY 'amp109';
Query OK, 0 rows affected (0.02 sec)

mysql> GRANT ALL PRIVILEGES ON asterisk.* TO asteriskuser@localhost IDENTIFIED BY 'amp109';
Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

8- Install all Trixbox packages

#yum groupinstall Trixboxcore

9- Installing the amportal


Accept the default values.

After this is done restart MySQL, Apache, memcached , and amportal.

10- Authentication for web interface

#mkdir -p /usr/local/apache/passwd/
#touch /usr/local/apache/passwd/wwwpasswd

user: maint
pass: ******

Finally you can access the Web interface.


Time on Xen VMs is restricted by Dom0, so if you want to change the time in your VM you will have to do the following.

#echo 1 > /proc/sys/xen/independent_wallclock

to leave it perm do the following

#vi /etc/sysctl.conf
xen.independent_wallclock = 1

Change the timezone

#cp /usr/share/zoneinfo/America/New_York /etc/localtime

However you can install yo modify the time zone

#yum -y install system-config-date

Adding G729 Codec .....

G729 is a voice compression protocol designed by Digium.G729 is capable of using very little bandwidth with good voice quality (8K). You can buy a license for this codec from Digium or use a free version (free version is not considered very stable).

This guy made a pretty good job showing how to use G729.

Wednesday, January 13, 2010

Citrix Xen Server: Virtual Appliances repositories

I consider Citrix Xen a great product with a lot of advantages compared to VMWare. However, one big disadvantage is the lack of a Virtual Appliance repo.

There are some sites that can provide you with appliances ready to work but they are very VMWare oriented. Example:

Although Jumpbox has some support for Citrix Xen and other virtualization platforms, I suggest to create a place where we can start to build our own Virtual appliances for Citrix Xen.

My first donation is the following.

Centos 5.3 64 bit with Xentools installed
user:root pass:root

You can get it from :

user:ftp01 pass:ftp01

filename: centos53-64.rar

you can try

Enjoy it ...

MySQL: Changing data directory on Ubuntu 9.04

You would think it is a pretty easy task to go to the /etc/mysql/my.cnf file and change the datadir to the new directory, then restart MySQL. However, MySQL will fail every time you restart it. There are a couple of considerations to make when you do this change:

1- Make a copy of all databases to the new directory.
2- Change the datadir configuration on /etc/
3- Change /etc/apparmor.d/usr.sbin.mysqld so the old data dir is no longer there.
4- Reload Apparmor daemon.
5- Verify ownership and pem on new data dir.
6- Restart MySQL

You can follow this blog for more detailed instructions.

Enjoy it...

Friday, January 8, 2010

Citrix Xen Server: Installing Citrix Xen from USB drive

Great, we need to add a new server to the pool of Citrix Xen and we do not want to use the CD.
Follow these instructions an you can install Citrxi Xen using a USB drive.

After installed you can join the server to the pool, however you have to make sure that the Linux pack has been installed.

You will receive a message saying different version so the server can not be added it.

If you do not have the linux pack installed , create a USB drive with the Linux Pack ISO, then plug in it to the server.

#mount /dev/sdX1 /mnt

Make sure what /dev/sdX the server assigned to the USB. (you can check that using dmesg)

then do

#cd /mnt

Done, now you can join the server to the pool.

Tuesday, January 5, 2010

Citrix Xen Server: Changing the pool master

Currently, these changes can not be performed from XenCenter so you will have to use the command line.

First, you have a pool of Citrix Xen servers and you want to change the pool master.To control a pool of servers, you would need to connect to the pool master server. Citrix Xen Server populates the management database among all the servers, however only one is the master server.

Go to the slave server that you want to use as pool master.

Disable HA.
#xe pool-ha-disable
List UUID for all the hosts
#xe host-list

Promote slave

# xe pool-designate-new-master host-uuid=

Easy right!!!

If the pool master is down , use the following commands.

#xe pool-emergency-transition-to-master

then re-establish connectio to the slaves.

# xe pool-recover-slaves

Enjoy it ...