Hi,
habe mein ISPCP ausversehen zerschossen als ich Asterisk installiet habe
bin auf der falschen vm gewesen und habe dummerweise auf der vm mit dem ISPCP das script ausgeführt was irgendwas am webserver verändert hat.
Die ist wahrscheinlich der entscheidende Befehl der alles zerstört hat
wie kann ich das am besten wieder rückgängig machen?
Code:
aptitude install -y apache2 php5 php5-cli mysql-server-5.0 php-pear php5-mysql php-db libapache2-mod-php5 php5-gd php5-curl
Hier nochmal des gesamte Script
Code:
#!/bin/bash
VER_ASTERISK="1.4.21.2";
VER_ZAPTEL="1.4.11";
VER_LIBPRI="1.4.4";
VER_ADDONS="1.4.7";
VER_FREEPBX="2.4.1";
CHECK_VER_DEBIAN="4.0";
CHECK_VER_KERNEL="2.6.18";
echo "##################################################################"
echo "# Automated installer for Asterisk with FreePBX #"
echo "# #"
echo "# Yoann QUERET - yoann@queret.net #"
echo "# http://www.queret.net/asterisk/ #"
echo "# #"
echo "# == CONTRIBUTORS == #"
echo "# Serge Berney - s.berney@kinonline.net #"
echo "# Neil Stone - nstone@freewayprojects.com #"
echo "# #"
echo "### ---------------------------------------------------------- ###"
echo "-> Asterisk ${VER_ASTERISK}"
echo "-> Zaptel ${VER_ZAPTEL}"
echo "-> Libpri ${VER_LIBPRI}"
echo "-> Addons ${VER_ADDONS}"
echo "-> FreePBX ${VER_FREEPBX} (+ apache2 php5 mysql5)"
echo "### ---------------------------------------------------------- ###"
echo "# Press <enter> to continue #"
echo "##################################################################"
read
echo "##################################################################"
echo "# == SYSTEM CONFIGURATION REQUIRED == #"
echo "# Debian ${CHECK_VER_DEBIAN} with kernel ${CHECK_VER_KERNEL} #"
echo "# #"
echo "# File /etc/apt/sources.list must be up to date #"
echo "# #"
echo "# == NETWORK CONFIGURATION REQUIRED == #"
echo "# Your server must be connected to internet, and must be use #"
echo "# aptitude and wget command. #"
echo "# #"
echo "# #"
echo "### ---------------------------------------------------------- ###"
echo "# Press <enter> to continue #"
echo "##################################################################"
read
echo "+----------------------------------------------------------------+"
echo "| System check (Debian and Kernel version) |"
echo "+----------------------------------------------------------------+"
echo " Press <enter> to continue"
read
KERNEL_VERSION=`uname -r`
KERNEL_VERSION=`echo ${KERNEL_VERSION} | sed -e "s/\-\(.*\)//"`
if [ ${KERNEL_VERSION} != ${CHECK_VER_KERNEL} ]; then
echo " ERROR : This script must be used with a Debian kernel ${CHECK_VER_KERNEL}."
echo " Also, you use kernel : ${KERNEL_VERSION}"
echo " Installation stopped !"
exit
fi
DEBIAN_VERSION=`cat /etc/debian_version`
if [ ${DEBIAN_VERSION} != ${CHECK_VER_DEBIAN} ]; then
echo " ERROR : This script must be used with Debian ${CHECK_VER_DEBIAN}."
echo " Also, you use Debian : ${DEBIAN_VERSION}"
echo " Installation stopped !"
exit
fi
echo " You use Debian ${DEBIAN_VERSION}, with kernel ${KERNEL_VERSION}."
echo " We can continu installation."
echo " Press <enter> to continue"
read
clear
echo "##################################################################"
echo "# PART 1 - Asterisk installation #"
echo "### ---------------------------------------------------------- ###"
echo "# Press <enter> to continue #"
echo "##################################################################"
read
echo "+----------------------------------------------------------------+"
echo "| Download sources to /tmp/asterisk/ |"
echo "+----------------------------------------------------------------+"
echo " Press <enter> to continue"
read
mkdir /tmp/asterisk/
wget http://downloads.digium.com/pub/asterisk/releases/asterisk-${VER_ASTERISK}.tar.gz -O /tmp/asterisk/asterisk-${VER_ASTERISK}.tar.gz
wget http://downloads.digium.com/pub/zaptel/releases/zaptel-${VER_ZAPTEL}.tar.gz -O /tmp/asterisk/zaptel-${VER_ZAPTEL}.tar.gz
wget http://downloads.digium.com/pub/libpri/releases/libpri-${VER_LIBPRI}.tar.gz -O /tmp/asterisk/libpri-${VER_LIBPRI}.tar.gz
wget http://downloads.digium.com/pub/asterisk/releases/asterisk-addons-${VER_ADDONS}.tar.gz -O /tmp/asterisk/asterisk-addons-${VER_ADDONS}.tar.gz
echo "+----------------------------------------------------------------+"
echo "| Installing required packages |"
echo "+----------------------------------------------------------------+"
echo " Press <enter> to continue"
read
aptitude update
aptitude -y install linux-source-2.6.18 kernel-package g++ libncurses5-dev linux-kernel-headers sqlite libnewt-dev libusb-dev zlib1g-dev libmysqlclient15-dev libsqlite0-dev
echo "+----------------------------------------------------------------+"
echo "| Configuring of kernel sources |"
echo "+----------------------------------------------------------------+"
echo " Press <enter> to continue"
read
cd /usr/src/
tar xvjf linux-source-2.6.18.tar.bz2
ln -s /usr/src/linux-source-2.6.18 /usr/src/linux
cd /usr/src/linux/
make oldconfig
make prepare
make prepare scripts
echo "+----------------------------------------------------------------+"
echo "| Decompresing sources in /usr/src/ |"
echo "+----------------------------------------------------------------+"
echo " Press <enter> to continue"
read
cd /usr/src/
tar zxvf /tmp/asterisk/asterisk-${VER_ASTERISK}.tar.gz
tar zxvf /tmp/asterisk/asterisk-addons-${VER_ADDONS}.tar.gz
tar zxvf /tmp/asterisk/libpri-${VER_LIBPRI}.tar.gz
tar zxvf /tmp/asterisk/zaptel-${VER_ZAPTEL}.tar.gz
echo "+----------------------------------------------------------------+"
echo "| Compiling Zaptel |"
echo "+----------------------------------------------------------------+"
echo " Press <enter> to continue"
read
cd /usr/src/zaptel-${VER_ZAPTEL}
./configure
echo "== ATTENTION =="
echo "If you don't understand next question, choose NO."
echo "--"
while [ "$key" != "y" ] && [ "$key" != "n" ];do
echo ""
read -n 1 -p "Do you want to select Zaptel modules to install (make menuconfig) ? [y/N]" key
done
if [ $key == "y" ]; then
make menuconfig
fi
make
make install
make config
echo "+----------------------------------------------------------------+"
echo "| Compiling libpri |"
echo "+----------------------------------------------------------------+"
echo " Press <enter> to continue"
read
cd /usr/src/libpri-${VER_LIBPRI}
make install
echo "+----------------------------------------------------------------+"
echo "| Compiling Asterisk |"
echo "+----------------------------------------------------------------+"
echo " Press <enter> to continue"
read
cd /usr/src/asterisk-${VER_ASTERISK}
./configure
MAKEOPTS="/usr/src/asterisk-${VER_ASTERISK}/menuselect.makeopts"
echo 'MENUSELECT_APPS=app_ivrdemo app_osplookup app_rpt app_skel' >> ${MAKEOPTS}
echo 'MENUSELECT_CDR=cdr_odbc cdr_pgsql cdr_radius cdr_tds' >> ${MAKEOPTS}
echo 'MENUSELECT_CHANNELS=chan_alsa chan_gtalk chan_h323 chan_misdn chan_nbs chan_vpb' >> ${MAKEOPTS}
echo 'MENUSELECT_CODECS=codec_ilbc codec_speex' >> ${MAKEOPTS}
echo 'MENUSELECT_FORMATS=format_ogg_vorbis' >> ${MAKEOPTS}
echo 'MENUSELECT_FUNCS=func_curl func_odbc' >> ${MAKEOPTS}
echo 'MENUSELECT_PBX=pbx_gtkconsole' >> ${MAKEOPTS}
echo 'MENUSELECT_RES=res_config_odbc res_config_pgsql res_crypto res_jabber res_odbc res_snmp' >> ${MAKEOPTS}
echo 'MENUSELECT_OPTS_app_voicemail=' >> ${MAKEOPTS}
echo 'MENUSELECT_CFLAGS=LOADABLE_MODULES' >> ${MAKEOPTS}
echo 'MENUSELECT_EMBED=apps cdr channels codecs formats funcs pbx res' >> ${MAKEOPTS}
echo 'MENUSELECT_CORE_SOUNDS=CORE-SOUNDS-EN-WAV CORE-SOUNDS-EN-ULAW CORE-SOUNDS-EN-ALAW CORE-SOUNDS-EN-GSM CORE-SOUNDS-EN-G729 CORE-SOUNDS-EN-G722' >> ${MAKEOPTS}
echo 'MENUSELECT_MOH=MOH-FREEPLAY-WAV MOH-FREEPLAY-ULAW MOH-FREEPLAY-ALAW MOH-FREEPLAY-GSM MOH-FREEPLAY-G729 MOH-FREEPLAY-G722' >> ${MAKEOPTS}
echo 'MENUSELECT_EXTRA_SOUNDS=EXTRA-SOUNDS-EN-WAV EXTRA-SOUNDS-EN-ULAW EXTRA-SOUNDS-EN-ALAW EXTRA-SOUNDS-EN-GSM EXTRA-SOUNDS-EN-G729 EXTRA-SOUNDS-EN-G722' >> ${MAKEOPTS}
echo 'MENUSELECT_BUILD_DEPS=res_adsi chan_local res_indications app_meetme res_monitor res_smdi res_features' >> ${MAKEOPTS}
echo "== ATTENTION =="
echo "If you don't understand next question, choose NO."
echo "--"
while [ "$key" != "y" ] && [ "$key" != "n" ];do
echo ""
read -n 1 -p "Do you want to select Asterisk modules to install (make menuconfig) [y/N]" key
done
if [ $key == "y" ]; then
make menuconfig
fi
make install
make samples
echo "+----------------------------------------------------------------+"
echo "| Compiling Asterisk Addons |"
echo "+----------------------------------------------------------------+"
echo " Press <enter> to continue"
read
cd /usr/src/asterisk-addons-${VER_ADDONS}
./configure
echo "== ATTENTION =="
echo "If you don't understand next question, choose NO."
echo "--"
while [ "$key" != "y" ] && [ "$key" != "n" ];do
echo ""
read -n 1 -p "Do you want to select Asterisk Addons modules to install (make menuconfig) ? [y/N]" key
done
if [ $key == "y" ]; then
make menuconfig
fi
make install
echo "+----------------------------------------------------------------+"
echo "| Creating symlinks (Modules) |"
echo "+----------------------------------------------------------------+"
echo " Press <enter> to continue"
read
ln -s /lib/modules/2.6.18/ /lib/modules/`uname -r`/asterisk
depmod
echo "+----------------------------------------------------------------+"
echo "| Loading ztdummy at boot time |"
echo "+----------------------------------------------------------------+"
echo " Press <enter> to continue"
read
echo ztdummy >> /etc/modules
echo "##################################################################"
echo "# PART1 : Asterisk installation : Done #"
echo "### ---------------------------------------------------------- ###"
echo "# Press <enter> to continue #"
echo "##################################################################"
read
###################################################################################################
###################################################################################################
###################################################################################################
clear
echo "##################################################################"
echo "# PART 2 - FreePBX installation #"
echo "### ---------------------------------------------------------- ###"
echo "# Press <enter> to continue #"
echo "##################################################################"
read
echo "+----------------------------------------------------------------+"
echo "| Installing packages |"
echo "+----------------------------------------------------------------+"
echo " Press <enter> to continue"
read
aptitude update
aptitude install -y apache2 php5 php5-cli mysql-server-5.0 php-pear php5-mysql php-db libapache2-mod-php5 php5-gd php5-curl
echo "+----------------------------------------------------------------+"
echo "| Downloading source to /tmp/freepbx/ |"
echo "+----------------------------------------------------------------+"
echo " Press <enter> to continue"
read
mkdir /tmp/freepbx/
wget http://mirror.freepbx.org/freepbx-${VER_FREEPBX}.tar.gz -O /tmp/freepbx/freepbx-${VER_FREEPBX}.tar.gz
echo "+----------------------------------------------------------------+"
echo "| Decompresing FreePBX sources in /usr/src/ |"
echo "+----------------------------------------------------------------+"
echo " Press <enter> to continue"
read
cd /usr/src
tar zxvf /tmp/freepbx/freepbx-${VER_FREEPBX}.tar.gz
echo "+----------------------------------------------------------------+"
echo "| Changing maximum upload limit in PHP |"
echo "+----------------------------------------------------------------+"
echo " Press <enter> to continue"
read
cp /etc/php5/apache2/php.ini /etc/php5/apache2/php.ini-orig
sed -i "s/\(upload_max_filesize *= *\)\(.*\)/\120M/" /etc/php5/apache2/php.ini
echo "+----------------------------------------------------------------+"
echo "| Music on hold (symlink) |"
echo "+----------------------------------------------------------------+"
echo " Press <enter> to continue"
read
ln -s /var/lib/asterisk/moh /var/lib/asterisk/mohmp3
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
echo "+----------------------------------------------------------------+"
echo "| Changing apache user and group to 'asterisk' |"
echo "+----------------------------------------------------------------+"
echo " Press <enter> to continue"
read
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
echo "+----------------------------------------------------------------+"
echo "| MySQL |"
echo "+----------------------------------------------------------------+"
echo " Press <enter> to continue"
read
echo "create database asteriskcdrdb;" | mysql -u root
echo "create database asterisk;" | mysql -u root
echo "GRANT ALL PRIVILEGES ON asteriskcdrdb.* TO asteriskuser@localhost IDENTIFIED BY 'amp109';" | mysql -u root
echo "GRANT ALL PRIVILEGES ON asterisk.* TO asteriskuser@localhost IDENTIFIED BY 'amp109';" | mysql -u root
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/\(astrundir *=> *\)\(.*\)/\1\/var\/run\/asterisk/" /etc/asterisk/asterisk.conf
mkdir /var/run/asterisk
chown -R asterisk:asterisk /var/run/asterisk
echo "+----------------------------------------------------------------+"
echo "| Loading Asterisk Post Installation |"
echo "+----------------------------------------------------------------+"
echo " Press <enter> to continue"
read
/usr/sbin/asterisk
echo "+----------------------------------------------------------------+"
echo "| Modifying FreeBBX configuration files |"
echo "+----------------------------------------------------------------+"
echo " Press <enter> to continue"
read
#$webroot = "/var/www/html";
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 "+----------------------------------------------------------------+"
echo " Press <enter> to continue"
read
asteriskPID=$(cat /var/run/asterisk/asterisk.pid)
kill -9 $(cat /var/run/asterisk/asterisk.pid)
echo "+----------------------------------------------------------------+"
echo "| Remove Apache2 Redirect |"
echo "+----------------------------------------------------------------+"
echo " Press <enter> to continue"
read
sed -i "s/\(RedirectMatch*\)\(.*\)//" /etc/apache2/sites-enabled/000-default
echo "+----------------------------------------------------------------+"
echo "| Reload apache |"
echo "+----------------------------------------------------------------+"
echo " Press <enter> to continue"
read
/etc/init.d/apache2 restart
echo "+----------------------------------------------------------------+"
echo "| Changing permissions |"
echo "+----------------------------------------------------------------+"
echo " Press <enter> to continue"
read
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 |"
echo "+----------------------------------------------------------------+"
echo " Press <enter> to continue"
read
cp /var/www/admin/modules/dashboard/images/notify_* /var/www/admin/images/
echo "+----------------------------------------------------------------+"
echo "| Startup script (Asterisk+FrePBX) |"
echo "| /etc/init.d/freepbx [start|stop|restart] |"
echo "+----------------------------------------------------------------+"
echo " Press <enter> to continue"
read
STARTUP_SCRIPT="/etc/init.d/freepbx";
echo "Creating file ${STARTUP_SCRIPT} ...";
echo '#!/bin/bash' > ${STARTUP_SCRIPT}
echo '' >> ${STARTUP_SCRIPT}
echo 'AMPORTAL_BIN=/usr/local/sbin/amportal' >> ${STARTUP_SCRIPT}
echo '' >> ${STARTUP_SCRIPT}
echo 'if [ ! -x ${AMPORTAL_BIN} ]; then' >> ${STARTUP_SCRIPT}
echo ' echo "error : amportal binary can not be found (${AMPORTAL_BIN})"' >> ${STARTUP_SCRIPT}
echo ' exit 0' >> ${STARTUP_SCRIPT}
echo 'fi' >> ${STARTUP_SCRIPT}
echo '' >> ${STARTUP_SCRIPT}
echo '' >> ${STARTUP_SCRIPT}
echo 'start() {' >> ${STARTUP_SCRIPT}
echo ' echo "Starting FreePBX ..."' >> ${STARTUP_SCRIPT}
echo ' ${AMPORTAL_BIN} start' >> ${STARTUP_SCRIPT}
echo '}' >> ${STARTUP_SCRIPT}
echo '' >> ${STARTUP_SCRIPT}
echo 'stop() {' >> ${STARTUP_SCRIPT}
echo ' echo "Stopping FreePBX ..."' >> ${STARTUP_SCRIPT}
echo ' ${AMPORTAL_BIN} stop' >> ${STARTUP_SCRIPT}
echo '}' >> ${STARTUP_SCRIPT}
echo '' >> ${STARTUP_SCRIPT}
echo 'case "$1" in' >> ${STARTUP_SCRIPT}
echo ' start)' >> ${STARTUP_SCRIPT}
echo ' start' >> ${STARTUP_SCRIPT}
echo ' ;;' >> ${STARTUP_SCRIPT}
echo '' >> ${STARTUP_SCRIPT}
echo ' stop)' >> ${STARTUP_SCRIPT}
echo ' stop' >> ${STARTUP_SCRIPT}
echo ' ;;' >> ${STARTUP_SCRIPT}
echo '' >> ${STARTUP_SCRIPT}
echo ' restart)' >> ${STARTUP_SCRIPT}
echo ' stop' >> ${STARTUP_SCRIPT}
echo ' start' >> ${STARTUP_SCRIPT}
echo ' ;;' >> ${STARTUP_SCRIPT}
echo '' >> ${STARTUP_SCRIPT}
echo ' *)' >> ${STARTUP_SCRIPT}
echo ' echo $"Usage: $0 {start|stop|restart}"' >> ${STARTUP_SCRIPT}
echo ' exit 1' >> ${STARTUP_SCRIPT}
echo 'esac' >> ${STARTUP_SCRIPT}
echo '' >> ${STARTUP_SCRIPT}
echo 'exit 0' >> ${STARTUP_SCRIPT}
chmod 755 ${STARTUP_SCRIPT}
echo "Update services loading at boot time..."
update-rc.d freepbx defaults
echo "##################################################################"
echo "# PART 2 - FreePBX installation : Done #"
echo "### ---------------------------------------------------------- ###"
echo "# Press <enter> to continue #"
echo "##################################################################"
read
###################################################################################################
###################################################################################################
###################################################################################################
clear
echo "##################################################################"
echo "# PART 3 - Security #"
echo "### ---------------------------------------------------------- ###"
echo "# Press <enter> to continue #"
echo "##################################################################"
read
echo "+----------------------------------------------------------------+"
echo "| Change passwords for asterisk SQL user |"
echo "| > Change AMPDBPASS=amp109 in /etc/amportal.conf |"
echo "| > Change SQL PASSWORD |"
echo "+----------------------------------------------------------------+"
read -p "NEW asteriskuser SQL password ? " key
echo $key
sed -i "s/\(^AMPDBPASS=*\)\(.*\)/\1$key/" /etc/amportal.conf
echo "SET PASSWORD FOR 'asteriskuser'@'localhost' = PASSWORD('$key');" | mysql -u root
echo "+----------------------------------------------------------------+"
echo "| Change the default password for Asterisk Manager |"
echo "| > Change secret = amp111 in /etc/asterisk/manager.conf |"
echo "| > Change AMPMGRPASS=amp111 in /etc/amportal.conf |"
echo "+----------------------------------------------------------------+"
read -p "NEW Asterisk Manager password ? " key
echo $key
sed -i "s/\(^secret = *\)\(.*\)/\1$key/" /etc/asterisk/manager.conf
sed -i "s/\(^AMPMGRPASS=*\)\(.*\)/\1$key/" /etc/amportal.conf
echo "+----------------------------------------------------------------+"
echo "| ATTENTION : Do not forget to change the root user MySQL |"
echo "| password. By default it is blank |"
echo "| -------------------------------------------------------------- |"
echo "| SET PASSWORD FOR 'root'@'localhost' = PASSWORD('<password>'); |"
echo "+----------------------------------------------------------------+"
echo ""
echo "##################################################################"
echo "# PART 3 - Security : Done #"
echo "### ---------------------------------------------------------- ###"
echo "# Press <enter> to continue #"
echo "##################################################################"
read
clear
echo "+----------------------------------------------------------------+"
echo "| Asterisk with FreePBX installation is finish. |"
echo "| For running asterisk+freepbx you must be use this command : |"
echo "| # /etc/init.d/freepbx start |"
echo "| |"
echo "| !! NEVER LOAD ASTERISK DIRECTLY !! |"
echo "+----------------------------------------------------------------+"
echo "+----------------------------------------------------------------+"
echo "| Done, enjoy |"
echo "+----------------------------------------------------------------+"
habe die geänderten konfigurationsdatein schon mit
cp /etc/php5/apache2/php.ini-orig /etc/php5/apache2/php.ini
cp /etc/apache2/apache2.conf-orig /etc/apache2/apache2.conf
zurückgesetzt
Vielen Dank schon mal im voraus.