Minggu, 23 Mei 2010

fax server part2

Setelah kemarin kita persiapkan server nya sekarang kita mulai install sofware untuk fax server kita

pertama kita install hylafax sebagai engine server fax
# apt-get install hylafax-server
setelah teinstall waktunya untuk setting hylafax kita# faxsetupUntuk settingan kasih defaultnya saja
kecuali di
dan di sinicoba chek apakah hylafax kita sudah sinkron ma modem kita
# faxstat
bila begini bearti sudah benarnah selesai lah kita settng untuk hylafax kita
langkah selanjutnya adalah install avantfax nya....
kita install dulu defence-defence yang di butuhkan oleh si avantfax
#apt-get install apache2-mpm-prefork apache2-utils apache2.2-common libapache2-mod-php5 libapr1 libaprutil1 libsqlite3-0 php5-cli php5-common mysql-server imagemagick libtiff4-dev netpbm libnetpbm10-dev libungif-bin libungif4-dev sudo php-mail php-mail-mime php-file php-db php5-mysql psutils wdiff expect rsync php5-dev libmagic-dev php5-cgi

install fileinfo

#pecl install fileinfo
#pear install Mail Net_SMTP Mail_mime MDB2_driver_mysql fileinfo

pengalaman seh pas pake sintak pecl dan pear kalo di belakang proxy ga mau jalan tuh sintak
solusi yang di apke saya seh si server di baypass nembak langsung ke adsl,trus tambahin dnsnya dengan punyanya telkom baru jalanlah dia
Download avantfaxnya...

#wget http://downloads.sourceforge.net/avantfax/avantfax-3.1.6.tgz?use_mirror=osdn

Unzip filenya

#tar -xf avantfax-3.1.6.tgz

rubah file debian-install.sh-nya:

cd avantfax-3.1.6
vi debian-install.sh

ganti semua isinya dengan yang di bawah ini

###Begin########################################## #################

FAXDOMAIN=fax.mydomain.com
INSTDIR=/var/www/avantfax
HYLADIR=/usr/sbin
SPOOL=/var/spool/hylafax
USER=avantfax
PASS=d58fe49
DB=avantfax
HTTPDUSER=www-data
HTTPDGROUP=www-data

#!/bin/sh
#
# AvantFAX install script for Debian
# This script will configure /etc/sudoers and the HylaFAX hyla.conf, config, config. files
# Only run once
#

# CHECK IF HYLAFAX IS INSTALLED

echo "Checking for HylaFAX installation"

hyla=`which sendfax`
if [ "$?" -ne "0" ]; then
echo You must install and configure HylaFAX first
exit
fi

. ./debian-prefs.txt


## SETUP SMARTY
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 $HTTPDUSER:$HTTPDGROUP 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 avantfax/includes/dynconf.php

cp avantfax/includes/local_config-example.php avantfax/includes/local_config.php


# echo "AdminGroup: apache" >> /etc/hylafax/hfaxd.conf

# SETUP AVANTFAX JOBFMT

cat >> /etc/hylafax/hyla.conf << EOF

#
## JobFmt for AvantFAX
#
JobFmt: "%-3j %3i %1a %15o %40M %-12.12e %5P %5D %7z %.25s"

EOF

# INSTALL AVANTFAX

mv avantfax $INSTDIR
chown -R $HTTPDUSER.$HTTPDGROUP $INSTDIR
chmod -R 0770 $INSTDIR/tmp $INSTDIR/faxes
chown -R $HTTPDUSER.uucp $INSTDIR/tmp $INSTDIR/faxes


# IMPORT MYSQL DATABASE

/etc/init.d/mysql start

echo "## Creating AvantFAX MySQL database ##"
mysql --user=root --password=111111 -e "GRANT ALL ON $DB.* TO $USER@localhost IDENTIFIED BY \"$PASS\"" mysql
mysqladmin --default-character-set=utf8 --user=$USER --password=$PASS create $DB
mysql --user=$USER --password=$PASS $DB < create_tables.sql
mysqlshow --user=$USER --password=$PASS $DB

# SYMLINK AVANTFAX SCRIPTS

ln -s $INSTDIR/includes/faxrcvd.php $SPOOL/bin/faxrcvd.php
ln -s $INSTDIR/includes/dynconf.php $SPOOL/bin/dynconf.php
ln -s $INSTDIR/includes/notify.php $SPOOL/bin/notify.php

mv $HYLADIR/bin/faxcover $HYLADIR/bin/faxcover.old
ln -s $INSTDIR/includes/faxcover.php $HYLADIR/bin/faxcover

# FIX FILEINFO

ln -s /usr/share/file/magic* /usr/share/misc/

# SETUP SUDO PERMISSIONS

echo "Setting up sudo"

cat /etc/sudoers | grep -v requiretty > /tmp/sudoers
echo "$HTTPDUSER ALL= NOPASSWD: /sbin/reboot, /sbin/halt, /usr/sbin/faxdeluser, /usr/sbin/faxadduser -u * -p * *" >> /tmp/sudoers
mv /etc/sudoers /etc/sudoers.orig
mv /tmp/sudoers /etc/sudoers
chmod 0440 /etc/sudoers
chown root.root /etc/sudoers

# Make backup of HylaFAX configuration

mkdir /etc/hylafax/abackup
cp /etc/hylafax/config* /etc/hylafax/abackup/

# CONFIGURE MODEMS TO USE AVANTFAX

for i in `ls /etc/hylafax/config.*`; do
if [ "$i" != "/etc/hylafax/config.sav" ]; then
if [ "$i" != "/etc/hylafax/config.devid" ]; then
tilde=`echo $i | grep '~'`
if [ "$?" -eq "1" ]; then
if [ ! -L $i ]; then
cat >> $i << EOF

#
## AvantFAX
#
FaxRcvdCmd: bin/faxrcvd.php
DynamicConfig: bin/dynconf.php
UseJobTSI: true

EOF
fi
fi
fi
fi
done

cat >> /etc/hylafax/config << EOF

#
## AvantFAX
#
NotifyCmd: bin/notify.php

EOF

# ADD MODEMS TO DATABASE

for i in `ls /etc/hylafax/config.*`; do
if [ "$i" != "/etc/hylafax/config.sav" ]; then
if [ "$i" != "/etc/hylafax/config.devid" ]; then
tilde=`echo $i | grep '~'`
if [ "$?" -eq "1" ]; then
if [ -f $i ]; then
modem=`echo $i | awk -F'/' '{print $6}' | awk -F'.' '{print $2}'`

# ADD MODEMS TO AVANTFAX DATABASE
mysql --user=$USER --password=$PASS -e "INSERT INTO Modems SET device='$modem', alias ='$modem'" $DB

echo "Configuring $modem for AvantFAX"
fi
fi
fi
fi
done

# ADD CRONTAB ENTRIES

echo "Setting up /etc/cron.d/avantfax"
printf "0 0 * * *\t$INSTDIR/includes/avantfaxcron.php -t 2\n" > /etc/cron.d/avantfax

echo -e "Installation complete\n\n"

IP=`/sbin/ifconfig eth0 | grep "inet addr" | awk -F' ' '{print $2}' | awk -F':' '{print $2}'`

echo -e "Log into the Administrative interface at: http://$IP/admin/"
echo -e "Username: admin\nPassword: password"
# DONE #

###End############################################ ############

lihat warna yang bi kasih biru
password yang kita masukan harus sesuai dengan password pertama kita bikin mysql nya

Install Avantfax:

./debian-install.sh

rubah /etc/apache2/sites-enabled/000-default supaya lagsung tampil ke avantfax kita

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

ganti: DocumentRoot /var/www jadi DocumentRoot /var/www/avantfax
ganti: jadi

Save file and quit

rubah crontab

crontab -e

copi semaunya di akhir:

###Begin########################################

# 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/avantfaxcron.php -t 2

###End#########################################

Save file and quit

Reboot server:

#reboot -r now

setting Logon root dan setup hylafax users

/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 >> newhosts
echo localhost >> newhosts
cat /etc/hylafax/hosts.hfaxd >> newhosts
cat newhosts > /etc/hylafax/hosts.hfaxd
rm -f newhosts

Reboot box. Code:

#reboot -r now

Now you can access fax server: http://192.168.1.10/admin
bila kita nambah user atau ganti password
kita harus melakukan ini lagi....
bila tidak modem akan waiting trus ga mau idle

/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 >> newhosts
echo localhost >> newhosts
cat /etc/hylafax/hosts.hfaxd >> newhosts
cat newhosts > /etc/hylafax/hosts.hfaxd
rm -f newhosts

coba masuk ke avantfaf lagi
selesailah kita bikin faxserver dengan mengunkan avantfax berbasis ubuntu 9.10 server

Tidak ada komentar:

Posting Komentar