Monday, July 23, 2007

Uninstall Asterisk , remove Asterisk when needed

If you are like me, you will have Asterisk complied many many times over. I have gone through various Linux distro's and various Asterisk versions. May be it is other lib's that forces me to recompile or test out some new hardware.
What ever the reason I do it and assumed that others might be interested in it. I got this from ASTRecipes and follow the link at the bottom for many other Asterisk related trick tools and recipes!. Lets say we need to uninstall Asterisk because you need to install a newer version.

First you need stop Asterisk and unload its modules that it may be using, e.g Zaptel's.

The following lines will brutally terminate Asterisk and kill all ongoing conversation. But there is a method to the madness, you have to kill safe_asterisk first, otherwise it will re spawn Asterisk. ( The safe_asterisk script is the preferred way to run Asterisk for most of us. This script starts Asterisk and monitors it to make sure it is still running. If the Asterisk process dies, the script will attempt to restart it.)

killall -9 safe_asterisk
killall -9 asterisk

Then you'll have to unload the Zaptel drivers; check which ones are loaded by issuing a:

# lsmod | grep zaptel
zaptel 214820 2 wcfxo,wctdm
crc_ccitt 2113 1 zaptel

This means that the submodules wcfxo and wctdm are loaded for zaptel. You will have to remove them in reverse order:

modprobe -r wcfxo
modprobe -r wctdm
..repeat for all zaptel submodules....
modprobe -r zaptel

If you repeat the lsmod | grep zaptel command now, it should find nothing.

Now to Delete Asterisk files
By running the commands below, you will delete with no possible recovery an Asterisk system. First make a backup of things you'd like to keep, like the log files or configuration files. Because once you issue the following commands, everything will be gone. Unless you are a good data recovery person, it is hard to get these files back. Basically you can't!

rm -rf /etc/asterisk

rm -f /etc/zaptel.conf

rm -rf /var/log/asterisk

rm -rf /var/lib/asterisk

rm -rf /var/spool/asterisk

rm -rf /usr/lib/asterisk

Now Asterisk has been removed from your system and it is time to read those installation instructions and install the new Asterisk version.

ASTRecipes

0 comments:

Blog Widget by LinkWithin