Introduction
This is a how i installed asterisk 13 with freepbx 13 on a default jail on FreeNAS 9.10
Installation
Console in jail userland
Why ever but asterisk13 needs to be installed twice. jpeg-turbo and libslang2 needs to be installed before
otherwise there are weird conflicts and asterisk wasn't installable.
- Bash is needed for some freepbx scripts
- sudo is also needed by freepbx
Enabling services:
Configuring / Setting up apache / php for freepbx
Setting up asterisk so that freepbx is able to install.
Creating a home directory for the service user..
Yeah thats odd, but the user is used by freepbx and imports some gpg keys with that user.
Starting the first services:
If you are like me, you will change the mysql default root pw
Get the freepbx source and extract it
Install freepbx.
I kept everything at the defaults besides the mysql root pw created.
Some error will occur at the very end of the installation script.
Sometimes i saw that the asterisk user did not get all keys needed so heres a little script:
What you should see:
IF you miss one of them you could do:
There seems to be an issue with a with the rights of the created directory at
/usr/local/freepbx, thats why at the end of the install script a command might fail.
At least at my jail it did.
Heres the fix:
Now we need to reload the configuration, but before we do, we also need to fix a certificate location issue in freepbx. It defaults to /etc/asterisk/keys even if its empty so we change that.
Now we start the apache and can go to the Server ip at port 80.
Actually im working on hylafax maybe i'll add that later.
fail2ban asterisk security will be added here.
This is a how i installed asterisk 13 with freepbx 13 on a default jail on FreeNAS 9.10
Installation
Console in jail userland
Code:
pkg update pkg upgrade pkg install -y jpeg-turbo libslang2 asterisk13 pkg install -y asterisk13
Why ever but asterisk13 needs to be installed twice. jpeg-turbo and libslang2 needs to be installed before
otherwise there are weird conflicts and asterisk wasn't installable.
Code:
pkg install -y apache24 mysql56-server pkg install -y sudo sox py27-fail2ban bash pkg install -y php56 php56-pdo php56-pdo_mysql php56-mysql php56-simplexml \ php56-zlib php56-xml pear php56-gettext php56-json mod_php56 \ php56-posix php56-ctype php56-gd php56-session gnupg php56-filter \ php56-dom php56-xmlreader php56-hash php56-mbstring php56-curl
- Bash is needed for some freepbx scripts
- sudo is also needed by freepbx
Enabling services:
Code:
echo ' \ mysql_enable="YES" \ asterisk_enable="YES" \ apache24_enable="YES" \ ' > /etc/rc.conf
Configuring / Setting up apache / php for freepbx
Code:
echo 'export PATH=$PATH:/usr/local/bin:/usr/local/sbin:/usr/local/freepbx/bin:/usr/local/freepbx/sbin' > /usr/local/etc/apache24/envvars.d/path.env echo '<FilesMatch "\.php$"> \ SetHandler application/x-httpd-php \ </FilesMatch> \ <FilesMatch "\.phps$"> \ SetHandler application/x-httpd-php-source \ </FilesMatch>' > /usr/local/etc/apache24/Includes/php.conf sed -i '' 's/\(^upload_max_filesize = \).*/\120M/' /usr/local/etc/php.ini-production sed -i '' 's/\(^memory_limit = \).*/\1256M/' /usr/local/etc/php.ini-production sed -i '' 's/^(User|Group).*/\1 asterisk/' /usr/local/etc/apache24/httpd.conf sed -i '' 's/AllowOverride None/AllowOverride All/' /usr/local/etc/apache24/httpd.conf sed -i '' 's/DirectoryIndex index.html/DirectoryIndex index.php index.html/' /usr/local/etc/apache24/httpd.conf sed -i '' 's/\/usr\/local\/www\/apache24\/data/\/usr\/local\/www\/freepbx/' /usr/local/etc/apache24/httpd.conf
Setting up asterisk so that freepbx is able to install.
Code:
sed -i '' 's/\[directories\](\!)/[directories]/' /usr/local/etc/asterisk/asterisk.conf
Creating a home directory for the service user..
Yeah thats odd, but the user is used by freepbx and imports some gpg keys with that user.
Code:
mkdir /home/asterisk chown asterisk:asterisk /home/asterisk pw usermod asterisk -d /home/asterisk/ -m
Starting the first services:
Code:
service asterisk start service mysql-server start
If you are like me, you will change the mysql default root pw
Code:
mysqladmin -u root password
Get the freepbx source and extract it
Code:
cd /root curl -O http://mirror.freepbx.org/modules/packages/freepbx/freepbx-13.0-latest.tgz tar xfz freepbx-13.0-latest.tgz cd freepbx
Install freepbx.
I kept everything at the defaults besides the mysql root pw created.
Some error will occur at the very end of the installation script.
Code:
./install
Sometimes i saw that the asterisk user did not get all keys needed so heres a little script:
What you should see:
Code:
gpg --list-keys pub rsa4096/69D2EAD9 2014-05-05 [SC] uid [ unknown] FreePBX Mirror 1 (Module Signing - 2014/2015) <security@freepbx.org> sub rsa4096/CCEBF9CB 2014-05-05 [E] pub rsa4096/B33B4659 2014-04-30 [SC] uid [ unknown] FreePBX Module Signing (This is the master key to sign FreePBX Modules) <modules@freepbx.org> sub rsa4096/5C2FE148 2014-04-30 [E]
IF you miss one of them you could do:
Code:
gpg --recv-key 9F9169F4B33B4659 gpg --recv-key 86CE877469D2EAD9 gpg --export-key -a 9F9169F4B33B4659 > 9F9169F4B33B4659.key gpg --export-key -a 86CE877469D2EAD9 > 86CE877469D2EAD9.key sudo -u asterisk gpg --import 9F9169F4B33B4659.key sudo -u asterisk gpg --import 86CE877469D2EAD9.key
There seems to be an issue with a with the rights of the created directory at
/usr/local/freepbx, thats why at the end of the install script a command might fail.
At least at my jail it did.
Heres the fix:
Code:
chmod 0755 /usr/local/freepbx
Now we need to reload the configuration, but before we do, we also need to fix a certificate location issue in freepbx. It defaults to /etc/asterisk/keys even if its empty so we change that.
Code:
/usr/local/freepbx/bin/fwconsole set CERTKEYLOC /usr/local/etc/asterisk/keys /usr/local/freepbx/sbin/fwconsole reload
Now we start the apache and can go to the Server ip at port 80.
Code:
service apache24 start
Actually im working on hylafax maybe i'll add that later.
fail2ban asterisk security will be added here.
Code:
....fail2ban....
Last edited: