Building an IAXModem-based HylaFax+ server using OpenVZ

- 09 Nov 2008

If you happen to have a Asterisk solution for voice on your network occasionally it is nice to be able to send faxes from your network without the need of a PSTN line at your endpoint. At my company we do this by running a fax server on an OpenVZ VPS on the same subnet as our Asterisk PBX. Here is how we build our fax server:

First, we build the OpenVZ VPS with CentOS and add the /dev/ptmx device (your VPS will likely already have this on it):

vzctl create 1057 --ostemplate centos-5-i386-default --config vps.basic
vzctl set 1057 --hostname --save
vzctl set 1057 --ipadd --save
vzctl set 1057 --nameserver --save
mknod --mode 666 /vz/private/1057/dev/ptmx c 5 2
(Note: there is a good chance the 98 UNIX device /dev/ptmx is going to already be there from your template -- you can disregard any errors you get during the "forced" creation of that device)

Next, we start the VPS and enter the VE by running the following:

vzctl start 1057
vzctl enter 1057

Next, we start the update and install process via yum and a few RPMs I built for Ghostscript:

yum -y update
yum -y install rpm-build make libtiff-devel zlib-devel gcc gcc-c++ pam-devel openldap-devel freeglut libjpeg-devel libICE libSM libXt cairo urw-fonts

rpm -Uvh
rpm -Uvh
rpm -Uvh
rpm -Uvh
rpm -Uvh
rpm -Uvh
rpm -Uvh

cd /root

rpm -i hylafax-5.2.7-1.src.rpm
rpmbuild -bb hylafax.spec
rpm -i /usr/src/redhat/RPMS/i386/hylafax-5.2.7-1.i386.rpm
chkconfig --levels 345 hylafax on

Now, because we are on Asterisk we’ll use an IAXModem for our communication device; if you do have access to a “real” PSTN by all means use a fax-capable modem and don’t use the IAXModem because it is not a good 100% solution. However, here is our IAXModem method:

cd /root
tar xzvf iaxmodem-1.1.1.tar.gz
cd iaxmodem-1.1.1
cp iaxmodem /usr/local/sbin/
mkdir /etc/iaxmodem /var/log/iaxmodem
touch /var/log/iaxmodem/iaxmodem
pushd .; cd /etc/iaxmodem
pushd .; cd /etc/init.d/
cp config.ttyIAX /var/spool/hylafax/etc/config.ttyIAX0

### Add our local configuration differences
vi /etc/iaxmodem/ttyIAX0

### Add our local configuration differences
vi /var/spool/hylafax/etc/config.ttyIAX0

chmod +x /etc/init.d/iaxmodem
chkconfig --add iaxmodem
echo "iax0:2345:respawn:/usr/sbin/faxgetty ttyIAX0" >> /etc/inittab

Now, we REBOOT to make sure everything comes up:


After the VE re-appears we run our fax setup program:


That should do 90% of the work for you – no you just have to configure the server for your needs!

Related Posts: Extracting Smarty variables from source » Installing vzdump on CentOS 5.4 (32-bit) » Dumping Addresses from phplist » Adding NRPE (Nagios) to CentOS \/ RHEL Servers » Adding the REMI Repository to CentOS / RHEL / RedHat »

comments powered by Disqus