Advertisement
Guest User

Untitled

a guest
Aug 11th, 2016
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.78 KB | None | 0 0
  1.  
  2. #System Update
  3. \yum -y update
  4.  
  5. #Disable Seliunx
  6. sed -i 's/\(^SELINUX=\).*/\SELINUX=disabled/' /etc/selinux/config
  7.  
  8. #Install EPEL and FreeSwitch repo
  9. \yum -y install epel-release http://files.freeswitch.org/freeswitch-release-1-6.noarch.rpm
  10.  
  11. #Install FreeSwitch, Apache, MariaDB, PHP, GIT, etc
  12. \yum -y install freeswitch-config-vanilla freeswitch-sounds-en* freeswitch-sounds-music* freeswitch-lua freeswitch-xml-cdr git nano httpd mariadb-server php php-common php-pdo php-soap php-xml php-xmlrpc php-mysql php-cli mysql-connector-odbc memcached
  13.  
  14. ##Install FusionPBX
  15. git clone https://github.com/fusionpbx/fusionpbx.git /var/www/html
  16.  
  17.  
  18. ## Configure MariaDB
  19. export DBPASSWORD=#FreeSw1tch#;
  20. systemctl start mariadb;
  21. #sed -i '2i bind-address=127.0.0.1' /etc/my.cnf;
  22. mysqladmin -u root create freeswitch;
  23. mysql -u root -e "GRANT ALL PRIVILEGES ON freeswitch.* TO fusionpbx@localhost IDENTIFIED BY '9a3rvTS5cDqjv562';flush privileges;"
  24.  
  25. #Configure ODBC
  26. \cat > /etc/odbc.ini <<EOF
  27. [freeswitch]
  28. Driver = MySQL
  29. SERVER = 127.0.0.1
  30. PORT = 3306
  31. DATABASE = freeswitch
  32. OPTION = 67108864
  33. Socket = /var/lib/mysql/mysql.sock
  34. threading=0
  35. MaxLongVarcharSize=65536
  36.  
  37. [fusionpbx]
  38. Driver = MySQL
  39. SERVER = 127.0.0.1
  40. PORT = 3306
  41. DATABASE = fusionpbx
  42. OPTION = 67108864
  43. Socket = /var/lib/mysql/mysql.sock
  44. threading=0
  45. EOF
  46.  
  47.  
  48. ## Configure Apache
  49. # Set http server to run as same user/group as Freeswitch
  50. sed -i "s/User apache/User freeswitch/" /etc/httpd/conf/httpd.conf;
  51. sed -i "s/Group apache/Group daemon/" /etc/httpd/conf/httpd.conf;
  52.  
  53. # Set webserver to obey any .htaccess files in /var/www/html and subdirs
  54. sed -i ':a;N;$!ba;s/AllowOverride None/AllowOverride All/2' /etc/httpd/conf/httpd.conf;
  55.  
  56. ## Configure FreeSwitch
  57. # Add user freeswitch to group apache to avoid problems with /var/lib/php/sessions directory
  58. usermod -a -G apache freeswitch;
  59.  
  60. #Create Service Files
  61. #\cat > /etc/systemd/system/freeswitch.service <<EOF
  62. #[Unit]
  63. #Description=FreeSWITCH
  64. #Wants=network-online.target
  65. #After=syslog.target network.target network-online.target
  66. #After=mariadb.service httpd.service
  67.  
  68. #[Service]
  69. #Type=forking
  70. #User=freeswitch
  71. #WorkingDirectory=/run/freeswitch
  72. #PIDFile=/run/freeswitch/freeswitch.pid
  73. #EnvironmentFile=-/etc/sysconfig/freeswitch
  74. #ExecStart=/usr/bin/freeswitch -ncwait -nonat $FREESWITCH_PARAMS
  75. #ExecReload=/usr/bin/kill -HUP $MAINPID
  76.  
  77. #[Install]
  78. #WantedBy=multi-user.target
  79. #EOF
  80.  
  81. #\cat > /etc/tmpfiles.d/freeswitch.conf <<EOF
  82. #d /run/freeswitch 0750 freeswitch daemon -
  83. #EOF
  84.  
  85. # Set ownership
  86. chown -R freeswitch.daemon /etc/freeswitch /var/lib/freeswitch /var/log/freeswitch /usr/share/freeswitch /var/www/html;
  87.  
  88. # Set directory permissions to 770 (u=rwx,g=rwx,o='')
  89. find /etc/freeswitch -type d -exec chmod 770 {} \;
  90. find /var/lib/freeswitch -type d -exec chmod 770 {} \;
  91. find /var/log/freeswitch -type d -exec chmod 770 {} \;
  92. find /usr/share/freeswitch -type d -exec chmod 770 {} \;
  93. find /var/www/html -type d -exec chmod 770 {} \;
  94.  
  95. # Set file permissions to 664 (u=rw,g=rw,o=r)
  96. find /etc/freeswitch -type f -exec chmod 664 {} \;
  97. find /var/lib/freeswitch -type f -exec chmod 664 {} \;
  98. find /var/log/freeswitch -type f -exec chmod 664 {} \;
  99. find /usr/share/freeswitch -type f -exec chmod 664 {} \;
  100. find /var/www/html -type f -exec chmod 664 {} \;
  101.  
  102. ## Configure SELinux
  103. #semanage port -l | grep '^http_port_t';
  104.  
  105. ## Configure Firewall
  106. firewall-cmd --permanent --zone=public --add-service={http,https};
  107. firewall-cmd --permanent --zone=public --add-port={5060,5070,5080}/udp;
  108. firewall-cmd --permanent --zone=public --add-port=16384-32768/udp;
  109. firewall-cmd --reload;
  110.  
  111. ## Enable Services
  112. systemctl daemon-reload;
  113. systemctl enable mariadb httpd freeswitch memcached;
  114.  
  115. ## Restart Services
  116. systemctl restart mariadb httpd freeswitch memcached;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement