ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    My trials of installing FreePBX

    IT Discussion
    linux freepbx cloudatcost asterisk centos 6
    6
    57
    21.2k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • scottalanmillerS
      scottalanmiller
      last edited by

      Use netstat -tulpn to see what is listening.

      1 Reply Last reply Reply Quote 0
      • DashrenderD
        Dashrender
        last edited by Dashrender

        [root@c1115759-27921 ~]# netstat -tulpn
        Active Internet connections (only servers)
        Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
        tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1418/sshd
        tcp 0 0 0.0.0.0:8088 0.0.0.0:* LISTEN 2548/asterisk
        tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1683/sendmail
        tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 1564/mysqld
        tcp 0 0 0.0.0.0:5038 0.0.0.0:* LISTEN 2548/asterisk
        tcp 0 0 :::22 :::* LISTEN 1418/sshd
        tcp 0 0 :::80 :::* LISTEN 1733/httpd
        udp 0 0 0.0.0.0:5060 0.0.0.0:* 2548/asterisk
        udp 0 0 0.0.0.0:5061 0.0.0.0:* 2548/asterisk
        udp 0 0 0.0.0.0:4569 0.0.0.0:* 2548/asterisk
        udp 0 0 0.0.0.0:51326 0.0.0.0:* 2548/asterisk

        My iptables

        *filter
        :INPUT ACCEPT [0:0]
        :FORWARD ACCEPT [0:0]
        :OUTPUT ACCEPT [0:0]
        -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
        -A INPUT -m state --state NEW -p tcp --dport 80 -j ACCEPT
        -A INPUT -m state --state NEW -p tcp --dport 443 -j ACCEPT
        -A INPUT -p udp -m udp --dport 5060 -j ACCEPT
        -A INPUT -p udp -m udp --dport 4569 -j ACCEPT
        -A INPUT -p udp -m udp --dport 5036 -j ACCEPT
        -A INPUT -p udp -m udp --dport 10000:20000 -j ACCEPT
        -A INPUT -p icmp -j ACCEPT
        -A INPUT -i lo -j ACCEPT
        -A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
        -A INPUT -j REJECT --reject-with icmp-host-prohibited
        -A FORWARD -j REJECT --reject-with icmp-host-prohibited
        COMMIT

        1 Reply Last reply Reply Quote 0
        • DashrenderD
          Dashrender
          last edited by Dashrender

          Not having any luck getting my extensions to connect I've decided to start over and document even better this time.

          Again starting with a C@C Dev3 CentOS 6.5 box.

          Following http://wiki.freepbx.org/display/HTGS/Installing+FreePBX+12+on+CentOS+6.5

          Time to disable selinux
          sed -i 's/(^SELINUX=)./\SELINUX=disabled/' /etc/sysconfig/selinux*

          reboot and check status with sestatus which shows

          SELinux status:                 enabled
          SELinuxfs mount:                /selinux
          Current mode:                   enforcing
          Mode from config file:          enforcing
          Policy version:                 24
          Policy from config file:        targeted
          

          Uh - Houston, we have a problem. Let's look at /etc/sysconfig/selinux

          # This file controls the state of SELinux on the system.
          # SELINUX= can take one of these three values:
          #     enforcing - SELinux security policy is enforced.
          #     permissive - SELinux prints warnings instead of enforcing.
          #     disabled - No SELinux policy is loaded.
          SELINUX=disabled
          # SELINUXTYPE= can take one of these two values:
          #     targeted - Targeted processes are protected,
          #     mls - Multi Level Security protection.
          SELINUXTYPE=targeted </code></pre>
          

          OK this matches the instructions, but isn't working. Google tells me that I need to change a different file to disable selinux. http://www.shayanderson.com/linux/disable-selinux-on-centos-6.htm

          This page tells me I need to change SELINUX=disabled in /etc/selinux/config
          They also mention using getenforce as well as sestatus to check the status of selinux.

          Success! Upon rebooting after changing /etc/selinux/config I see

          SELinux status:                 disabled
          

          Time to update the system

          yum -y update
          yum groupinstall core
          yum groupinstall base
          

          I'll be back in an hour or so after this is done.

          1 Reply Last reply Reply Quote 0
          • DashrenderD
            Dashrender
            last edited by Dashrender

            Interrupted by the day job.

            OK updates installed.. now to install some additional packages.

            yum install gcc gcc-c++ lynx bison mysql-devel mysql-server php php-mysql php-pear php-mbstring tftp-server httpd make ncurses-devel libtermcap-devel sendmail sendmail-cf caching-nameserver sox newt-devel libxml2-devel libtiff-devel audiofile-devel gtk2-devel subversion kernel-devel git subversion kernel-devel php-process crontabs cronie cronie-anacron wget vim php-xml uuid-devel libtool sqlite-devel
            
            1 Reply Last reply Reply Quote 0
            • scottalanmillerS
              scottalanmiller
              last edited by

              Why are you installing a compiler? What are you going to compile?

              1 Reply Last reply Reply Quote 1
              • DashrenderD
                Dashrender
                last edited by

                Because the instructions tell me to...

                There are several make commands in these setup instructions... is that compiling?

                scottalanmillerS 1 Reply Last reply Reply Quote 0
                • DashrenderD
                  Dashrender
                  last edited by

                  Check the status of iptables and disable them for now to make setup easier. (not my idea, the instructions idea).

                  chkconfig iptables --list
                  iptables 0:off 1:off 2:off 3:off 4:off 5:off 6:off

                  It was already off (seems odd, but must be the default for C@C)

                  SQL setup time

                  chkconfig --level 345 mysqld on
                  service mysqld start
                  

                  Output

                  Initializing MySQL database:  WARNING: The host 'c1107372-7807.cloudatcost.com' could not be looked up with resolveip.
                  This probably means that your libc libraries are not 100 % compatible
                  with this binary MySQL version. The MySQL daemon, mysqld, should work
                  normally with the exception that host name resolving will not work.
                  This means that you should use IP addresses instead of hostnames
                  when specifying MySQL privileges !
                  Installing MySQL system tables...
                  OK
                  Filling help tables...
                  OK
                  
                  To start mysqld at boot time you have to copy
                  support-files/mysql.server to the right place for your system
                  
                  PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
                  To do so, start the server, then issue the following commands:
                  
                  /usr/bin/mysqladmin -u root password 'new-password'
                  /usr/bin/mysqladmin -u root -h c1107372-7807.cloudatcost.com password 'new-password'
                  
                  Alternatively you can run:
                  /usr/bin/mysql_secure_installation
                  
                  which will also give you the option of removing the test
                  databases and anonymous user created by default.  This is
                  strongly recommended for production servers.
                  
                  See the manual for more instructions.
                  
                  You can start the MySQL daemon with:
                  cd /usr ; /usr/bin/mysqld_safe &
                  
                  You can test the MySQL daemon with mysql-test-run.pl
                  cd /usr/mysql-test ; perl mysql-test-run.pl
                  
                  Please report any problems with the /usr/bin/mysqlbug script!
                  
                                                                             [  OK  ]
                  Starting mysqld:                                           [  OK  ]
                  
                  1 Reply Last reply Reply Quote 0
                  • scottalanmillerS
                    scottalanmiller @Dashrender
                    last edited by

                    @Dashrender said:

                    Because the instructions tell me to...

                    There are several make commands in these setup instructions... is that compiling?

                    Make is used for a lot of things. But presumably. This seems fishy, though.

                    1 Reply Last reply Reply Quote 0
                    • DashrenderD
                      Dashrender
                      last edited by Dashrender

                      Onto Apache

                      chkconfig --level 345 httpd on
                      

                      Output

                      Starting httpd: httpd: apr_sockaddr_info_get() failed for c1107372-7807.cloudatcost.com
                      httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
                                                                                 [  OK  ]
                      

                      Now for PearDB

                      pear channel-update pear.php.net
                      pear install db-1.7.14
                      

                      You may receive a warning:
                      WARNING: "pear/DB" is deprecated in favor of "pear/MDB2"

                      Output

                      [root@c1107372-7807 ~]# pear channel-update pear.php.net
                      Updating channel "pear.php.net"
                      Update of Channel "pear.php.net" succeeded
                      [root@c1107372-7807 ~]# pear install db-1.7.14
                      WARNING: "pear/DB" is deprecated in favor of "pear/MDB2"
                      downloading DB-1.7.14.tgz ...
                      Starting to download DB-1.7.14.tgz (133,103 bytes)
                      .............................done: 133,103 bytes
                      install ok: channel://pear.php.net/DB-1.7.14
                      

                      I did receive the notice about pear being deprecated - shouldn't these instructions be updated to use the current software?

                      And now a reboot.

                      1 Reply Last reply Reply Quote 0
                      • scottalanmillerS
                        scottalanmiller
                        last edited by

                        The package would need to be updated, not just the instructions.

                        1 Reply Last reply Reply Quote 0
                        • DashrenderD
                          Dashrender
                          last edited by

                          I'm skipping the Google voice stuff - I have an old account, but I don't recall the credentials.

                          add Asterisk user

                          adduser asterisk -M -c "Asterisk User"
                          

                          Download Asterisk

                          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-13-current.tar.gz
                          git clone https://github.com/akheron/jansson.git
                          wget http://www.pjsip.org/release/2.2.1/pjproject-2.2.1.tar.bz2
                          

                          No problems there

                          Compile and install DAHDI and LibPRI

                          cd /usr/src
                          tar xvfz dahdi-linux-complete-current.tar.gz
                          tar xvfz libpri-1.4-current.tar.gz
                          rm -f dahdi-linux-complete-current.tar.gz libpri-1.4-current.tar.gz
                          cd dahdi-linux-complete-*
                          make all
                          make install
                          make config
                          cd /usr/src/libpri-1.4.*
                          make
                          make install
                          
                          1 Reply Last reply Reply Quote 0
                          • DashrenderD
                            Dashrender
                            last edited by Dashrender

                            Compile and install pjproject

                            cd /usr/src
                            tar -xjvf pjproject-2.2.1.tar.bz2
                            cd pjproject-2.2.1
                            CFLAGS='-DPJ_HAS_IPV6=1' ./configure --prefix=/usr --enable-shared --disable-sound\
                              --disable-resample --disable-video --disable-opencore-amr --libdir=/usr/lib64
                            make dep
                            make
                            make install
                            

                            Compile and install jansson

                            cd /usr/src/jansson
                            autoreconf -i
                            ./configure --libdir=/usr/lib64
                            make
                            make install
                            
                            1 Reply Last reply Reply Quote 0
                            • DashrenderD
                              Dashrender
                              last edited by

                              Compile and install Asterisk

                              cd /usr/src
                              tar xvfz asterisk-13-current.tar.gz
                              rm -f asterisk-13-current.tar.gz
                              cd asterisk-*
                              contrib/scripts/install_prereq install
                              ./configure --libdir=/usr/lib64
                              contrib/scripts/get_mp3_source.sh
                              make menuselect
                              

                              Now presented with what options I want to install - per the instruction the only thing I add is Format MP3

                              screen.JPG
                              Click Save and Exit and continue with Asterisk install

                              make
                              make install
                              make config
                              ldconfig
                              
                              1 Reply Last reply Reply Quote 0
                              • DashrenderD
                                Dashrender
                                last edited by

                                Took a while but Asterisk is installed.

                                Installing Asterisk extra sounds

                                mkdir -p /var/lib/asterisk/sounds
                                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
                                
                                1 Reply Last reply Reply Quote 0
                                • DashrenderD
                                  Dashrender
                                  last edited by Dashrender

                                  Here the second omission in the instructions. They don't tell you to change the directory before downloading FreePBX. I will include it here.

                                  cd /usr/src
                                  wget http://mirror.freepbx.org/freepbx-12.0.3.tgz
                                  tar vxfz freepbx-12.0.3.tgz
                                  

                                  Change some permissions

                                  chown asterisk. /var/run/asterisk
                                  chown -R asterisk. /etc/asterisk
                                  chown -R asterisk. /var/{lib,log,spool}/asterisk
                                  chown -R asterisk. /usr/lib/asterisk
                                  chown -R asterisk. /usr/lib64/asterisk
                                  mkdir /var/www/html
                                  chown -R asterisk. /var/www/
                                  

                                  Output

                                  # chown asterisk. /var/run/asterisk
                                  # chown -R asterisk. /etc/asterisk
                                  # chown -R asterisk. /var/{lib,log,spool}/asterisk
                                  chown -R asterisk. /usr/lib/asterisk
                                  chown -R asterisk. /usr/lib64/asterisk
                                  mkdir /var/www/html
                                  # chown -R asterisk. /usr/lib/asterisk
                                  chown: cannot access `/usr/lib/asterisk': No such file or directory
                                  # chown -R asterisk. /usr/lib64/asterisk
                                  # mkdir /var/www/html
                                  mkdir: cannot create directory `/var/www/html': File exists
                                  # chown -R asterisk. /var/www/
                                  

                                  Odd that there is no /usr/lib/asterisk - so I'll just make a mental note
                                  the /var/www/html directory already exists - so no big deal

                                  1 Reply Last reply Reply Quote 0
                                  • DashrenderD
                                    Dashrender
                                    last edited by Dashrender

                                    A few mods to Apache

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

                                    Output
                                    Stopping httpd: [ OK ]
                                    Starting httpd: httpd: apr_sockaddr_info_get() failed for c1115759-27921.cloudatcost.com
                                    httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
                                    [ OK ]

                                    I'm going to have to fix apache so it knows it's FQDN

                                    1 Reply Last reply Reply Quote 0
                                    • DashrenderD
                                      Dashrender
                                      last edited by Dashrender

                                      Configure Asterisk database in MYSQL

                                      cd /usr/src/freepbx
                                      export ASTERISK_DB_PW=amp109
                                      mysqladmin -u root create asterisk 
                                      mysqladmin -u root create asteriskcdrdb
                                      

                                      And set permissions on dbs

                                      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;"
                                      

                                      Start Asterisk and install FreePBX

                                      cd /usr/src/freepbx
                                      ./start_asterisk start
                                      ./install_amp --installdb --username=asteriskuser --password=${ASTERISK_DB_PW}
                                      

                                      Output

                                      Checking for PEAR DB..OK
                                      Checking for PEAR Console::Getopt..OK
                                      Using username: asteriskuser
                                      Using password: ******
                                      Checking user..OK
                                      Checking if Asterisk is running..running with PID: 11666..OK
                                      Checking for /etc/amportal.conf../etc/amportal.conf does not exist, copying default
                                      Creating new /etc/amportal.conf
                                      Enter your USERNAME to connect to the 'asterisk' database:
                                       [asteriskuser]
                                      Enter your PASSWORD to connect to the 'asterisk' database:
                                       [amp109]
                                      Enter the hostname of the 'asterisk' database:
                                       [localhost]
                                      Enter a USERNAME to connect to the Asterisk Manager interface:
                                       [admin]
                                      Enter a PASSWORD to connect to the Asterisk Manager interface:
                                       [amp111]
                                      Enter the path to use for your AMP web root:
                                       [/var/www/html]
                                      
                                      PHP Warning:  mkdir(): File exists in /usr/src/freepbx/libfreepbx.install.php on line 197
                                      [FATAL] Cannot create /var/www/html!
                                      

                                      Pressing on (the following commands failed because FreePBX didn't do something right (only error noted above - according the instructions on FreePBX.org you can simply re run the install -
                                      ./install_amp --installdb --username=asteriskuser --password=${ASTERISK_DB_PW})

                                      amportal chown
                                      amportal a ma installall
                                      amportal a reload
                                      amportal a ma refreshsignatures
                                      amportal chown
                                      

                                      And now the system doesn't know amportal command

                                      OK I ran the ./install_amp command again and now amportal commands are working.

                                      Another mod for FreePBX, then we can start it

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

                                      Add the Commercial Modules repos

                                      cd /usr/src
                                      wget -P /etc/yum.repos.d/ -N http://yum.schmoozecom.net/schmooze-commercial/schmooze-commercial.repo
                                      yum clean all
                                      yum -y install php-5.3-zend-guard-loader sysadmin fail2ban incron ImageMagick
                                      service httpd restart
                                      amportal a ma download sysadmin
                                      amportal a ma install sysadmin
                                      
                                      1 Reply Last reply Reply Quote 0
                                      • DashrenderD
                                        Dashrender
                                        last edited by

                                        And now launching the web portal for the first time.

                                        FPBX-first-screen.JPG

                                        1 Reply Last reply Reply Quote 0
                                        • DashrenderD
                                          Dashrender
                                          last edited by Dashrender

                                          As you can see the system isn't setup to listen to FreePBX's .htaccess files so we have to enable the override to allow these to work.

                                          vi /etc/httpd/conf/httpd.conf
                                          

                                          find the line <Directory "/var/www/html"> then local AllowOverride about 14 lines down.
                                          Change AllowOverride = None to AllowOverride = All

                                          Save and quit. now reload httpd

                                          service httpd restart
                                          
                                          1 Reply Last reply Reply Quote 0
                                          • DashrenderD
                                            Dashrender
                                            last edited by

                                            Awesome - that worked.

                                            Nice clean console now..

                                            FPBX-second-screen.JPG

                                            1 Reply Last reply Reply Quote 0
                                            • 1
                                            • 2
                                            • 3
                                            • 1 / 3
                                            • First post
                                              Last post