Fonte: http://www.snep.com.br/index.php/artigos-tecnicos/104-instalacao-do-snep-3-em-centos-7-asterisk-13-mariadb
14 Out 2015
Escrito por Heros Santos Amaral Filho.
É com muita satisfação que recebemos mais uma contribuição da comunidade, desta vez por parte de nosso colega Heros Amaral Filho.
Entusiasta do do SNEP, o Heros nos presenteou com este tutorial para o novo SNEP 3. Valeu Heros, a comunidade com certeza irá usufruir muito desta sua contribuição.
Tutorial baseado em:
Importante: Todos os comandos devem ser executados como root.
Padrão minimo + ferramentas de diagnóstico.
yum update
sed -i s/SELINUX=enforcing/SELINUX=disabled/g /etc/selinux/config
Obs.: Necessário reinicializar o SO. Após reinicialização verificar se o SELinux está desabilitado
sestatus
systemctl stop firewalld.service systemctl disable firewalld.service
wget http://www.digip.org/jansson/releases/jansson-2.5.tar.gz tar -zxf jansson-2.5.tar.gz cd jansson-2.5/ ./configure make clean make all && make install ldconfig
yum install -y make wget openssl-devel ncurses-devel newt-devel libxml2-devel kernel-devel gcc gcc-c++ sqlite-devel libuuid-devel git sox libiodbc unixODBC unixODBC-devel libtool-ltdl libtool-ltdl-devel
cd /usr/src wget http://downloads.asterisk.org/pub/telephony/dahdi-linux-complete/dahdi-linux-complete-current.tar.gz tar -zxf dahdi-linux-complete-current.tar.gz cd dahdi-linux-complete-2.10.2+2.10.2/ make clean make all && make install make config chkconfig dahdi on
cd /usr/src wget http://downloads.asterisk.org/pub/telephony/libpri/libpri-1.4-current.tar.gz tar -zxf libpri-1.4-current.tar.gz cd libpri-1.4.15/ make all && make install
cd /usr/src wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-13-current.tar.gz tar -zxf asterisk-13-current.tar.gz cd asterisk-13.5.0/ make clean ./configure –libdir=/usr/lib64 make && make install make samples make config chkconfig asterisk on
yum -y install mariadb-server mariadb systemctl start mariadb.service systemctl enable mariadb.service mysql_secure_installation
[root@server1 ~]# mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none): <--ENTER
OK, successfully used password, moving on...
Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.
Set root password? [Y/n]
New password: <--para o padrão do SNEP a senha é sneppass
Re-enter new password: <--confirma a senha sneppass
Password updated successfully!
Reloading privilege tables..
... Success!
By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n] <-- (Y) ENTER
... Success!
Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] <-- (N) ENTER
... Success!
By default, MariaDB comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] <-- (N) ENTER
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] <-- (Y) ENTER
... Success!
Cleaning up...
All done! If you've completed all of the above steps, your MariaDB
installation should now be secure.
Thanks for using MariaDB!
yum -y install httpd systemctl start httpd.service systemctl enable httpd.service firewall-cmd --permanent --zone=public --add-service=http firewall-cmd --permanent --zone=public –add-service=https firewall-cmd --reload
yum -y install php systemctl restart httpd.service
yum -y install php-mysql yum -y install php-gd php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-snmp php-soap curl curl-devel systemctl restart httpd.service
cd /var/www/html git clone link_do_git mv snep-3 snep
cd /var/www/html find . -type f -exec chmod 640 {} \; -exec chown apache:apache {} \; find . -type d -exec chmod 755 {} \; -exec chown apache:apache {} \; chmod +x /var/www/html/snep/agi/*
mkdir /var/log/snep cd /var/log/snep touch ui.log touch agi.log ln -s /var/log/asterisk/full full chown -R apache.apache * cd /var/www/html/snep/ ln -s /var/log/snep logs cd /var/lib/asterisk/agi-bin/ ln -s /var/www/html/snep/agi/ snep cd /var/spool/asterisk/ rm -rf monitor ln -sf /var/www/html/snep/arquivos monitor
Para a configuração do apache deve-se copiar o conteúdo do arquivo:
/var/www/html/snep/install/snep.apache2
para o arquivo:
/etc/httpd/conf/httpd.conf
Obs: reiniciar o apache
systemctl restart httpd.service
cd /etc cp -p -r asterisk/ /root/bck_etc_asterisk (Importante fazer backup caso haja necessidade de restaurar algum arquivo) rm -rf asterisk cp -avr /var/www/html/snep/install/etc/asterisk . cp /var/www/html/snep/install/etc/odbc* .
cd /usr/src wget -c http://www.sneplivre.com.br/downloads/asterisk-sounds.tgz tar -xzf asterisk-sounds.tgz -C /var/lib/asterisk/ cd /var/lib/asterisk/sounds mkdir -p tmp backup pt_BR/tmp pt_BR/backup chown -R apache:apache *
cd /var/lib/asterisk/moh mkdir tmp backup mkdir -p snep_1/tmp snep_1/backup mkdir -p snep_2/tmp snep_2/backup mkdir -p snep_3/tmp snep_3/backup chown -R apache.apache *
mkdir -p /var/www/html/snep/sounds cd /var/www/html/snep/sounds/ ln -sf /var/lib/asterisk/moh/ moh ln -sf /var/lib/asterisk/sounds/pt_BR/ pt_BR
cd /var/www/html/snep/install/database mysql -u root -p < database.sql mysql -u root -p sneppass < schema.sql mysql -u root -p sneppass < system_data.sql mysql -u root -p sneppass < core-cnl.sql
- Os arquivos odbc.ini e odbcinst.ini devem ficar exatamente como a seguir:
/etc/odbc.ini
; ###OPENS### [MySQL-snep] Description = MySQL ODBC Driver Driver = /usr/lib64/libmyodbc5w.so Socket = /var/lib/mysql/mysql.sock Server = localhost User = snep Password = sneppass Database = snep Option = 3
/etc/odbcinst.ini
; ###OPENS### [MySQL] Description = MySQL ODBC MyODBC Driver Driver = /usr/lib64/libmyodbc5w.so FileUsage = 1 [Text] Description = ODBC for Text Files Driver = /usr/lib64/libodbctxtS.so Setup = /usr/lib64/libodbctxtS.so FileUsage = 1 CPTimeout = CPReuse =
Deverá ser copiado os arquivos asterisk.conf e modules.conf para a pasta /etc/asterisk sobreescrevendo os atuais.
Material de apoio: