debian,ubuntu,linux,howtos,manuals,notes,manpages

avantfax on debian

February 15, 2009
By

fax.cipar.net (192.168.1.10)

The hylafax server receives and sends faxes and is accessible via Avantfax on http://192.168.1.10

THE AVANTFAX PART OF THIS THIS PAGE IS OUTDATEd by the avantfax debian.sh script which does basically all the avantfax install below but i keep this page for reference and posterity

installation

newvserver --vsroot /VSERVERS --hostname fax --domain cipar.net --ip 192.168.1.10/24 --dist etch --mirror http://192.168.1.12:3142/debian.apt-get.eu/debian --interface dummy0
# cd /usr/local/sbin
# ./set-context.sh fax
vserver fax start
vserver fax enter
locale-gen
# nano /etc/apt/sources.list
deb http://192.168.1.12:3142/security.debian.org/ etch/updates main contrib
deb-src http://192.168.1.12:3142/security.debian.org/ etch/updates main contrib
deb http://192.168.1.12:3142/debian.apt-get.eu/debian/ etch main contrib non-free
# apt-get update

HylaFAX

http://manpages.songshu.org/manpages/lenny/en/man5/hylafax-server.5.html

http://www.howtoforge.com/build-a-hylafax-server-with-avantfax-on-debian-etch
http://www.lucasmanual.com/mywiki/FaxServer
http://www.avantfax.com/install.php

# apt-get install postfix
chhose No configuration
# nano /etc/aliases

and add the following

root:   randall@smydomain
# newaliases
# apt-get install hylafax-server
# exit
# cp -a /dev/ttyS0 /VSERVERS/fax/dev/ttyS0
# cp -aR /dev/null /VSERVERS/fax/var/spool/hylafax/dev
# vserver fax enter
# faxsetup
enter for the defaults until the country code
# Country code [1]? 31
# Area code [415]? 10
# Phone number of fax modem [+1.999.555.1212]? +31.10.1234567
# Local identification string (for TSI/CIG) ["NothingSetup"]? fax.cipar.net
# Long distance dialing prefix [1]? 0
# International dialing prefix [011]? 00
# Protection mode for received facsimile [0600]? 0644
# Protection mode for session logs [0600]? 0644
# Protection mode for ttyS0 [0600]? 0666

Allow users from our subnet access to the fax service:

# nano /etc/hylafax/hosts.hfaxd

on the bottom of the file

192.168.:::
# exit
# vserver fax restart
# vserver fax enter
faxstat -a -s

should show something like this

HylaFAX scheduler on fax.cipar.net: Running
Modem ttyS0 (+**.**.*******): 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 &lt;password&gt; -p &lt;password&gt; -u 100 admin

AvantFax

Below seems largely to be not needed anymore!!!!!!! There is a debian-install.sh now that seems to do basically all below automatically, i have tried it and it worked, even the “rotate” option for the faxes work now without a problem.
The script was not perfect yet since some steps needed to be repeated after the script manually.
Manually repeat this steps from the script:

/usr/sbin/faxadduser -f newhosts -a pwd www-data
/usr/sbin/faxdeluser localhost
/usr/sbin/faxdeluser 127.0.0.1
echo 127.0.0.1 &gt;&gt; newhosts
cat /etc/hylafax/hosts.hfaxd &gt;&gt; newhosts
cat newhosts &gt; /etc/hylafax/hosts.hfaxd
rm -f newhosts
reboot the server

first we install all the needed dependencies

# apt-get install apache2-mpm-prefork apache2-utils apache2.2-common libapache2-mod-php5 php5 php-pear php5-mysql php5-pgsql php5-cli php5-cgi mysql-server netpbm php5-imagick dh-make-php libmagic-dev libungif4g libpng3 sudo libtiff4-dev gs-gpl gsfonts expect php5-dev make php-pear psutils libnetpbm10-dev libungif-bin libungif4-dev php-db php-file php-http php-mail php-mail-mime php-net-smtp php-net-socket php-xml-parser wdiff

And the avantfax itself

# cd /usr/src
# wget http://easynews.dl.sourceforge.net/sourceforge/avantfax/avantfax-3.0.6.tgz
# tar zvxf avantfax-3.0.6.tgz
# cd avantfax-3.0.6
# pear channel-update pear.php.net
# pear upgrade-all
# pear install Mail Net_SMTP Mail_mime MDB2_driver_mysql MDB2_driver_pgsql
# pecl install fileinfo
# chmod 0770 avantfax/includes/templates/admin_theme/templates_c/ avantfax/includes/templates/admin_theme/cache/ avantfax/includes/templates/main_theme/templates_c/ avantfax/includes/templates/main_theme/cache/
# chown www-data:www-data avantfax/includes/templates/admin_theme/templates_c/ avantfax/includes/templates/admin_theme/cache/ avantfax/includes/templates/main_theme/templates_c/ avantfax/includes/templates/main_theme/cache/
# chmod 0755 avantfax/includes/faxcover.php avantfax/includes/faxrcvd.php avantfax/includes/notify.php avantfax/tools/update_contacts.php avantfax/tools/faxcover.php avantfax/includes/avantfaxcron.php
# cp avantfax/includes/local_config-example.php avantfax/includes/local_config.php
# nano avantfax/includes/local_config.php

Change the following defaults

$FAXRMPWD = "pwd";
define ('ADMIN_EMAIL', 'root@localhost');
$AVANTFAX_SERVERNAME = 'fax.cipar.net'; //

Make sure ”-a pwd” is the same as the “$FAXRMPWD = “pwd”;” as above

# /usr/sbin/faxadduser -f newhosts -a pwd www-data
# /usr/sbin/faxdeluser localhost
# /usr/sbin/faxdeluser 127.0.0.1
# echo 127.0.0.1 &gt;&gt; newhosts
# cat /var/spool/hylafax/etc/hosts.hfaxd &gt;&gt; newhosts
# cat newhosts &gt; /var/spool/hylafax/etc/hosts.hfaxd
# rm -f newhosts
# echo 'JobFmt: "%-3j %3i %1a %15o %40M %-12.12e %5P %5D %7z %.25s"' &gt;&gt; /etc/hylafax/hyla.conf
# mv avantfax /var/www/avantfax
# chown -R www-data.www-data /var/www/avantfax
# chmod -R 777 /var/www/avantfax/tmp /var/www/avantfax/faxes
# nano /etc/apache2/sites-enabled/000-default
NameVirtualHost *
 &lt;VirtualHost *&gt;
        DocumentRoot /var/www/avantfax
        ServerName avantfax
&lt;/virtualhost&gt;
# /etc/init.d/mysql restart
# /etc/init.d/apache2 restart
# mysql --user=root -e "GRANT ALL ON avantfax.* TO avantfax@localhost IDENTIFIED BY "d58fe49"" mysql
# mysqladmin --default-character-set=utf8 --user=avantfax --password=d58fe49 create avantfax
# mysql --user=avantfax --password=d58fe49 avantfax &lt; create_tables.sql
# mysqlshow --user=avantfax --password=d58fe49 avantfax
# ln -s /var/www/avantfax/includes/faxrcvd.php /var/spool/hylafax/bin/faxrcvd.php
# ln -s /var/www/avantfax/includes/notify.php  /var/spool/hylafax/bin/notify.php
# mv /usr/bin/faxcover /usr/bin/faxcover.old
# ln -s /var/www/avantfax/includes/faxcover.php /usr/bin/faxcover
# ln -s /usr/share/file/magic* /usr/share/misc/
# cat /etc/sudoers | grep -v requiretty &gt; /tmp/sudoers
# echo "www-data ALL= NOPASSWD: /sbin/reboot, /sbin/halt, /usr/sbin/faxdeluser, /usr/sbin/faxadduser -u * -p * *" &gt;&gt; /tmp/sudoers
# mv /etc/sudoers /etc/sudoers.orig
# mv /tmp/sudoers /etc/sudoers
# chmod 0440 /etc/sudoers
# nano /var/spool/hylafax/etc/config

and add the following on at the bottom

#
## AvantFAX configuration
#
NotifyCmd:      bin/notify.php
# nano /var/spool/hylafax/etc/config.ttyS0

#
## AvantFAX configuration
#
FaxrcvdCmd:     bin/faxrcvd.php
# crontab -l &gt; /tmp/tab
# echo -e "0 0 * * *t/var/www/avantfax/includes/avantfaxcron.php -t 2" &gt;&gt; /tmp/tab
# crontab /tmp/tab
# rm -f /tmp/tab
# mv /var/spool/hylafax/etc/config /etc/hylafax/config
# mv /var/spool/hylafax/etc/hosts.hfaxd /etc/hylafax/hosts.hfaxd
# mv /var/spool/hylafax/etc/config.ttyS0 /etc/hylafax/config.ttyS0
# /etc/init.d/hylafax restart
# nano /etc/postfix/master.cf

At the top comment out:

#smtp      inet  n       -       -       -       -       smtpd

And att the bottom add

fax       unix  -       n       n       -       1       pipe
  flags= user=faxmail argv=/usr/bin/faxmail -d -n ${user}
# nano /etc/postfix/transport

and add

yourdomain.com       fax:localhost
# postmap /etc/postfix/transport
# nano /etc/hylafax/faxmail.conf
# nano /etc/postfix/main.cf
fax_destination_recipient_limit = 1
nano /etc/hylafax/faxmail.conf
AutoCoverPage: false
TextPointSize: 12pt
Headers: Message-id Date Subject From
MailUser: faxmail
# /etc/init.d postfix reload

Be carefull not to loose any sleep when doing this the first time, but if you do the result will look like this!

backup

For the backup we need ssh and rsync

# apt-get install openssh-server
# apt-get install rsync

and make sure ssh only listens to the local address

ListenAddress 192.168.1.10
# /etc/init.d/ssh restart
newvserver --vsroot /VSERVERS --hostname fax --domain cipar.net --ip 192.168.1.10/24 --dist etch --mirror http://192.168.1.12:3142/debian.apt-get.eu/debian --interface dummy0
cd /usr/src
wget http://easynews.dl.sourceforge.net/sourceforge/avantfax/avantfax-3.1.3.tgz
tar zvxf avantfax-3.1.3.tgz
cd avantfax-3.1.3
 nano debian-prefs.txt
# DEFAULT INSTALL VALUES FOR Debian
#
# BEWARE: Only run the install script once or risk having duplicate
#         settings in your sendmail, sudo, and other configuration files
#
# The debian-install.sh script refers to this file
#

# The domain name for configuring email to fax
FAXDOMAIN=fax.cipar.net

# The installation directory for AvantFAX
INSTDIR=/var/www/avantfax

# The root directory where HylaFAX bin files are stored (typically, /usr or /usr/local)
HYLADIR=/usr

# HylaFAX $SPOOL directory (typically, /var/spool/hylafax or /var/spool/fax)
SPOOL=/var/spool/hylafax

# These are the database settings AvantFAX will create and use
USER=avantfax
PASS=d58fe49
DB=avantfax

# if the MySQL password for root is set, specify it here
ROOTMYSQLPWD=

# The user and group which Apache runs as (typically, apache, wwwrun, nobody, etc...)
HTTPDUSER=www-data
HTTPDGROUP=www-data

Tags: , , , ,

2 Responses to avantfax on debian

  1. KrisBelucci on June 2, 2009 at 6:58 pm

    Hi, good post. I have been wondering about this issue,so thanks for posting.

  2. Almaz on March 22, 2010 at 11:38 am

    I want to thank you for most comprehensive how to on avantfax install. I was struggling for few weeks, working on it. After I came across your website everything went fast and smooth.

Leave a Reply

Your email address will not be published. Required fields are marked *

*