Centos7.xInstallandSetupAsterisk13(PBX)

本文发布时间: 2019-Mar-22
Asterisk (PBX) is an open source communication server released under the GPL license maintained by Gigium and Asterisk community. Asterisk is used for creating communication applications that turns an ordinary computer into a communication server. So, using the Asterisk in your network environment, you can connect your employees from home to the office PBX over broadband connections and can also give them voicemail, integrated with Web and E-mail.The benefits of using Asterisk are too much, so let’s follow this tutorial to setup your own Asterisk server whether in your home, office or in your organization and enjoy with its great features to fill communication gaps.Asterisk PrerequisitesAs we will be using CentOS 7 for Asterisk setup with minimal installed packages, so make sure that your system is up to data and you have root user privileges on the system for the installation of different required packages.1) System UpdateYou can use below command for system update after successful root login.#yum update2) Installing Required PackagesOnce your system is patched with latest updates, you have to install some packages including development tools and other packages that are necessary for its successful operation. You can easily do this by using the below command that will install its all required packages included all dependencies.[root@centos-7 ~]# yum install gcc gcc-c++ php-xml php php-mysql php-pear php-mbstring mariadb-devel mariadb-server mariadb sqlite-devel lynx bison gmime-devel psmisc tftp-server httpd make ncurses-devel libtermcap-devel sendmail sendmail-cf caching-nameserver sox newt-devel libxml2-devel libtiff-devel audiofile-devel gtk2-devel uuid-devel libtool libuuid-devel subversion kernel-devel kernel-devel-$(uname -r) git subversion kernel-devel php-process crontabs cronie cronie-anacron wget vimCheck the list of packages that are going to be installed on your system and press “Y” to continue, this will take about 125MB of your disk space.After successful operation you will see the list of installed packages and updates including all its required dependencies.3) Setup MariaDBAfter installation by default we can connect to the database without using any password. So, first we will enable/start mariadb services as shown in below image, so that we can setup its root password.Once the MariaDB services are fine , run the below command to setup its root password and remove anonymous user, test database and disallow remote user login.[root@centos-7 ~]# mysql_secure_installation4) Installing libjanssonJansson is a C library for encoding, decoding and manipulating JSON data. Let's download, unpack and compile it using the below command.# wget http://www.digip.org/jansson/releases/jansson-2.7.tar.gzTo extract this package use below command.# tar -zxvf jansson-2.7.tar.gzThen change directory and configure the package as shown.5) Make JanssonNow to compile the configured package we are required to use below 'make' and 'make install' command within the same directory to compile fully functional Jansson library.[root@centos-7 Jansson-2.7]#make clean[root@centos-7 Jansson-2.7]#make && make install[root@centos-7 Jansson-2.7]#ldconfigInstalling Asterisk 13.5.0Here we go with most important download that is Asterisk. Let's download its current latest package from their official web link Asterisk Download Page. We will be using 'wget' command to download its package, so change your current directory and run the command as shown below.Using below commands unpack its package, change directory and then run its configuration command .[root@centos-7 ~]# tar -zxvf asterisk-13.5.0.tar.gz[root@centos-7 ~]# cd asterisk-13.5.0[root@centos-7 asterisk-13.5.0]# ./configure --libdir=/usr/lib64Upon successful completion of asterisk installation you will find its logo as shown below.Asterisk Modules SetupNow in the next few steps we will configure Asterisk for its necessary modules.1) Asterisk Main menu SelectionIn order to setup your menu items, let's run the below command and then choose the appropriate options.[root@centos-7 asterisk-13.5.0]# make menuselectOnce you run this command, a new window will be opened where you can will see that for the most part , all the necessary modules are already included . You can add something or remove, when you select a module there is a brief description of its purpose. In the Add-ons to enable mp3 support module select 'format_mp3' as shown below.Then move to the next Core Sound Packages and select the formats of Audio packets as shown in the image.Then select all the packages from the "Music On Hold Packages" and then form the "Extra Sound Packages choose the 4 that includes a first module containing EN and the choose the "Save and Exit" button to proceed for the next step.2) Loading mp3 LibrariesNow run the following command to download the mp3 decoder library into the source tree.[root@centos-7 asterisk-13.5.0]# contrib/scripts/get_mp3_source.sh3) Modules InstallationNow we will proceed with installation of selected modules using the 'make command'.So, Asterisk has been successfully built, now run the command as shown in the image to install asterisk.[root@centos-7 asterisk-13.5.0]# make installIn response to the above command you will be greeted with below put at the end of nstallation.+---- Asterisk Installation Complete -------++ ++ YOU MUST READ THE SECURITY DOCUMENT ++ ++ Asterisk has successfully been installed. ++ If you would like to install the sample ++ configuration files (overwriting any ++ existing config files), run: ++ ++ make samples ++ ++----------------- or ---------------------++ ++ You can go ahead and install the asterisk ++ program documentation now or later run: ++ ++ make progdocs ++ ++ **Note** This requires that you have ++ doxygen installed on your local system ++-------------------------------------------+Here we will run the below commands to install sample configuration files as indicated above.[root@centos-7 asterisk-13.5.0]# make samples[root@centos-7 asterisk-13.5.0]# make configSetup Asterisk UserYou can create a separate user and give him the right to work with Asterisk in order to start its services with its own user and group. To do so let's run the below command.[root@centos-7 asterisk-13.5.0]# useradd -m asterisk[root@centos-7 asterisk-13.5.0]# chown asterisk.asterisk /var/run/asterisk[root@centos-7 asterisk-13.5.0]# chown -R asterisk.asterisk /etc/asterisk[root@centos-7 asterisk-13.5.0]# chown -R asterisk.asterisk /var/{lib,log,spool}/asterisk[root@centos-7 asterisk-13.5.0]# chown -R asterisk.asterisk /usr/lib64/asterisk[root@centos-7 asterisk-13.5.0]# systemctl restart asterisk[root@centos-7 asterisk-13.5.0]# systemctl status asteriskSetup Firewall RulesNow begin to set up security. By default on CentOS 7 instead of iptables uses the FirewallD.Using below two command you can start and enable the firewalld services.[root@centos-7 ~]# systemctl start firewalld[root@centos-7 ~]# systemctl enable firewalldNow allow access to the ports that are being used in asterisk PBX by adding the following rules[root@centos-7 ~]# firewall-cmd --zone=public --add-port=5060/udp --permanentsuccess[root@centos-7 ~]# firewall-cmd --zone=public --add-port=5060/tcp --permanentsuccess[root@centos-7 ~]# firewall-cmd --zone=public --add-port=5061/udp --permanentsuccess[root@centos-7 ~]# firewall-cmd --zone=public --add-port=5061/tcp --permanentsuccess[root@centos-7 ~]# firewall-cmd --zone=public --add-port=4569/udp --permanentsuccess[root@centos-7 ~]# firewall-cmd --zone=public --add-port=5038/tcp --permanentsuccess[root@centos-7 ~]# firewall-cmd --zone=public --add-port=10000-20000/udp --permanentsuccessTo load new firewall rules, use the below command.[root@centos-7 ~]# firewall-cmd --reloadTo confirm that all rules had been added , you can by using the command as shown in the image.Setup Asterisk DatabaseLet's connect to the MySQL MariaDB and create new user and database then provide it all privileges using the following commands.[root@centos-7 ~]# mysql -u root -pEnter password:******Welcome to the MariaDB monitor. Commands end with ; or g.Your MariaDB connection id is 11Server version: 5.5.44-MariaDB MariaDB ServerCopyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.MariaDB [(none)]> create user 'asterisk'@'localhost' identified by '******';MariaDB [(none)]> create database asterisk;MariaDB [(none)]> create database cdrdb;MariaDB [(none)]> GRANT ALL PRIVILEGES ON asterisk.* TO asterisk@localhost IDENTIFIED BY '******';MariaDB [(none)]> GRANT ALL PRIVILEGES ON cdrdb.* TO asterisk@localhost IDENTIFIED BY '******';MariaDB [(none)]> flush privileges;MariaDB [(none)]>Launching AsteriskLaunch Asterisk for the first time after its setup on Centos 7 using below command.[root@centos-7 ~]# asterisk -rConclusionAsterisk 13.5.0 (PBX) has been successfully installed on CentOS 7 with its required modules. If you find any mistakes in the article or inconsistencies we would be grateful if you write to us about it in the comments.


(以上内容不代表本站观点。)
---------------------------------
本网站以及域名有仲裁协议。
本網站以及域名有仲裁協議。

2024-Mar-04 02:08pm
栏目列表