Install FreePBX on Ubunto20

Hello,

I have try to install FreePBX on Ubuntu20.04 using this guide

[הקלידו או הדביקו קוד כאן](https://www.atlantic.net/vps-hosting/how-to-install-asterisk-and-freepbx-on-ubuntu-20-04/)

the installtion went OK - didn’t get any errors
coudn’t get to the web interface

this time I can see Asterisk is running , but when I run fwconsole I get error

 fwconsole status
PHP Warning:  include_once(/etc/freepbx.conf): failed to open stream: Permission denied in /var/lib/asterisk/bin/fwconsole on line 12
PHP Warning:  include_once(): Failed opening '/etc/freepbx.conf' for inclusion (include_path='.:/usr/share/php') in /var/lib/asterisk/bin/fwconsole on line 12
PHP Fatal error:  Class 'Symfony\Component\Console\Application' not found in /var/www/html/admin/libraries/FWApplication.class.php on line 11

what is wrong this time?

****a small thought:
mayeb I’m installing it wrong?
some command I’m using sudo
some from root user
and some without nothing

בוקר טוב

Try running

fwconsole chown

Actually, I am reading now this guide, it guides you to install Asterisk 17 which is EOL.

For beginners we usually recommend to install the FreePBX distro which is based on CentOS7. You can get it here: Download | FreePBX - Let Freedom Ring

However, if you do want a manual install, I have success with Bill Simon’s Debian guides. Here’s FreePBX16 with Asterisk 16 on Debian 11: How to Install FreePBX 16 on Debian 11 with Asterisk 16 - FreePBX Documentation - Documentation

fwconsole chown
PHP Warning: include_once(/etc/freepbx.conf): failed to open stream: Permission denied in /var/lib/asterisk/bin/fwconsole on line 12
PHP Warning: include_once(): Failed opening ‘/etc/freepbx.conf’ for inclusion (include_path=‘.:/usr/share/php’) in /var/lib/asterisk/bin/fwconsole on line 12
PHP Fatal error: Class ‘Symfony\Component\Console\Application’ not found in /var/www/html/admin/libraries/FWApplication.class.php on line 11
[email protected]:~$ sudo fwconsole chown
Taking too long? Customize the chown command, See FreePBX Chown Conf - FreePBX OpenSource Project - Documentation
Setting Permissions…
Setting base permissions…Done in 1 seconds
Setting specific permissions…
28141 [============================]
Finished setting permissions

fwconsole status
PHP Warning: include_once(/etc/freepbx.conf): failed to open stream: Permission denied in /var/lib/asterisk/bin/fwconsole on line 12
PHP Warning: include_once(): Failed opening ‘/etc/freepbx.conf’ for inclusion (include_path=‘.:/usr/share/php’) in /var/lib/asterisk/bin/fwconsole on line 12
PHP Fatal error: Class ‘Symfony\Component\Console\Application’ not found in /var/www/html/admin/libraries/FWApplication.class.php on line 11
[email protected]:~$ fwconsole start
PHP Warning: include_once(/etc/freepbx.conf): failed to open stream: Permission denied in /var/lib/asterisk/bin/fwconsole on line 12
PHP Warning: include_once(): Failed opening ‘/etc/freepbx.conf’ for inclusion (include_path=‘.:/usr/share/php’) in /var/lib/asterisk/bin/fwconsole on line 12
PHP Fatal error: Class ‘Symfony\Component\Console\Application’ not found in /var/www/html/admin/libraries/FWApplication.class.php on line 11

reboot
still not working - get the same error message


That’s not a command. You can see all fwconsole commands here: fwconsole commands (13+) - PBX GUI - Documentation and here: fwconsole commands (15+) - PBX GUI - Documentation

What is the output of:

ls -la /etc/freepbx.conf

It should look like this:

[email protected]:~# ls -la /etc/freepbx.conf
-rw-rw---- 1 asterisk asterisk 350 Jun  8 09:46 /etc/freepbx.conf

I get the resualt you get

[email protected]:~$ ls -la /etc/freepbx.conf
-rw-rw---- 1 asterisk asterisk 350 Jul 27 07:04 /etc/freepbx.conf

It looks like you are not logged in as root, which if you are not running things with elevated permission, you will run into issues. Have you installed Asterisk/FreePBX with elevated permissions?

What happens when you run

sudo fwconsole reload
 sudo fwconsole reload
Reload Started

In Self_Helper.class.php line 212:

  Unable to locate the FreePBX BMO Class 'Pm2'A required module might be disabled or uninstalled. Recommende
  d steps (run from the CLI): 1) fwconsole ma install pm2 2) fwconsole ma enable pm2


reload [--json] [--dry-run] [--skip-registry-checks] [--dont-reload-asterisk]

maybe I made a mistake during the installation ?

becaue I run some command not from root

will it save time if I will start a new clean ubuntu
then I will enter root mode at start (‘sudo su -’)
then run all this commands:

will this help?
Thansk ,

Try

sudo fwconsole ma downloadinstall pm2
sudo fwconsole reload
sudo fwconsole ma downloadinstall pm2
No repos specified, using: [standard] from last GUI settings

Downloading module 'pm2'
Processing pm2
Downloading...
 29043/29043 [============================] 100%
Finished downloading
Extracting...Done
Download completed in 2 seconds
sh: 1: npm: not found
Node Package Manager is not installed
Unable to install module pm2:
 - Failed to run installation scripts
Updating Hooks...Done
Chowning directories...Done

Install it

sudo apt install npm
sudo fwconsole ma downloadinstall pm2
sudo fwconsole reload
[npm-cache] [INFO] [npm] installed and archived dependencies
[npm-cache] [INFO] successfully installed all dependencies

Finished updating libraries!
Generating CSS...Done
Module pm2 version 15.0.10 successfully installed
Updating Hooks...Done
Chowning directories...Done
[email protected]:~# sudo fwconsole reload
Reload Started
Starting Call Transfer Monitoring Service
Stopping Call Transfer Monitoring Service
Restarting Call Transfer Monitoring Service
Reload Complete

now what do you want me to do?
reboot?

What issues do you still have? It looks like it reloaded successfully.

nothing in the webpage
I have reboot

asterisk is running

systemctl status asterisk.service
● asterisk.service - LSB: Asterisk PBX
     Loaded: loaded (/etc/init.d/asterisk; generated)
     Active: active (running) since Wed 2022-07-27 09:01:40 UTC; 1min 43s ago
       Docs: man:systemd-sysv-generator(8)
      Tasks: 76 (limit: 19151)
     Memory: 126.4M
     CGroup: /system.slice/asterisk.service
             └─1016 /usr/sbin/asterisk -U asterisk -G asterisk

Jul 27 09:01:39 asterisk-freepbx-ubuntu20-01 systemd[1]: Starting LSB: Asterisk PBX...
Jul 27 09:01:40 asterisk-freepbx-ubuntu20-01 asterisk[985]:  * Starting Asterisk PBX: asterisk
Jul 27 09:01:40 asterisk-freepbx-ubuntu20-01 asterisk[985]:    ...done.
Jul 27 09:01:40 asterisk-freepbx-ubuntu20-01 systemd[1]: Started LSB: Asterisk PBX.

FreePBX is not running - I have manually run it

fwconsole reload
PHP Warning:  include_once(/etc/freepbx.conf): failed to open stream: Permission denied in /var/lib/asterisk/bin/fwconsole on line 12
PHP Warning:  include_once(): Failed opening '/etc/freepbx.conf' for inclusion (include_path='.:/usr/share/php') in /var/lib/asterisk/bin/fwconsole on line 12
PHP Fatal error:  Class 'Symfony\Component\Console\Application' not found in /var/www/html/admin/libraries/FWApplication.class.php on line 11
[email protected]:~$ sudo fwconsole reload
Reload Started
Starting Call Transfer Monitoring Service
Stopping Call Transfer Monitoring Service
Restarting Call Transfer Monitoring Service
Reload Complete
[email protected]:~$ sudo fwconsole start
Asterisk already running
Running FreePBX startup...
Taking too long? Customize the chown command, See http://wiki.freepbx.org/display/FOP/FreePBX+Chown+Conf
Setting Permissions...
Setting base permissions...Done in 0 seconds
Setting specific permissions...
 39599 [============================]
Finished setting permissions
Unable to run Pre-Asterisk hooks, because Asterisk is already running on PID 1016 and has been running for 2 minutes, 21 seconds
Running Asterisk post from Core module
Starting Call Transfer Monitoring Service
Stopping Call Transfer Monitoring Service
Restarting Call Transfer Monitoring Service
Core FastAGI Server has already been running on PID 3438 for 16 seconds

but still nothing in the web page

I thought maybe the firewall is blocking but it’s disable

sudo ufw status
Status: inactive

I can see the apache2 is running

sudo systemctl status apache2
● apache2.service - The Apache HTTP Server
     Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
     Active: active (running) since Wed 2022-07-27 09:06:29 UTC; 16s ago
       Docs: https://httpd.apache.org/docs/2.4/
    Process: 4031 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
   Main PID: 4035 (apache2)
      Tasks: 6 (limit: 19151)
     Memory: 12.6M
     CGroup: /system.slice/apache2.service
             ├─4035 /usr/sbin/apache2 -k start
             ├─4036 /usr/sbin/apache2 -k start
             ├─4037 /usr/sbin/apache2 -k start
             ├─4038 /usr/sbin/apache2 -k start
             ├─4039 /usr/sbin/apache2 -k start
             └─4040 /usr/sbin/apache2 -k start

in the cloud firewlall all the ports are opening
but I can see I can’t reach to port 80 - something is blocking

maybe now this is the problem ?


I have added simple html to /var/www/html$ nano test.html

from the server I can reach it
but from other computers in the same netwrok I don’t have access

so maybe there is another FW in the ubuntu that is blocking?

[ I think I posted this on the wrong topic. ]

I have found 1 main the problem
iptables!!!

I did this

sudo iptables -P INPUT ACCEPT
sudo iptables -P OUTPUT ACCEPT
sudo iptables -P FORWARD ACCEPT
sudo iptables -F

and everything start to work …

I do have 2 other problems now

  1. after reboot I need to change the iptables and also run manually “fwconsole”
    I guess I can make a script that will run it on boot - but is there an way to fix it ?

  2. I mange to create 2 extensions , connect to them from my phone(Android) and my Windows PC
    but when I try to make a call it doesn’t work , in the logs I see this:

[2022-07-27 12:21:03] WARNING[4977][C-00000001] pbx.c: No application 'Macro' for extension (from-internal, 0002, 3)	
1779	[2022-07-27 12:21:03] WARNING[4977][C-00000001] pbx.c: No application 'Macro' for extension (from-internal, h, 1)	
1780	[2022-07-27 12:22:08] WARNING[5021][C-00000002] pbx.c: No application 'Macro' for extension (from-internal, 0001, 3)	
1781	[2022-07-27 12:22:08] WARNING[5021][C-00000002] pbx.c: No application 'Macro' for extension (from-internal, h, 1)
 what do I need in order to install the 'Macro' App?

Thanks,

Make sure that it is enabled when you run make menuconfig,

Make sure you remove any noload directive, for it, in modules.conf.

app_macro is deprecated in Asterisk and is not loaded (possibly also not built) in default installations of supported versions of Asterisk. FreePBX is critically dependent on it.

As of Asterisk 16 the app_macro module has not been built by default.

so I need to redo to the installtion ?
or just run make menuconfig ,then make install
ad this is all ?

maybe I’m missing something in the understanding
all I want\need is to be able to make calles using my VPN netwrok
I have setup the extension as
chan_pjsip
mayeb I need to setup then as something else? and then it will work ?
does it metter how to I setup them ?

Thanks,

You need to run everything from make menuconfig through make install, and may also need to edit /etc/asterisk/modules.conf.

make menuconfig sets up files which describe the options to use.

make actually compiles everything.

make install installs the binaries created by make.

You’ll probably get away without the following steps, as I don’t think what is left over will have been invalidated.

If you do run make samples, you may have to repeat all the following steps that update the config files, although it looks like overriding OVERWRITE to no will stop this. (I’m using a combination of experience of an older version of the build system and looking at the Makefile here, so I’m not 100% sure that make samples will overwrite the installed configuration.)