Centos 7.x Install and Setup Asterisk 13 (PBX)

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 Prerequisites

As 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 Update

You can use below command for system update after successful root login.

#yum update

2) Installing Required Packages

Once 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.

[[email protected] ~]# 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 vim

Check 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 MariaDB

After 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.

[[email protected] ~]# mysql_secure_installation

4) Installing libjansson

Jansson 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.gz

To extract this package use below command.

# tar -zxvf jansson-2.7.tar.gz

Then change directory and configure the package as shown.

5) Make Jansson

Now 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.

[[email protected] Jansson-2.7]#make clean

[[email protected] Jansson-2.7]#make && make install

[[email protected] Jansson-2.7]#ldconfig

Installing Asterisk 13.5.0

Here 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 .

[[email protected] ~]# tar -zxvf asterisk-13.5.0.tar.gz

[[email protected] ~]# cd asterisk-13.5.0

[[email protected] asterisk-13.5.0]# ./configure --libdir=/usr/lib64

Upon successful completion of asterisk installation you will find its logo as shown below.

Asterisk Modules Setup

Now in the next few steps we will configure Asterisk for its necessary modules.

1) Asterisk Main menu Selection

In order to setup your menu items, let‘s run the below command and then choose the appropriate options.

[[email protected] asterisk-13.5.0]# make menuselect

Once 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 Libraries

Now run the following command to download the mp3 decoder library into the source tree.

[[email protected] asterisk-13.5.0]# contrib/scripts/get_mp3_source.sh

3) Modules Installation

Now 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.

[[email protected] asterisk-13.5.0]# make install

In 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.

[[email protected] asterisk-13.5.0]# make samples

[[email protected] asterisk-13.5.0]# make config

Setup Asterisk User

You 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.

[[email protected] asterisk-13.5.0]# useradd -m asterisk

[[email protected] asterisk-13.5.0]# chown asterisk.asterisk /var/run/asterisk

[[email protected] asterisk-13.5.0]# chown -R asterisk.asterisk /etc/asterisk

[[email protected] asterisk-13.5.0]# chown -R asterisk.asterisk /var/{lib,log,spool}/asterisk

[[email protected] asterisk-13.5.0]# chown -R asterisk.asterisk /usr/lib64/asterisk

[[email protected] asterisk-13.5.0]# systemctl restart asterisk

[[email protected] asterisk-13.5.0]# systemctl status asterisk

Setup Firewall Rules

Now 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.

[[email protected] ~]# systemctl start firewalld

[[email protected] ~]# systemctl enable firewalld

Now allow access to the ports that are being used in asterisk PBX by adding the following rules

[[email protected] ~]# firewall-cmd --zone=public --add-port=5060/udp --permanent

success

[[email protected] ~]# firewall-cmd --zone=public --add-port=5060/tcp --permanent

success

[[email protected] ~]# firewall-cmd --zone=public --add-port=5061/udp --permanent

success

[[email protected] ~]# firewall-cmd --zone=public --add-port=5061/tcp --permanent

success

[[email protected] ~]# firewall-cmd --zone=public --add-port=4569/udp --permanent

success

[[email protected] ~]# firewall-cmd --zone=public --add-port=5038/tcp --permanent

success

[[email protected] ~]# firewall-cmd --zone=public --add-port=10000-20000/udp --permanent

success

To load new firewall rules, use the below command.

[[email protected] ~]# firewall-cmd --reload

To confirm that all rules had been added , you can by using the command as shown in the image.

Setup Asterisk Database

Let‘s connect to the MySQL MariaDB and create new user and database then provide it all privileges using the following commands.

[[email protected] ~]# mysql -u root -p

Enter password:******

Welcome to the MariaDB monitor. Commands end with ; or \g.

Your MariaDB connection id is 11

Server version: 5.5.44-MariaDB MariaDB Server

Copyright (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 [email protected] IDENTIFIED BY ‘******‘;

MariaDB [(none)]> GRANT ALL PRIVILEGES ON cdrdb.* TO [email protected] IDENTIFIED BY ‘******‘;

MariaDB [(none)]> flush privileges;

MariaDB [(none)]>

Launching Asterisk

Launch Asterisk for the first time after its setup on Centos 7 using below command.

[[email protected] ~]# asterisk -r

Conclusion

Asterisk 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-09-29 00:10:17

Centos 7.x Install and Setup Asterisk 13 (PBX)的相关文章

Centos 6.3 install Darwin Streaming Server 6.0.3

网上说的天花乱坠,都是抄来抄去,没有一个是经过自己试验,然后才写的 周氏一族,整理技术文档,给下一代留点教程...... 1.服务器系统准备 2.安装文件准备 2.1  源码文件,请上官网,下载,或者用我下面的地址也可以. http://dss.macosforge.org/downloads/DarwinStreamingSrvr6.0.3-Source.tar 2.2  下载附件  dss_patch [里面有两个文件 dss-6.0.3.patch 和 dss-hh-20080728-1.

解决centos选择minimal模式安装setup命令不可用

CentOS中无法使用setup命令提示: -bash:setup: command not found 解决方法: 出现这个问题是因为 Minimal 安装模式,所以并没有安装setuptool 软件.倘若使用图形安装模式的话即使选择"以后定制软件"也可以在安装好系统之后直接使用setup命令, 解决办法为: 使用yum 源直接下载安装 或者 去下载 setuptool 软件包安装 #安装setuptool yum install setuptool #可以发现执行setup后不全,

本地安装gem install --local redis-stat-0.4.13.gem

因为主机环境不能联外网,悲哀,所以只能想办法下载包,上传到主机来安装 环境:el6.x86_64 1. gem 安装[http://centos.ustc.edu.cn/centos/6/os/x86_64/Packages/] Ruby 1.9.2版本默认已安装Ruby Gem,如果你的版本低于这个?那就往下看吧安装gem 需要ruby的版本在 1.8.7 以上 # rpm -qa |grep rubyrubygems-1.3.7-5.el6.noarchruby-1.8.7.374-4.el

centos 5.10 install lnmp

一.Install MySQL on CentOS/Red Hat (RHEL) 6.5/5.10 二.Install Nginx/PHP-FPM on CentOS/RHEL centos 5.10 install lnmp

Centos 6.3 install reiserFS support

# rpm --import http://elrepo.org/RPM-GPG-KEY-elrepo.org # rpm -Uvh  http://www.elrepo.org/elrepo-release-6-6.el6.elrepo.noarch.rpm # yum update # yum install kmod-reiserfs reiserfs-utils # modprobe reiserfs Centos 6.3 install reiserFS support

CentoS 6.X安装xtrabackup 2.2.13

作为一线运维或者DBA对数据备份绝对不会陌生,mysqldump.xtrabackup等常见备份姿势更是非常熟悉,还有很多商业备份工具以及其他的开源备份工具,所谓的冷备.热备.增量备份什么的,各种名词直接晃悠的你头疼.接下来跟着我继续踩一遍软件安装的坑吧. 操作系统:CentoS 6.7 Xtrabackup版本:2.2.13 MySQL版本:5.6.30 官网文档:https://www.percona.com/doc/percona-xtrabackup/2.2/installation/y

【CentOS】yum install --downloadonly 下载依赖包研究

在CentOS中可以使用yum自动安装软件,在离线环境中却行不通. Linux localhost 3.10.0-327.el7.x86_64 #1 SMP Thu Nov 19 22:10:57 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux 对于同一版本CentOS,我们可以事先下载离线依赖包,后面用命令手动安装. Java 自动安装命令: yum install -y java 安装结果: Installed: java-1.8.0-openjdk.x86_

Ubuntu / CentOS Guide to Install OpenCart

OpenCart is a free and open source web based eCommerce online store management system for a better shopping cart solution. It is a foundation for building an online store allowing the shop owners to make business to their products or shop with the po

CentOS 6.9下的Setup工具(用于管理服务/防火墙/网络配置/验证服务)

说明:Setup工具套件好像是CentOS下特有的用于管理服务/防火墙/网络配置等,其实就是基于命令行模式界面的GUI工具.唯一特点就是方便. 安装: #安装Setup命令工具 yum -y install setuptool #安装Setup工具配套的系统服务组件 yum -y install ntsysv #安装Setup工具配套的防火墙配置组件 yum -y install system-config-securitylevel-tui #安装Setup工具配套的网络配置组件 yum -y