Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #System Update
- \yum -y update
- #Disable Seliunx
- sed -i 's/\(^SELINUX=\).*/\SELINUX=disabled/' /etc/selinux/config
- #Install EPEL and FreeSwitch repo
- \yum -y install epel-release http://files.freeswitch.org/freeswitch-release-1-6.noarch.rpm
- #Install FreeSwitch, Apache, MariaDB, PHP, GIT, etc
- \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
- ##Install FusionPBX
- git clone https://github.com/fusionpbx/fusionpbx.git /var/www/html
- ## Configure MariaDB
- export DBPASSWORD=#FreeSw1tch#;
- systemctl start mariadb;
- #sed -i '2i bind-address=127.0.0.1' /etc/my.cnf;
- mysqladmin -u root create freeswitch;
- mysql -u root -e "GRANT ALL PRIVILEGES ON freeswitch.* TO fusionpbx@localhost IDENTIFIED BY '9a3rvTS5cDqjv562';flush privileges;"
- #Configure ODBC
- \cat > /etc/odbc.ini <<EOF
- [freeswitch]
- Driver = MySQL
- SERVER = 127.0.0.1
- PORT = 3306
- DATABASE = freeswitch
- OPTION = 67108864
- Socket = /var/lib/mysql/mysql.sock
- threading=0
- MaxLongVarcharSize=65536
- [fusionpbx]
- Driver = MySQL
- SERVER = 127.0.0.1
- PORT = 3306
- DATABASE = fusionpbx
- OPTION = 67108864
- Socket = /var/lib/mysql/mysql.sock
- threading=0
- EOF
- ## Configure Apache
- # Set http server to run as same user/group as Freeswitch
- sed -i "s/User apache/User freeswitch/" /etc/httpd/conf/httpd.conf;
- sed -i "s/Group apache/Group daemon/" /etc/httpd/conf/httpd.conf;
- # Set webserver to obey any .htaccess files in /var/www/html and subdirs
- sed -i ':a;N;$!ba;s/AllowOverride None/AllowOverride All/2' /etc/httpd/conf/httpd.conf;
- ## Configure FreeSwitch
- # Add user freeswitch to group apache to avoid problems with /var/lib/php/sessions directory
- usermod -a -G apache freeswitch;
- #Create Service Files
- #\cat > /etc/systemd/system/freeswitch.service <<EOF
- #[Unit]
- #Description=FreeSWITCH
- #Wants=network-online.target
- #After=syslog.target network.target network-online.target
- #After=mariadb.service httpd.service
- #[Service]
- #Type=forking
- #User=freeswitch
- #WorkingDirectory=/run/freeswitch
- #PIDFile=/run/freeswitch/freeswitch.pid
- #EnvironmentFile=-/etc/sysconfig/freeswitch
- #ExecStart=/usr/bin/freeswitch -ncwait -nonat $FREESWITCH_PARAMS
- #ExecReload=/usr/bin/kill -HUP $MAINPID
- #[Install]
- #WantedBy=multi-user.target
- #EOF
- #\cat > /etc/tmpfiles.d/freeswitch.conf <<EOF
- #d /run/freeswitch 0750 freeswitch daemon -
- #EOF
- # Set ownership
- chown -R freeswitch.daemon /etc/freeswitch /var/lib/freeswitch /var/log/freeswitch /usr/share/freeswitch /var/www/html;
- # Set directory permissions to 770 (u=rwx,g=rwx,o='')
- find /etc/freeswitch -type d -exec chmod 770 {} \;
- find /var/lib/freeswitch -type d -exec chmod 770 {} \;
- find /var/log/freeswitch -type d -exec chmod 770 {} \;
- find /usr/share/freeswitch -type d -exec chmod 770 {} \;
- find /var/www/html -type d -exec chmod 770 {} \;
- # Set file permissions to 664 (u=rw,g=rw,o=r)
- find /etc/freeswitch -type f -exec chmod 664 {} \;
- find /var/lib/freeswitch -type f -exec chmod 664 {} \;
- find /var/log/freeswitch -type f -exec chmod 664 {} \;
- find /usr/share/freeswitch -type f -exec chmod 664 {} \;
- find /var/www/html -type f -exec chmod 664 {} \;
- ## Configure SELinux
- #semanage port -l | grep '^http_port_t';
- ## Configure Firewall
- firewall-cmd --permanent --zone=public --add-service={http,https};
- firewall-cmd --permanent --zone=public --add-port={5060,5070,5080}/udp;
- firewall-cmd --permanent --zone=public --add-port=16384-32768/udp;
- firewall-cmd --reload;
- ## Enable Services
- systemctl daemon-reload;
- systemctl enable mariadb httpd freeswitch memcached;
- ## Restart Services
- systemctl restart mariadb httpd freeswitch memcached;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement