klingon
Newbie

Posts: 41
|
 |
« on: July 25, 2010, 10:45:10 AM » |
|
STEP 4 : Install Freepbx (working script from xdm and slightly modified) When prompted, MySQL root password is passw0rd #!/bin/bash
clear # you need to update these version numbers from the Asterisk download site to make sure # the current version is being installed (www.asterisk.com/downloads)
VER_FREEPBX="2.7.0";
KERNEL_VERSION=`uname -r` KERNEL_VERSION2=`uname -r` KERNEL_VERSION=`echo ${KERNEL_VERSION} | sed -e "s/\-\(.*\)//"` DEBIAN_VERSION=`cat /etc/debian_version`
echo "##################################################################" echo "# MODIFIED Automated installer for Asterisk with FreePBX #" echo "# This is the DAHDI VERSION OF THE SCRIPT #" echo "# BY: Matt Chipman matt@corenetworks.com.au #" echo "# originally based on the excellent work done by #" echo "# #" echo "# Yoann QUERET - yoann@queret.net #" echo "# http://www.queret.net/asterisk/ #" echo "# #" echo "# == Contributors to the original script == #" echo "# Serge Berney - s.berney@kinonline.net #" echo "# Neil Stone - nstone@freewayprojects.com #" echo "# #" echo "# mods can be viewed by reading this source file #" echo "### ---------------------------------------------------------- ###" echo "### ---------------------------------------------------------- ###" echo "# Press <enter> to continue #" echo "##################################################################" read clear
echo "##################################################################" echo "# == SYSTEM CONFIGURATION == #" echo "# Debian ${DEBIAN_VERSION} with kernel ${KERNEL_VERSION} #" echo "# #" echo "# == NETWORK CONFIGURATION == #" echo "# Your server must have an active network connection #" echo "# #" echo "# == Disclaimer == #" echo "# This script built and tested on Debian 5.0 (Lenny) #" echo "# Everyone should be using Lenny for new installs anyway #" echo "### ---------------------------------------------------------- ###" echo "# Press <enter> to continue #" echo "##################################################################" read clear
echo "##################################################################" echo "# CNTRL C to exit or we are installing now #" echo "# THIS IS YOUR LAST CHANCE TO EXIT #" echo "### ---------------------------------------------------------- ###" echo "# The script will run by itself now for about 20 minutes #" echo "# If you have a decent Internet connection it will be quicker #" echo "# #" echo "# Press <enter> to continue #" echo "##################################################################" read clear
clear echo "##################################################################" echo "# FreePBX installation #" echo "##################################################################"
echo "+----------------------------------------------------------------+" echo "| Downloading FreePBX source to /tmp/freepbx/ |" echo "+----------------------------------------------------------------+"
cd /usr/src wget http://mirror.freepbx.org/freepbx-${VER_FREEPBX}.tar.gz tar zxvf freepbx-${VER_FREEPBX}.tar.gz
echo "+----------------------------------------------------------------+" echo "| Changing maximum upload limit in PHP |" echo "+----------------------------------------------------------------+"
cp /etc/php5/apache2/php.ini /etc/php5/apache2/php.ini-orig sed -i "s/\(upload_max_filesize *= *\)\(.*\)/\120M/" /etc/php5/apache2/php.ini sed -i "s/\(memory_limit *= *\)\(.*\)/\1100M/" /etc/php5/apache2/php.ini sed -i "s/\(magic_quotes_gpc *= *\)\(.*\)/\1Off/" /etc/php5/apache2/php.ini
echo "+----------------------------------------------------------------+" echo "| Setting permissions for asterisk user |" echo "+----------------------------------------------------------------+" echo " Press <enter> to continue" read
adduser asterisk --disabled-password --gecos "asterisk PBX" --home /var/lib/asterisk adduser www-data asterisk
# mkdir /var/run/asterisk chown asterisk:asterisk /var/run/asterisk chown asterisk:asterisk -R /etc/asterisk chown asterisk:asterisk -R /var/lib/asterisk # chmod a+x /var/lib/asterisk/bin/* chown asterisk:asterisk -R /var/log/asterisk chown asterisk:asterisk -R /var/spool/asterisk # chown asterisk:asterisk -R /var/www chown -R asterisk /var/lib/php5
echo "+----------------------------------------------------------------+" echo "| Fix moh directory |" echo "+----------------------------------------------------------------+" echo " Press <enter> to continue" read
mkdir /var/lib/asterisk/mohmp3 chmod 775 /var/lib/asterisk/mohmp3 chown asterisk:asterisk /var/lib/asterisk/mohmp3 ln -s /var/lib/asterisk/moh /var/lib/asterisk/mohmp3
echo "+----------------------------------------------------------------+" echo "| Changing apache user and group to 'asterisk' |" echo "+----------------------------------------------------------------+" cp /etc/apache2/apache2.conf /etc/apache2/apache2.conf-orig sed -i "s/\(^User *\)\(.*\)/\1asterisk/" /etc/apache2/apache2.conf sed -i "s/\(^Group *\)\(.*\)/\1asterisk/" /etc/apache2/apache2.conf
clear echo "+----------------------------------------------------------------+" echo "| MySQL |" echo "+----------------------------------------------------------------+" echo " Press <enter> to continue" read
read -p 'MySQL root password: ' mysqlpw
echo "Create call records database (MYSQL root password please, 1 of 4)" echo "create database asteriskcdrdb;" | mysql -u root -p$mysqlpw echo "Create Asterisk database (MYSQL root password please, 2 of 4)" echo "create database asterisk;" | mysql -u root -p$mysqlpw echo "Create call datbase user (MYSQL root password please, 3 of 4)" echo "GRANT ALL PRIVILEGES ON asteriskcdrdb.* TO asteriskuser@localhost IDENTIFIED BY 'amp109';" | mysql -u root -p$mysqlpw echo "Create Asterisk database user (MYSQL root password please, 4 of 4)" echo "GRANT ALL PRIVILEGES ON asterisk.* TO asteriskuser@localhost IDENTIFIED BY 'amp109';" | mysql -u root -p$mysqlpw
mysql -u asteriskuser -pamp109 asteriskcdrdb < /usr/src/freepbx-${VER_FREEPBX}/SQL/cdr_mysql_table.sql mysql -u asteriskuser -pamp109 asterisk < /usr/src/freepbx-${VER_FREEPBX}/SQL/newinstall.sql
echo "+----------------------------------------------------------------+" echo "| Configuring Asterisk to use FreePBX |" echo "+----------------------------------------------------------------+" echo " Press <enter> to continue" read
cp /etc/asterisk/asterisk.conf /etc/asterisk/asterisk.conf.orig sed -i "s/\[directories\](!) .*/[directories]/" /etc/asterisk/asterisk.conf sed -i "s/\(astrundir *=> *\)\(.*\)/\1\/var\/run\/asterisk/" /etc/asterisk/asterisk.conf
echo "+----------------------------------------------------------------+" echo "| Loading Asterisk Post Installation |" echo "+----------------------------------------------------------------+" /usr/sbin/asterisk
echo "+----------------------------------------------------------------+" echo "| Modifying FreeBBX configuration files |" echo "+----------------------------------------------------------------+"
cp /usr/src/freepbx-${VER_FREEPBX}/install_amp /usr/src/freepbx-${VER_FREEPBX}/install_amp-orig sed -i "s/\(^\$webroot*\)\(.*\)/\1 = \"\/var\/www\";/" /usr/src/freepbx-${VER_FREEPBX}/install_amp chmod 755 /usr/src/freepbx-${VER_FREEPBX}/install_amp
LOCAL_IP=`/sbin/ifconfig eth0` LOCAL_IP=`echo ${LOCAL_IP} | sed -e "s/\ Bcast:\(.*\)//"` LOCAL_IP=`echo ${LOCAL_IP} | sed -e "s/\(.*\)\ inet addr://"` sed -i "s/xx.xx.xx.xx/${LOCAL_IP}/g" "/usr/src/freepbx-${VER_FREEPBX}/install_amp"
chmod 755 /usr/src/freepbx-${VER_FREEPBX}/install_amp
echo "+----------------------------------------------------------------+" echo "| Installation of FreePBX |" echo "+----------------------------------------------------------------+" echo "| Simply press <Enter> at each question. |" echo "+----------------------------------------------------------------+" echo " Press <enter> to continue" read
cd /usr/src/freepbx-${VER_FREEPBX}/ ./install_amp
/usr/src/freepbx-${VER_FREEPBX}/apply_conf.sh
echo "+----------------------------------------------------------------+" echo "| Stop Asterisk Post Installation |" echo "+----------------------------------------------------------------+"
asteriskPID=$(cat /var/run/asterisk/asterisk.pid) kill -9 $(cat /var/run/asterisk/asterisk.pid)
echo "+----------------------------------------------------------------+" echo "| Remove Apache2 Redirect |" echo "+----------------------------------------------------------------+"
sed -i "s/\(RedirectMatch*\)\(.*\)//" /etc/apache2/sites-enabled/000-default
echo "+----------------------------------------------------------------+" echo "| Reload apache |" echo "+----------------------------------------------------------------+"
/etc/init.d/apache2 restart
echo "+----------------------------------------------------------------+" echo "| Changing permissions |" echo "+----------------------------------------------------------------+" echo " Press <enter> to continue"
chown -R asterisk:asterisk /etc/asterisk chmod 770 /etc/asterisk/
chown -R asterisk:asterisk /var/lib/asterisk/ chmod 770 /var/lib/asterisk/
chown -R asterisk:asterisk /var/www/
echo "+----------------------------------------------------------------+" echo "| Copying missing images for Freepbx |" echo "+----------------------------------------------------------------+" cp /var/www/admin/modules/dashboard/images/notify_* /var/www/admin/images/
clear echo "##################################################################" echo "# FreePBX installation : Done #" echo "##################################################################"
## /etc/init.d/freepbx start
##################################################################################################
###################################################################################################
################################################################################################### clear echo "+----------------------------------------------------------------+" echo "| Asterisk with FreePBX installation is finished. |" echo "| For running asterisk+freepbx you must use this command : |" echo "| # /etc/init.d/freepbx start |" echo "| |" echo "| # you can also use amportal start stop restart etc |" echo "| !! NEVER LOAD ASTERISK DIRECTLY !! |" echo "+----------------------------------------------------------------+"
echo "+----------------------------------------------------------------+" echo "| Asterisk has been started goto http://${LOCAL_IP} |" echo "| Done, enjoy |" echo "+----------------------------------------------------------------+"
STEP 5 : Only required for Asterisk below version 1.6.2.9 Edit /etc/init.d/asterisk Search for "COLOR=yes" and Comment it out with # Now Reboot your Dockstar to ensure all permissions are refreshed before testing Freepbx. Thats it. Let me know if you find any errors. EDIT 1: If you dont need FOP, you can save 10-15M memory by not using amportal start/stop. Use /etc/init.d/asterisk start/stop/restart instead.
|
|
|
|
« Last Edit: July 25, 2010, 05:43:19 PM by klingon »
|
Logged
|
|
|
|
lowkey
Newbie

