View Full Version : [SOLVED] 10.04 - Hylafax w/ Avantfax install guide

August 26th, 2012, 06:50 PM
Disclosure: This is not an official guide by any means. This is just what I use to build Hyalfax/AvantFax boxes for the company that I work for. It was initially put together by a co-worker and myself, and I edit it as needed. This is how it works for us, I hope it works for you :)

What is Hylafax/AvantFax? - Hylafax is an application that can be used to do all sorts of things with faxing on Linux. AvantFax is another application that sits "on top" of Hylafax and adds a website for administering faxes.

We currently use it for the following: 1) Receiving faxes that contain orders for our company and then emailing those faxes to a specific inbox or having users log into the AvantFax page for their server and manage the faxes as needed there. 2) Installing a Hylafax client to send faxes from user's desktops using the modems on the Hylafax server. I'm sure other people can use it for other means, but this is specifically what we use it for.

Why 10.04 instead of 12.04? - Because I haven't verified everything on 12.04 yet, but it's coming :)

Introduction: (Straight from the website)
HylaFAX is an enterprise-class system for sending and receiving facsimiles as well as for sending alpha-numeric pages. The software is designed around a client-server architecture. Fax modems may reside on a single machine on a network and clients can submit an outbound job from any other machine on the network. Client software is designed to be lightweight and easy to port. HylaFAX is designed to be very robust and reliable. The fax server is designed to guard against unexpected failures in the software, in the configuration, in the hardware and in general use. HylaFAX can support multiple modems and a heavy traffic load. Not to mention, it's also Open Source, so if you're going to install a modem or create a new Hylafax server, you'll need to be prepared for some Linux command line use.

Administering HylaFAX with AvantFAX:
AvantFAX is another piece of software that is Open Source and will run on the same server as the HylaFAX server. It helps by creating a web site that showcases the faxing that's done through this server and can help if anything breaks or if reports need to be generated.

Setting Up a New Server
Assumptions: This was tested with the Ubuntu 10.04 and the Ubuntu build of the Hylafax package. The Ubuntu server was already setup with only SSH, updated, and would now be ready to go.

Make sure static IP is set to something:

#pico /etc/network/inferfaces

auto eth0
iface eth0 inet static

dns-nameservers <IPs of local DNS servers>
dns-search <domain name>
dns-domain <domain name>

1) Install HylaFAX:

# sudo apt-get install hylafax-server hylafax-client

a) During the installs that happen at this stage, there will be a couple of pop-ups asking for information. Please use the following in this order for answers:
Which type of setup: Internet with smarthost
System mail name: <FQDN of your server>
SMTP relay host: <your relay server>

a) Configure the software:

# sudo faxsetup

a) Choose all defaults until it asks you if you want to setup a modem. Once you get to the point where setup is asking you if you want to run faxaddmodem to configure a modem, choose NO. You will add modems later and possibly once you're on site.

2) Install AvantFax:

Either download the software from AvantFax's website (http://www.avantfax.com/) or wherever you store it after the download. We have it stored on a network share, so it's SSH'd into the /home/user directory.

a) Move the software to where you'd like it to reside and untar it

# sudo mv /home/user/avantfax-3.3.3.tgz /opt
# sudo cd /opt
# sudo tar -xvzf avantfax-3.3.3.tgz

b) Move AvantFAX folder to /var/www

# sudo mv avantfax-<version number>/ /var/www

c) Run the install script (only ever run this script ONE TIME!!)

# sudo cd /var/www
# sudo ./debian-install.sh

1) Set MySQL password to whatever you want, but remember it for the next step

d) Create AvantFAX DB

**NOTICE** - I'm currently setting up the database with the default avantfax user's password. Please change if you don't want people to know the database password.

# mysql -uroot -p < create_user.sql
# mysql -uavantfax -pd58fe49 avantfax < create_tables.sql

e) Change AvantFax log location

# sudo cd /etc/apache2/sites-available
# pico default

<VirtualHost *:80>
DocumentRoot /var/www/avantfax
# ServerName avantfax
ErrorLog /var/log/apache2/avantfax-error_log
CustomLog /var/log/apache2/avantfax-access_log common

f) Restart Apache

# sudo apache2ctl restart

g) Open browser to http://<IP of your HylaFAX server>/avantfax/admin to verify AvantFax works

1) Username: admin Password: password
2) Change password to be whatever you desire

3) Change the following file to have in it so faxstat works correctly and modem status shows up correctly in AvantFAX:

# sudo pico /etc/hylafax/hosts.hfaxd

4) To ensure that AvantFax can show faxes in the Inbox and send emails:

# sudo mv /var/spool/hylafax/bin/faxrcvd faxrcvd_hylafax
# sudo mv /var/spool/hylafax/bin/faxrcvd.php faxrcvd

5) Restart Hylafax

# sudo /etc/init.d/hylafax restart

If you're going to use a system with multiple modems attached to it, know the following: If they're external USB modems, every system reboot they have a possibility to change their location (ttyACM0 could become ttyACM1), so in order to get around this, I setup udev (http://linux.die.net/man/8/udev) rules to make them
stay static. I couldn't use the serial numbers (even though I've found modems with unique serial numbers, udevadm can't see them). Therefore, I would create a new "rules" file and add rules like the following:

pico /etc/udev/rules/75-presistent-modems.rules

# Line X - Modem01 This is a comment line.
SUBSYSTEMS=="usb", KERNELS=="3-4.3:1.0", SYMLINK+="Modem01"

Sources/Extra Info:
Project Web Pages:
HylaFAX: http://www.hylafax.org/content/Main_Page
AvantFAX: http://www.avantfax.com/

Useful Commands:

# watch faxstat
Refreshes "faxstat" every 2 seconds to give a snapshot of what modems have been setup for Hylafax and what their current status is.

Common Errors:
Issue - Modem says "Waiting for modem to come free" when you run faxstat and faxes aren't coming in
Fix - Restart the Hylafax service by running:

# sudo /etc/init.d/hylafax restart

How to reset a modem if it gets stuck:

Minicom -s
Atdt<number to call>


Congratulations, you should now have a working HylaFAX w/ AvantFAX box ready for use! After this, we do some extra setups for administrating these boxes (we currently have ~10 HylaFAX servers). If there is a demand to have me write up any of the following, please let me know! Also, if you have any critiques, questions, or concerns about this guide, please don't hesitate to PM me!

1) Scripted Failed Faxes Report - My co-worker created a way to use Mercurial to send out and update a script that's run daily through Crontab to email us which faxes failed, the reasons why, and how many failed per modem.
2) Install SNMP to use Dell OMSA and Nagios to monitor the server hardware

December 5th, 2012, 05:12 PM
So I'm apparently a forum noob and can't edit my post, but thanks to Jahape4 for showing me an issue in my guide! Below is what I have in there:

# sudo mv /var/spool/hylafax/bin/faxrcvd faxrcvd_hylafax
# sudo mv /var/spool/hylafax/bin/faxrcvd.php faxrcvd

To be specific, it should actually be the following:

# sudo mv /var/spool/hylafax/bin/faxrcvd /var/spool/hylafax/bin/faxrcvd_hylafax
# sudo mv /var/spool/hylafax/bin/faxrcvd.php /var/spool/hylafax/bin/faxrcvd

We're renaming the files in place. My previous commands renamed them and moved the files to whatever directory the user was currently in. My bad :)

April 25th, 2013, 10:17 PM
So I took a stab at installing on 11.10 & installation went very smoothly.
Thanks for the nice instructions!

After a couple of hiccups I got the interface working & users set up.
Sending faxes works very well & log gets properly updated, email
notification works too.

Avantfax was installed over a previously functioning standalone Hylafax server
used for receiving only, and both printed faxes & emailed pdfs.

The Avantfax faxrcvd script though failed with the messahe below and also
never printed or emailed eiither the fax or confirmation, and the log was
not updated.

24.04.2013 16:25 faxrcvd> failed: recvq/seqf ttyS4 corrupted
24.04.2013 16:25 faxinfo> XDEBUG CHECK sender '' in faxfile 'recvq/seqf'
24.04.2013 16:25 faxrcvd> Failed to copy recvq/fax000004859.tif to /var/www/avantfax/faxes/recvd/2013/04/24/XXXXXXX/000004859/fax.tif
24.04.2013 16:25 mkdirs> Error creating directory /var/www/avantfax/faxes/recvd
24.04.2013 16:25 faxrcvd> PROCESSING FAX from 'XXXXXXX' (1 pages) received '2013:04:24 16:09:32'
24.04.2013 16:25 faxrcvd> executing: recvq/fax000004859.tif ttyS4 '' '' CIDNum: '' CIDName: '' DID: ''
24.04.2013 16:25 faxinfo> XDEBUG CHECK sender '' in faxfile 'recvq/fax000004859.tif'

There seem to be permission errors in creating directories under /var/ww/avantfax/faxes, but
they are not obvious to me.....

drwxrwxr-x 11 www-data www-data 4096 2010-09-01 16:03 avantfax
drwxrwx--- 3 www-data uucp 4096 2013-04-24 11:10 recvd
drwxrwx--- 3 www-data uucp 4096 2013-04-24 12:04 sent

Any help would be appreciated

George Kampouris

April 27th, 2013, 12:00 AM
24.04.2013 16:25 mkdirs> Error creating directory /var/www/avantfax/faxes/recvd

That error looks as if the 'recvd' folder doesn't even exist at that location...Have you verified if it truly is was created at that location and has correct permissions?

May 29th, 2013, 02:38 PM
Sorry its been so long to reply.

I checked & the directory is there, though only accessible as root

gk@fax:~$ sudo ls -l /var/www/avantfax/faxes
total 8
-rwxrwx--- 1 www-data uucp 0 2010-09-01 16:03 index.html
drwxrwx--- 3 www-data uucp 4096 2013-04-24 11:10 recvd
drwxrwx--- 3 www-data uucp 4096 2013-04-24 12:04 sent

gk@fax:~$ sudo ls -l /var/www/avantfax/faxes/recvd
total 4
drwxrwxrwx 6 uucp uucp 4096 2013-04-24 12:44 2013
-rwxrwx--- 1 www-data uucp 0 2010-09-01 16:03 index.html

May 29th, 2013, 03:49 PM
No problem...Yeah my directories has the same permissions/owners/etc as you...

However,I just realized this line in your original error: 24.04.2013 16:25 faxrcvd> failed: recvq/seqf ttyS4 corrupted

What do you get if you run the watch faxstat command?

I'm wondering too if you just need to reconfigure your modem through faxsetup and verify it's correct.

One glitch I also ran into was I needed to change the following entries when running through faxaddmodem (though this may not have anything to do with your issue) to get sending working properly.

Protection mode for received facsimile [0600]? I set to 0644
Protection mode for session logs [0600]? I set to 0644
Protection mode for ttyS0 [0600]? I set to 0666

May 29th, 2013, 04:57 PM
Watch faxstat returns:

HylaFAX scheduler on fax: Running
Modem ttyS4 (+): Running and idle

By the way, the script to copy older incoming faxes from the Hylafax directory worked just fine & they're all in the 2013 subdir of .../recvd.

Also, it is quite strange that have no such issue with outgoing faxes. Notifications are emailed & the log properly updated......

May 29th, 2013, 05:45 PM
What are the permissions of /var/www/avantfax/tmp?

Only reason I ask is because of this thread (http://sourceforge.net/projects/avantfax/forums/forum/542424/topic/3668245) which has a very similar error as yours...and was resolved by using the first step of the Avantfax install guide, here (http://www.avantfax.com/install.php).

Below is the snippet of the first step, which mainly has you moving your avantfax folder but the fix seemed to come from then setting the correct permissions to specific folders.

chmod -R 0770 /var/www/avantfax/tmp /var/www/avantfax/faxes
chown -R apache.uucp /var/www/avantfax/tmp /var/www/avantfax/faxes

May 29th, 2013, 06:04 PM
drwxrwx--- 1320 www-data uucp 36864 2013-04-29 11:11 tmp

May 29th, 2013, 06:49 PM
Just sent you a PM.

June 21st, 2013, 09:30 PM
This is an excellent guide, and wanted to say thanks first off.

Iv'e got an ubuntu 10.04 system running hylafax. I can't seem to be able to to get faxrcvd to work properly. Outgoing works fine. Incoming faxes are received, but not shown in the inbox or emails.

If I run it from the command line, it will update the avantfax inbox and send out email.

I followed a couple of suggestions I've read about this, with no success. I imaging it could be a permissions problem, but haven't the faintest idea what it should be.

Any assistance would be appreciated.

September 3rd, 2013, 06:31 PM
I am having this same problem. I've installed avantfax on 12.04 and it seemed to be working but received faxes wouldn't show up in the inbox. I had to execute this command to get previously received faxes into the inbox.

cd /var/spool/hylafax; for i in `ls recvq/*`; do bin/faxrcvd.php $i ttyS0; done

That command worked and I was able to view the faxes. Newly received faxes would still not show up in the inbox so I changed the permissions as suggested earlier in this thread with

chmod -R 0770 /var/www/avantfax/tmp /var/www/avantfax/faxes
chown -R apache.uucp /var/www/avantfax/tmp /var/www/avantfax/faxes

The file owner is uucp since apache.uucp does not exist. Now I can't view any of the received faxes. The previously received faxes are still listed in the inbox but there is a red line through the preview popup and when I try to view them there are just blank pages. If I try to open the pdf it says that the pdf file does not exist but it does exist at the indicated path. Has anyone gotten this working?