Сообщений: 3
|
Об установке и настройке * и freePBX (AMP) на FreeBSD
Поделюсь опытом.
1. FreeBSD - рулез! Всё устанавливается в /usr/local
2. Список портов (.tbz) и дистрибутивов (tar.gz), кои нужны. Цифры - порядок установки, !!!-установка с оговорками, смотри ниже. При установке портов на ошибки зависимостей не обращать внимания, устанавливать (с -f):
1--gawk-3.1.5.tar.gz
2--gettext-0.14.tar.gz (!!!)
3--libiconv-1.9.2_2.tbz
4--gettext-0.14.5_2.tbz
5--gmake-3.80_2.tbz
6--libslang-1.4.9.tbz
7--libtool-1.5.22_2.tbz
8--mpg123-0.59r_17.tbz
9--popt-1.7_1.tbz
10-newt-0.51.0_2.tbz
11-expat-2.0.0_1.tbz
12-m4-1.4.4.tbz
13-openldap-client-2.2.30.tbz
14-openh323-112-1.12.2.tbz
15-perl-5.8.8.tbz
16-pwlib152-1.5.2.tbz
17-curl-7.15.3.tbz
18-jpeg-6b_4.tbz
19-unixODBC-2.2.11_1.tbz
20-unzip-5.52_2.tbz
21-pkgconfig-0.20.tbz
22-libaudiofile-0.2.6.tbz
23-libxml2-2.6.23_1.tbz
24-openssl-0.9.8a.tbz
25-sox-12.17.8.tbz
26-libutf-8-1.0.tar.gz
27-ncurses-5.4.tbz
28-bison-1.75.tar.tar
29-tiff-3.8.2.tar.gz
30-png-1.2.8_3.tbz
31-cups-base-1.1.23.0_9.tbz
32-freetype2-2.1.10_3.tbz
33-gnutls-1.2.10_1.tbz
34-libgcrypt-1.2.2.tbz
35-libgpg-error-1.1.tbz
36-lcms-1.14.tar.gz
37-libmng-1.0.9.tbz
38-libdrm-2.0.1.tar.gz
39-fontconfig-2.3.2.tar.gz
40-xorg-libraries-6.9.0.tbz
41-libXft-2.1.7_1.tbz
42-nas-1.7b.tbz
43-qt-3.3.6_2.tbz
44-doxygen-1.4.6.tbz
45-libogg-1.1.3.tar.gz
46-speex-1.0.5.tar.gz
47-spandsp-0.0.2pre20.tar.gz (!!!)
48-lame-3.96.1.tar.gz
49-mime-construct-1.9.tar.gz
50-mysql-max-5.0.20a-freebsd6.0-i386.tar.gz
51-gd-2.0.33.tar.gz
52-httpd-2.2.0.tar.gz (!!!)
53-php-5.1.2.tar.tar (!!!)
54-DB-1.7.6.tgz (!!!)
55-Net-Daemon-0.39.tar.gz
56-PlRPC-0.2018.tar.gz
57-DBI-1.50.tar.gz
58-Net-Telnet-3.03.tar.gz
59-IPC-Signal-1.00.tar.gz
60-IPC-Signal-Force-0.001.tar.gz
61-Proc-WaitStat-1.00.tar.gz
62-Digest-SHA1-2.11.tar.gz
63-Net-MySQL-0.09.tar.gz
64-XML-NamespaceSupport-1.09.tar.gz
65-XML-Parser-2.34.tar.gz
66-XML-SAX-0.14.tar.gz
67-XML-SAX-PurePerl-0.80.tar.gz
68-Tie-IxHash-1.21.tar.gz
69-namespace-0.05.tar.gz
70-XML-Simple-2.14.tar.gz
71-phpMyAdmin-2.8.0.3.tar.bz2
72-zaptel-freebsd-0.11.tar.gz
73-libpri-1.2.2.tar.gz (!!!)
74-asterisk-1.2.7.1.tar.gz
75-asterisk-addons-1.2.2.tar.gz (!!!)
76-asterisk-sounds-1.2.1.tar.gz (!!!)
77-sounds_AST_01.zip (!!!)
78-asterisk-perl-0.08.tar.gz
79-Proc-ProcessTable-0.40.tar.gz
80-DBD-mysql-3.0002.tar.gz (!!!)
81-freepbx-2.0.1.tar.gz (!!!)
82-"!!!safe_asterisk!!!"
83-"!!!dialparties.agi!!!"
84-"!!!extension.conf!!!"
85-asterisk-stat-v2_0_1.tar.gz (!!!)
Кроме этого, при установке FreeBSD следует выбрать совместимость с Linux.
3. Оговорки к установкам:
!!!addons
в Makefile
CFLAGS+=-I../asterisk -I/usr/local/include
ASTLIBDIR=$(INSTALL_PREFIX)/usr/local/lib/asterisk
перед сборкой
perl -p -i.bak -e 's/CFLAGS.*D_GNU_SOURCE/CFLAGS+=-D_GNU_SOURCE\nCFLAGS+=-DMYSQL_LOGUNIQUEID/' Makefile
!!!apache
сборка
--enable-so
!!!asterisk-stat
mkdir /usr/local/apache2/htdocs/stat
cp -R * /usr/local/apache2/htdocs/stat
chown -R asterisk:asterisk /usr/local/apache2/htdocs/stat
в файле /usr/local/apache2/htdocs/stat/export_pdf.php исправить
include_once(dirname(__FILE__) . "/lib/fpdf.php");
!!!DB-1.7.6
скопировать все из каталога в /usr/local/lib/php/
!!!DBD_mysql
сборка
perl Makefile.PL --libs="-L/usr/local/mysql/lib -lmysqlclient -lz -lcrypt -lm" --cflags=-I/usr/local/mysql/include --testhost=127.0.0.1 --mysql_config=/usr/local/mysql/bin/mysql_config --testpassword='xxxx'
!!!freepbx
/usr/local/mysql/bin/mysqladmin -u root create asteriskcdrdb -p
/usr/local/mysql/bin/mysql --user=root --password='pass' asteriskcdrdb < <куда разжат>/freepbx-2.0.1/SQL/cdr_mysql_table.sql
/usr/local/mysql/bin/mysqladmin -u root create asterisk -p
/usr/local/mysql/bin/mysql --user root -p asterisk < <куда разжат>/freepbx-2.0.1/SQL/newinstall.sql
/usr/local/mysql/bin/mysql --user root -p
GRANT ALL PRIVILEGES ON asteriskcdrdb.* TO asteriskuser@localhost IDENTIFIED BY 'amp109';
GRANT ALL PRIVILEGES ON asterisk.* TO asteriskuser@localhost IDENTIFIED BY 'amp109';
выполнить прогу chg
получим файл 'oo', который sh oo
заменить в apply_conf.sh
sed -r -i "/\[general\]/!s/\[[a-zA-Z0-9]+\]/[$AMPMGRUSER]/" /etc/asterisk/manager.conf
на
sed -i a "s/AMPMGRUSER/$AMPMGRUSER/" /usr/local/etc/asterisk/manager.conf
mkdir /var/run/asterisk
chown asterisk:asterisk /var/run/asterisk
chmod 755 /var/run/asterisk
mkdir /usr/local/apache2/htdocs/css
cp -R /usr/local/apache2/htdocs/admin/cdr/css/* /usr/local/apache2/htdocs/css/
cp -R /usr/local/apache2/htdocs/admin/cdr/images/*.css /usr/local/apache2/htdocs/css/
chown -R asterisk:asterisk /usr/local/apache2/htdocs/admin
!!!gettext
сборка
--disable-csharp
!!!httpd.conf
AddHandler php5-script .php
AddType application/x-httpd-php .php
AddType application/x-httpd-php .phtml
AddType text/html .php
LimitRequestBody 20000000
DirectoryIndex index.html index.php index.phtml index.htm index.shtml index.cgi
!!!libpri
должен стоять bash (устанавливается при выборе совместимости с Linux)
права на каталог root:igorx
поправить INSTALL_BASE=/usr/local
cd /bin
ln -s /usr/compat/linux/bin/bash bash
после компиляции линк убрать!!
!!!php
env CPPFLAGS=-I/usr/local/include LDFLAGS=-L/usr/local/lib ./configure \
--with-apxs2=/usr/local/apache2/bin/apxs \
--with-mysql=/usr/local/mysql \
--with-gd \
--with-jpeg-dir=/usr/local/lib \
--with-png-dir=/usr/local/lib \
--with-xpm-dir=/usr/local/lib \
--with-freetype-dir=/usr/local/lib \
--with-zlib-dir=/usr/local/lib \
--with-gettext \
--with-libmbfl \
--enable-mbstring
!!!safe_asterisk
поправить
TTY=v9
${ASTSBINDIR}/asterisk ${CLIARGS} ${ASTARGS} >&1 /dev/${TTY} < /dev/${TTY}
!!!souns
в Makrfile
ASTLIBDIR=$(INSTALL_PREFIX)/usr/local/lib/asterisk
ASTVARLIBDIR=$(INSTALL_PREFIX)/usr/local/share/asterisk
ASTETCDIR=$(INSTALL_PREFIX)/usr/local/etc/asterisk
ASTSPOOLDIR=$(INSTALL_PREFIX)/var/spool/asterisk
ASTLOGDIR=$(INSTALL_PREFIX)/var/log/asterisk
ASTHEADERDIR=$(INSTALL_PREFIX)/usr/local/include/asterisk
ASTCONFPATH=$(ASTETCDIR)/asterisk.conf
ASTBINDIR=$(INSTALL_PREFIX)/usr/local/bin
ASTSBINDIR=$(INSTALL_PREFIX)/usr/local/sbin
ASTVARRUNDIR=$(INSTALL_PREFIX)/var/run
разжать русские звуки и копи
cp -R sounds/* /usr/local/share/asterisk/sounds/
!!!spandsp
в src/Makefile
# INCLUDES = -I$(top_buildir)
!!!zaptel
при сборке ядра добавить
options HZ=1000
в файл /boot/loader.conf добавить
zaptel_load="YES"
ztdummy_load="YES"
wcfxs_load="YES"
wct1xxp_load="YES"
wcte11xp_load="YES"
wct4xxp_load="YES"
wcfxo_load="YES"
cp zaptel.conf /usr/local/etc/zaptel.conf
!!!libutf8
cp libutf-8.so.1 /usr/lib
ln /usr/lib/libutf-8.so.1 /usr/lib/libutf-8.so
cp utf-8.h /usr/include
cp libutf-8.3 /usr/local/man/man3
cp fgetu8.3 /usr/local/man/man3
cp fputu8.3 /usr/local/man/man3
cp sgetu8.3 /usr/local/man/man3
cp sputu8.3 /usr/local/man/man3
патч
--- Makefile.orig Thu Apr 1 01:00:12 1999
+++ Makefile Fri Apr 16 18:11:12 1999
@@ -29,5 +29,5 @@
all: libutf-8.so.1
libutf-8.so.1: fget.utf-8.o sget.utf-8.o fput.utf-8.o sput.utf-8.o nomacros.o
- ld -o libutf-8.so.1 fget.utf-8.o sget.utf-8.o fput.utf-8.o sput.utf-8.o nomacros.o -shared -soname libutf-8.so
+ ld -o $@ fget.utf-8.o sget.utf-8.o fput.utf-8.o sput.utf-8.o nomacros.o -shared -soname $@
--------------------------
файл chg
#!/bin/sh
echo "cd <куда разжат>/freepbx-2.0.1" >oo
ls -Rwpl <куда разжат>/freepbx-2.0.1 | /usr/local/bin/gawk '
$9!~/\/$/ {
if($1~/^total/) {next}
u=gensub("-","","G",substr($1,2,3))
g=gensub("-","","G",substr($1,5,3))
o=gensub("-","","G",substr($1,8))
if($1~/:$/) {
print "cd "gensub(":","","G",$1)
}else{
if($1=="") {
print "cd <куда разжат>/freepbx-2.0.1\n"
}else{
print "~<куда разжат>/cnv "$9
print "chmod u="u",g="g",o="o" "$9
}
}
}' >>oo
-------------
файл cnv
#!/bin/sh
echo $1 | /usr/local/bin/awk '
{
while ((getline var <$1) >0) {
out = $1".new"
var = gensub("/etc","/usr/local/etc","G",var)
var = gensub("sed -r -i","sed -i a","G",var)
var = gensub("/usr/lib/asterisk/modules","/usr/local/lib/asterisk/modules","G",var)
var = gensub("/var/lib/asterisk","/usr/local/share/asterisk","G",var)
var = gensub("/dev/tty9","/dev/ttyv9","G",var)
var = gensub("/bin/bash","/usr/compat/linux/bin/bash","G",var)
var = gensub("/usr/bin/php","/usr/local/bin/php","G",var)
var = gensub("/usr/sbin","/usr/local/sbin","G",var)
var = gensub("/var/www/html","/usr/local/apache2/htdocs","G",var)
var = gensub("/var/www/cgi-bin","/usr/local/apache2/cgi-bin","G",var)
var = gensub("pidof -x","pgrep -f","G",var)
var = gensub("pidof ","pgrep ","G",var)
var = gensub("killall -9 safe_opserver","kill -9 `pgrep -f safe_opserver`","G",var)
var = gensub("killall -9 op_server.pl","kill -9 `pgrep -f op_server.pl`","G",var)
print var >> out
}
print "-"$1
close($1)
close(out)
system("mv -f "$1".new "$1)
close("mv -f "$1".new "$1)
}'
------------------------
В результате - без ошибок работающий * и freePBX.
|