Run the following set of commands to install Asterisk and FreePBX from source fast and efficient. 100% tested. The installation assumes you will be using a now-standard SIP trunk, considering the decease of ISDN, so will not go into details of configuring either DAHDI or other types of trunks.

setenforce=0
sed -i 's/enforcing/permissive/g' /etc/selinux/config
Disable application of SELinux policy, run-time and permanent
yum install -y epel-release dmidecode gcc-c++ ncurses-devel libxml2-devel make wget openssl-devel newt-devel kernel-devel sqlite-devel libuuid-devel gtk2-devel jansson-devel binutils-devel git lynx tftp-server unixODBC mysql-connector-odbc mariadb-server mariadb httpd ncurses-devel sendmail sendmail-cf sox newt-devel libxml2-devel libtiff-devel audiofile-devel gtk2-devel subversion kernel-devel git crontabs cronie cronie-anacron wget vim uuid-devel sqlite-devel net-tools gnutls-devel python-devel texinfo libuuid-devel
Install the necessary packages to prepare compilation of Asterisk and FreePBX

3. Get source code of Asterisk:

cd /usr/src
git clone -b 16 http://gerrit.asterisk.org/asterisk asterisk-16
Clone a necessary Asterisk branch for compilation, in this case branch 16
/usr/src/asterisk-16/contrib/scripts/install_prereq
cd /usr/src/asterisk-16
./configure --libdir=/usr/lib64 --with-jansson-bundled
make menuselect
Proceed to installing prerequisites, configuration of the installation

It is very important to enable a deprecated Asterisk app_macro in menuselect, a menu that you will see after make menuselect, if you are planning to use FreePBX. Here is a screenshot:

make && make install
make samples
chown asterisk. /var/run/asterisk
chown asterisk. -R /etc/asterisk
chown asterisk. -R /var/{lib,log,spool}/asterisk
chown asterisk. -R /var/www/
systemctl enable asterisk
Compile Asterisk, install it, make sample configuration files for the initial startup, adjust ownership enable autostart

Now we are ready to proceed to FreePBX installation

rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
Install PHP 5.6 repositories
yum remove php*
yum install php56w php56w-pdo php56w-mysql php56w-mbstring php56w-pear php56w-process php56w-xml php56w-opcache php56w-ldap php56w-intl php56w-soap
Install PHP 5.6w
curl -sL https://rpm.nodesource.com/setup_8.x | bash -yum install -y nodejs
Install NodeJS
systemctl enable mariadb.service
systemctl start mariadb
mysql_secure_installation
Enable MariaDB

When asked for a root password, just press Enter.

systemctl enable httpd.service
systemctl start httpd.service
Enable and start Apache
pear install Console_Getopt
Install PEAR requirements

Tweak Apache configuration:

sed -i 's/\(^upload_max_filesize = \).*/\120M/' /etc/php.inised -i 's/^\(User\|Group\).*/\1 asterisk/' /etc/httpd/conf/httpd.conf
sed -i 's/AllowOverride None/AllowOverride All/' /etc/httpd/conf/httpd.conf
systemctl restart httpd.service
Adjusting settings for FreePBX
cd /usr/src
wget http://mirror.freepbx.org/modules/packages/freepbx/freepbx-14.0-latest.tgz
tar xvfz freepbx-14.0-latest.tgz
rm -f freepbx-14.0-latest.tgz
cd freepbx
./start_asterisk start
./install -n
Download and install FreePBX

Now take a note of admin credentials you get from FreePBX and start configuring your newly set up system.