FreePBX (VoIP) Server unter Ubuntu installieren

installieren, modifizeren, administrieren
Post Reply
User avatar
h3rb3rn
Administrator
Posts: 191
Joined: Mon 9. Feb 2015, 23:29

FreePBX (VoIP) Server unter Ubuntu installieren

Post by h3rb3rn »

*** Entwurf ***

Quelle: http://wiki.freepbx.org/display/FOP/Ins ... +14.04+LTS

Code: Select all

apt-get install -y build-essential openssh-server apache2 mysql-server mysql-client bison flex php5 php5-curl php5-cli php5-mysql php-pear php-db php5-gd curl sox libncurses5-dev libssl-dev libmysqlclient-dev mpg123 libxml2-dev libnewt-dev sqlite3 libsqlite3-dev pkg-config automake libtool autoconf git subversion unixodbc-dev uuid uuid-dev libasound2-dev libogg-dev libvorbis-dev libcurl4-openssl-dev libical-dev libneon27-dev libsrtp0-dev libspandsp-dev libmyodbc


Install iksemel

Code: Select all

cd /usr/src
wget https://iksemel.googlecode.com/files/iksemel-1.4.tar.gz
tar xf iksemel-1.4.tar.gz
cd iksemel-*
./configure
make
make install



Install and Configure Asterisk
Download Asterisk source files.

Code: Select all

cd /usr/src
wget http://downloads.asterisk.org/pub/telephony/dahdi-linux-complete/dahdi-linux-complete-current.tar.gz
wget http://downloads.asterisk.org/pub/telephony/libpri/libpri-1.4-current.tar.gz
wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-12-current.tar.gz
git clone https://github.com/akheron/jansson.git
git clone https://github.com/asterisk/pjproject.git


Compile and install DAHDI.
If you don't have any physical hardware you don't need to run these commands

Code: Select all

cd /usr/src
tar xvfz dahdi-linux-complete-current.tar.gz
cd dahdi-linux-complete-*
make all
make install
make config


Compile and install LIBPRI.
If you don't have any physical hardware you don't need to run these commands

Code: Select all

cd /usr/src
tar xvfz libpri-1.4-current.tar.gz
cd libpri-*
make
make install



Compile and install pjproject

Code: Select all

cd /usr/src/pjproject
./configure --enable-shared --disable-sound --disable-resample --disable-video --disable-opencore-amr
make dep
make
make install
Compile and Install jansson
cd /usr/src/janssonCompile and install LIBPRI.
autoreconf -i
./configure
make
make install



Compile and install Asterisk

Code: Select all

cd /usr/src
tar xvfz asterisk-12-current.tar.gz
cd asterisk-*
./configure
contrib/scripts/get_mp3_source.sh
make menuselect


You will be prompted at the point to pick which modules to build. Most of them will be enabled, but if you want to have MP3 support, you need to manually turn on 'format_mp3' on the first page.

After selecting 'Save & Exit' you can then continue

Code: Select all

make
make install
make config
ldconfig



Install Asterisk-Extra-Sounds
Note that this installs the (8khz) 'wav' soundfiles. If you're planning on running G722 (High Definition 'Wideband') audio, you also want to download the 722 codec pack, which is the second part. If you're not planning on using Wideband, you can skip that part.

Code: Select all

cd /var/lib/asterisk/sounds
wget http://downloads.asterisk.org/pub/telephony/sounds/asterisk-extra-sounds-en-wav-current.tar.gz
tar xfz asterisk-extra-sounds-en-wav-current.tar.gz
rm -f asterisk-extra-sounds-en-wav-current.tar.gz
# Wideband Audio download
wget http://downloads.asterisk.org/pub/telephony/sounds/asterisk-extra-sounds-en-g722-current.tar.gz
tar xfz asterisk-extra-sounds-en-g722-current.tar.gz
rm -f asterisk-extra-sounds-en-g722-current.tar.gz


Install and Configure FreePBX
Download and extract FreePBX.

Code: Select all

wget http://mirror.freepbx.org/modules/packages/freepbx/freepbx-12.0-latest.tgz
tar vxfz freepbx-12-latest.tgz
cd freepbx


Now create the Asterisk user and set ownership permissions.

Code: Select all

useradd -m asterisk
chown asterisk. /var/run/asterisk
chown -R asterisk. /etc/asterisk
chown -R asterisk. /var/{lib,log,spool}/asterisk
chown -R asterisk. /usr/lib/asterisk
rm -rf /var/www/html


A few small modifications to Apache.

Code: Select all

sed -i 's/\(^upload_max_filesize = \).*/\120M/' /etc/php5/apache2/php.ini
cp /etc/apache2/apache2.conf /etc/apache2/apache2.conf_orig
sed -i 's/^\(User\|Group\).*/\1 asterisk/' /etc/apache2/apache2.conf
service apache2 restart

Configure ODBC

Edit /etc/odbcinst.ini and add the following. Note that this command assumes you are installing to a new machine, and that the file is empty. If this is not a freshly installed machine, please manually verify the contents of the file, rather than just copying and pasting the lines below. The 'EOF' does no go in the file, it simply signals to the 'cat' command that you have finished pasting.

Code: Select all

cat >> /etc/odbcinst.ini


Code: Select all

[MySQL]
Description = ODBC for MySQL
Driver = /usr/lib/x86_64-linux-gnu/odbc/libmyodbc.so
Setup = /usr/lib/x86_64-linux-gnu/odbc/libodbcmyS.so
FileUsage = 1


You may need to verify these paths, if you're not on a x86_64 machine. You can use the command `find / -name libmyodbc.so` to verify the location

Edit or create /etc/odbc.ini and add the following section. Note that, again, this command assumes you are installing to a new machine, and the file is empty. Please manually verify the contents of the files if this is not the case.

Code: Select all

cat >> /etc/odbc.ini << EOF
[MySQL-asteriskcdrdb]
Description=MySQL connection to 'asteriskcdrdb' database
driver=MySQL
server=localhost
database=asteriskcdrdb
Port=3306
Socket=/var/run/mysqld/mysqld.sock
option=3


Prepare MySQL

You now need to generate a secure password for FreePBX to use to talk to MySQL.

Code: Select all

export ASTERISK_DB_PW=`dd if=/dev/urandom bs=1 count=32 2>/dev/null | base64 - | cut -c2-18`


That will generate a quasi-random 16 character long password, which should be secure enough for most things. If you had set the MySQL 'root' password to be something when you were installing the machine, you will need to add a -pyourpassword flag to the following lines
Configure Asterisk database in MYSQL.

Code: Select all

mysqladmin -u root create asterisk
mysqladmin -u root create asteriskcdrdb
Set permissions on MYSQL database.
mysql -u root -e "GRANT ALL PRIVILEGES ON asterisk.* TO asteriskuser@localhost IDENTIFIED BY '${ASTERISK_DB_PW}';"
mysql -u root -e "GRANT ALL PRIVILEGES ON asteriskcdrdb.* TO asteriskuser@localhost IDENTIFIED BY '${ASTERISK_DB_PW}';"
mysql -u root -e "flush privileges;"
Restart Asterisk and install FreePBX.
./start_asterisk start
./install_amp --installdb --username=asteriskuser --password=${ASTERISK_DB_PW}
amportal chown
amportal a ma installall
amportal a reload
amportal a ma refreshsignatures
amportal chown


Finally, one last mod and start FreePBX.

Code: Select all

ln -s /var/lib/asterisk/moh /var/lib/asterisk/mohmp3
amportal restart
Start FreePBX


Now FreePBX is installed, it will be available via Apache.
Post Reply