Posts: 6
|
 |
« Reply #1 on: July 26, 2010, 01:29:23 PM » |
|
I encountered the following problems with step 4:
Connecting to database..FAILED
cp: cannot stat `/var/www/admin/modules/dashboard/images/notify_*': No such file or directory
|
|
|
|
|
Logged
|
|
|
|
klingon
Newbie

Posts: 41
|
 |
« Reply #2 on: July 26, 2010, 02:36:13 PM » |
|
cp: cannot stat `/var/www/admin/modules/dashboard/images/notify_*': No such file or directory
This error will not cause a connection failure. You must've missed a step somewhere when you set up your SQL databases. These are only images for Freepbx and worst can happen is that you can still get to the main Freepbx page but it will be missing some images. Also, is this a brand new install? Otherwise, you need to be careful of all the symlinks. You need to delete all previous symlinks before going thru the steps. I'd suggest you delete the 2 databases asteriskcdrdb and asterisk and redo the script. At prompt, type in "mysql -u root -p" - Enter your MySQL root password - shld be "passw0rd" (without the quotes - passw zero rd) unless you used something else. mysql> drop database asterisk; mysql> drop database asteriskcdrdb; mysql> quit During the last step of the install, just press ENTER for all the prompts. The only time you need to type in an answer is at the prompt "MySQL root password: " For this, you need to enter "passw0rd" (without the quotes - passw zero rd). Also, I would suggest you not change any passwords for now until you get it up and running. Stick to the defaults. Since Step 4 is a script, I'm guessing you must've used a different password and that's probably why you cannot connect to the DB. Hope this fixes it.
|
|
|
|
|
Logged
|
|
|
|
lowkey
Newbie

Posts: 6
|
 |
« Reply #3 on: July 26, 2010, 04:36:25 PM » |
|
Ok dokie. Freepbx is now running on my DockStar. After the last error messages I did the following:
1) deleted /var/lib/asterisk/mohmp3 2) renamed /etc/amportal.conf to /etc/amportal.old.conf 3) dropped the 2 databases you called out 4) re-run the step4 script and this time accepted all suggested user names and passwords 5) re-booted (twice because I have toggle boot)
Success!
(Possible suggestion for the scripts: either have a CLEANUP option or check for existence of files, directories etc and prompt user to remove them to prevent errors)
Thanks!
|
|
|
|
|
Logged
|
|
|
|
klingon
Newbie

Posts: 41
|
 |
« Reply #4 on: July 26, 2010, 04:59:07 PM » |
|
Awesome...glad it worked out. I also managed to get Google Voice working as well on the Dockstar. Thanks to all the blunders I learned from my pbxinaflash installs over these years. Will post those instructions as soon as I get the time.
|
|
|
|
|
Logged
|
|
|
|
JohnDoe
Newbie

Posts: 2
|
 |
« Reply #5 on: July 26, 2010, 08:10:32 PM » |
|
Thanks to klingon and all the others for getting it this far.
Can't wait to read how to setup Google voice, As I am a novice user should I wait for a disk image or should I look to drive in and try and get my hands dirty I wont be able to contrib much in terms of development but happy to do write ups and test a few things.
|
|
|
|
|
Logged
|
|
|
|
|
mattmc97
|
 |
« Reply #6 on: July 26, 2010, 08:34:16 PM » |
|
I would recommend trying the scripts out and see what you can accomplish. You will definitely learn some things on the way.
I would get debian installed on your usb or sd card and then take an image of that with a program like win32diskimager on windows.
That way if you jack something up, you don't have to start from scratch.
Try the scripts, test google voice, find something else cool to add; whatever seems fun for you to do. There is also the wiki, that needs a bunch of work. I started with the plug windows guide, but no one has added anything else yet.
|
|
|
|
|
Logged
|
|
|
|
txcas
Newbie

Posts: 13
|
 |
« Reply #7 on: July 27, 2010, 05:05:41 AM » |
|
I completed step 4 successfully. I tested the Freepbx web admin page and it worked. I rebooted and my Docstar now fails to boot from the USB drive. 
|
|
|
|
|
Logged
|
|
|
|
klingon
Newbie

Posts: 41
|
 |
« Reply #8 on: July 27, 2010, 08:51:54 AM » |
|
I completed step 4 successfully. I tested the Freepbx web admin page and it worked. I rebooted and my Docstar now fails to boot from the USB drive.  Try this : Reboot without your USB drive Once successfully booted to Pogoplug, plug in your USB drive and wait 10 secs Then reboot System may need to reboot a few times as it does fsck checks of your system. I've set my blparam to boot only to USB drive but then you'll need a serial cable if something fails as it will never boot back into Pogoplug.
|
|
|
|
|
Logged
|
|
|
|
txcas
Newbie

Posts: 13
|
 |
« Reply #9 on: July 27, 2010, 10:18:13 AM » |
|
I installed everything again, this time on different media. It is all working now. Thanks a lot. I can't wait for the Google Voice script. This time I created a disk image after each step, so I can go back if I screw up. I do have the Nokia CA-42 cable, I need to cut it and connect it to the Dockstar so I can make it boot directly to USB.
|
|
|
|
|
Logged
|
|
|
|
txcas
Newbie

Posts: 13
|
 |
« Reply #10 on: July 28, 2010, 12:19:33 PM » |
|
Is the Freepbx Panel supposed to work? I get Couldn't load variables.txt?aldope=40216 when I try to go there from the Freepbx admin page.
|
|
|
|
« Last Edit: July 28, 2010, 12:38:08 PM by txcas »
|
Logged
|
|
|
|
klingon
Newbie

Posts: 41
|
 |
« Reply #11 on: July 28, 2010, 12:59:01 PM » |
|
Yes, everything works. The regular startup uses /etc/init.d/asterisk which does not start the FOP panel. Do an amportal restart but as I mentioned in another post, unless you use FOP, this sucks up a fair chunk of our limited RAM.
|
|
|
|
|
Logged
|
|
|
|
txcas
Newbie

Posts: 13
|
 |
« Reply #12 on: July 28, 2010, 01:09:13 PM » |
|
Thanks for the answer.
|
|
|
|
|
Logged
|
|
|
|
|
PlugPBX Admin
|
 |
« Reply #13 on: July 29, 2010, 06:08:32 AM » |
|
|
|
|
|
|
Logged
|
-Greg
|
|
|
AL
Newbie

Posts: 8
|
 |
« Reply #14 on: August 04, 2010, 11:34:12 PM » |
|
First of all, thank you very much for the step-by-step instructions, klingon. It really helps a newbie like me to not have to search around for info. At prompt, type in "mysql -u root -p" - Enter your MySQL root password - shld be "passw0rd" (without the quotes - passw zero rd) unless you used something else. I'm not sure if "passw0rd" was specified in an earlier step or not when installing MySQL. I didn't see that in earlier instructions (during "apt-get -y install mysql-server" in step 2) but might have missed it. So, when MySQL was configured, I just left the password for "root" defaulted which turned out to be blank, i.e. no password, and I just hit the "Enter" key whenever prompted for the "root" password for MySQL when Asterisk was installed/configured.
|
|
|
|
|
Logged
|
|
|
|
|