Build A HylaFax Server With AvantFax Frontend Using Debian Etch

Want to support HowtoForge? Become a subscriber!
 
Submitted by surlyjake (Contact Author) (Forums) on Sun, 2007-12-23 18:44. :: Debian

Build A HylaFax Server With AvantFax Frontend Using Debian Etch

Install Debian. I used the basic barebones install option. I did some things that were done because of preference, and not necessary. I have marked them approriately. I encourage contributions from anyone who would like to add or correct something in this HowTo to contact me so I can fix it. I have installed this setup twice following these instructions and used Avantfax 2.3.0. Thanks to all the resources who helped me figure this out. Especially Razametal, who submitted a fantastic Spanish language walkthrough on ecualug.org.

**********optional section***************

Remove cdrom source:

# nano /etc/apt/sources.list

Throw a # in front of the cdrom source.

Bring your box up to date:

# apt-get update
# apt-get upgrade

Reboot:

# shutdown –r now

***********end of optional section************

Log in as root.

Give the machine a static IP:

# nano /etc/network/interfaces

Replace the “inet dhcp” with something similar to this:

iface eth0 inet static
    address 192.168.1.51
    netmask 255.255.255.0
    network 192.168.1.0
    broadcast 192.168.1.255
    gateway 192.168.1.1

Reset the connection:

# ifdown eth0 && ifup eth0

***********optional***********

Install ssh server:

    # apt-get install openssh-server

Log in as root via PuTTY (or continue on the terminal).

***********end of optional section*********

At this point, you need to know what port your modem is at. It should be at one of the /dev/ttyS*'s. If you don't know this, start googleing.

Install hylafax:

# apt-get install hylafax-server
# faxsetup

Allow it to run faxmodem to connect the modem. Use defaults except for:

# Area code [415]? <your area code>
# Phone number of fax modem [+1.999.555.1212]? <your phone number>
# Local identification string (for TSI/CIG) ["NothingSetup"]? <a name for your fax server>
# Protection mode for received facsimile [0600]? 0644
# Protection mode for session logs [0600]? 0644
# Protection mode for ttyS0 [0600]? 0666

Use class 1 modem unless you know better.

Allow users from your subnet access to the fax service:

# nano /etc/hylafax/hosts.hfaxd

Add to the end of the file:

192\.168\.:::

Reboot:

# shutdown -r now

Test the server:

# faxstat -a -s

You should get something like this:

    # HylaFAX scheduler on <your server name>: Running
    # Modem ttyS2 (<your phone number>): Running and idle

Add a fax user. This will create a user named "user" with userID 101 and no password.

# faxadduser -u 100 user

Add an administrator. This will create a user named admin with admin password <password>:

# faxadduser -a <password> -p <password> -u 100 admin

At this point, hylafax works. You can test it by connecting  a client like WHFC to try it out. If you need to switch up the config later, use these files:

/etc/hylafax/config
/etc/hylafax/config.ttyS*

Now, lets get messy and install a cute web front end on it. 

Install the prerequisites:

# apt-get install apache2-mpm-prefork apache2-utils apache2.2-common \
libapache2-mod-php5 libapr1 libaprutil1 libpq4 libsqlite3-0 php5-cli php5-common \
mysql-server imagemagick libtiff4-dev netpbm libnetpbm10-dev libungif-bin \
libungif4-dev sudo postfix php-mail php-mail-mime php-file php-db php5-mysql \
 psutils wdiff

# cd /usr/src
# wget http://easynews.dl.sourceforge.net/sourceforge/avantfax/avantfax-2.3.0.tgz
# tar zvxf avantfax-2.3.0.tgz
# cd avantfax-2.3.0

You can edit avantfax/includes/config.php if you need to, but I didn't have to change anything.

Move avant to web folder and set permissions:

# mv /usr/src/avantfax-2.3.0/avantfax /var/www/
# chmod -R 777 /var/www/avantfax/tmp /var/www/avantfax/faxes

Rename original faxrcvd and notify scripts. Replace with avantfax ones:

# cd /var/spool/hylafax/bin
# mv faxrcvd faxrcvd.old
# mv notify notify.old
# ln -s /var/www/avantfax/includes/faxrcvd.php /var/spool/hylafax/bin/faxrcvd
# ln -s /var/www/avantfax/includes/notify.php /var/spool/hylafax/bin/notify
# mv /usr/bin/faxcover /usr/bin/faxcover.old
# ln -s /var/www/avantfax/includes/faxcover.php /usr/bin/faxcover

Edit create_tables.sql to use avantfax database:

# nano create_tables.sql

Add "USE avantfax;" to top.

Edit setup.sh to chown to "root.root":

# nano setup.sh

Change apache.apache to "root.root".

Run the setup script:

# ./setup.sh

Add two scripts to root's crontab:

# crontab -e

# runs once an hour to update the phone book
0 * * * * /var/www/avantfax/includes/phb.php
# runs once a day to remove old files
0 0 * * * /var/www/avantfax/includes/remold.php

Switch up your Apache settings:

# nano /etc/apache2/sites-enabled/000-default

Change it to this:

NameVirtualHost *
 <VirtualHost *>
         ServerAdmin webmaster@localhost
       
         DocumentRoot /var/www/avantfax
         <Directory />
                 Options FollowSymLinks
                 AllowOverride None
         </Directory>
         <Directory /var/www/avantfax>
                 Options Indexes FollowSymLinks MultiViews
                 AllowOverride None
                 Order allow,deny
                 allow from all
                 # This directive allows us to have apache2's default start page
                 # in /apache2-default/, but still have / go to the right place
                 #RedirectMatch ^/$ /apache2-default/
         </Directory>
       
         ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
         <Directory "/usr/lib/cgi-bin">
                 AllowOverride None
                 Options ExecCGI -MultiViews +SymLinksIfOwnerMatch
                 Order allow,deny
                 Allow from all
         </Directory>
       
         # Possible values include: debug, info, notice, warn, error, crit,
         # alert, emerg.
         LogLevel warn
       
         CustomLog /var/log/apache2/access.log combined
         ServerSignature On
     Alias /phpmyadmin "/usr/share/phpmyadmin/"
     <Directory "/usr/share/phpmyadmin/">
         Options Indexes MultiViews FollowSymLinks
     </Directory>
     Alias /doc/ "/usr/share/doc/"
     <Directory "/usr/share/doc/">
         Options Indexes MultiViews FollowSymLinks
         AllowOverride None
         Order deny,allow
         Deny from all
         Allow from 127.0.0.0/255.0.0.0 ::1/128
     </Directory>
       
 </VirtualHost>

Restart Apache:

# /etc/init.d/apache2 restart

Go to http://<yourIP>/admin. Log in using u/n: afadmin, p/w: password.

Configure your modems. For /dev/ttyS2, use ttyS2. Mind the caps... as always.

Add a user.

Reboot:

# shutdown -r now 

Try to start hylafax:

# /etc/init.d/hylafax start

You will get some errors about one file being newer than the other. mv the newer file over the older one. Repeat 3 times.

Once you can start it successfully, reboot:

# shutdown -r now

Now you users can access the fax server login at http://<faxhostname>.


Please do not use the comment function to ask for help! If you need help, please use our forum.
Comments will be published after administrator approval.
Submitted by and-or-logic (registered user) on Fri, 2014-04-11 13:22.

I need to set up hylafax on arm at91sam9263ek. until now i have successfully installed the hylafax on it and my system shows following processes running

 628 ?        Ss     0:00 /usr/sbin/faxq                              
  630 ?        Ss     0:00 /usr/sbin/hfaxd -d -i 4559                  
  705 ttyS0    S      0:00 faxgetty /dev/ttyS1

however when i check the faxstat it shows the following  message every time. My modem replies perfectly if i send commands to it on minicom.Please guide me what is the problem.

HylaFAX scheduler on at91sam9263ek: Running                            
Modem ttyS1 (22): Waiting for modem to come ready  

Submitted by Roxana (not registered) on Tue, 2011-02-08 15:14.
Saludos! Muy buena la informacion, yo segui esta configuracion y ahora me esta resultando una fallita, y es que al ejecutar faxstat me pide un pssword, sabran a que se deba o que password es el que me solicita? Gracias. 
Submitted by Micha Spoli (not registered) on Thu, 2009-03-19 15:19.

Why  i cannot delete failed faxes from webinterface.

Maybe somebody have got an Idea?

 

Thanks for the Tutorial. Working on Ubuntu !

Submitted by Anonymous (not registered) on Thu, 2009-01-22 13:00.

How create the database for avantfax?

 

Please help.

Thankx for the good tutorial

Submitted by Nejc Menard (not registered) on Thu, 2008-10-30 11:14.

Hi to everyone and thanks for great tutorial...

I followed it and there is only one thing i would like to add i any one other had or that will not have the same problem...

 If you will try to automaticaly print faxes, you need to enable this in local-config.php file and install cupsys-bsd package that gives directly support to needed lpr program. if you only install lpr package it will not work...

 Works now as expected. I even put it in wmvare debian image... :-D Only sending faxes does not work, but this is modem problem i suppose.

Submitted by jereme (registered user) on Sat, 2008-03-08 02:46.

For Ubuntu 6.x and higher.

For if your hfaxd daemon is acting funny (client gives "can't get a socket" errors).

Edit your event.d file for your modem:

sudo vi /etc/event.d/ttyS0

If it is empty, first do the last instructions in the Handbook for Binary Package Install

http://www.hylafax.org/content/Handbook:Binary_Package_Install

Then add this line to the end and save:

exec /init.d/hylafax

Submitted by legolas (registered user) on Thu, 2008-01-03 02:02.

Why do you frequently reboot?

Restart services is most easier.

Submitted by tototyt (not registered) on Thu, 2009-04-09 11:10.

Error :
Fatal error: main() [<a href='function.main'>function.main</a>]: The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition &quot;AFUserAccount&quot; of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in /usr/share/avantfax-3.1.6/avantfax/index.php on line 18

 

Please Help Me