Uninstall asterisk

hello.anyone knows how to completely uninstall or remove asterisk from my system.i need to install a fresher bug free version.

Try deleting all asterisk directories, remove the script from /etc/init.d/ when your compile new version it create all again.

It is sometimes necessary to completely remove Asterisk for one machine, for example because you need to install a newer version.

Stop Asterisk and unload its modules
The first thing you have to do is to stop Asterisk and unload the modules it may be using, e.g Zaptel’s.

The following lines will brutally terminate Asterisk and kill all ongoing conversation. You have to kill safe_asterisk first, otherwise it will respawn Asterisk.

killall -9 safe_asterisk
killall -9 asterisk

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

[root@zebru]# 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. We’ll 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.

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, lik ethe log files or the configuration files.
star Remember: once you run these commands, there’s no turning back!

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 your Asterisk system has been completely removed.

kill -9 is a last resort and should never be used unless all other means have failed; people get into a bad habit of using it, because it does stop the program, but it can leave data, etc., in a mess. For a general installation, kill with no signal number (equivalent to kill -15) will cause a clean stop, in which calls in progress are cleanly, if abruptly, terminated.

On any RedHat like system, e.g. CentOS, the following should be sufficient:

service asterisk stop
service dahdi stop

or for older systems,

service zaptel stop

If you do make install from a source distribution, asterisk will normally take care of replacing everything except configuration files, although it may warn you of modules that need removing by hand. You will always have to review configuration files.

Hi david55,

Thanks for this additional information.

thank y’all for the help and advice.i think i was able to pull it off.Thanks again

great tutorial for beginners like me.