This was tested against a Ubuntu 16.04 virtual machine with Asterisk 13.22.0 and all commands were run from ~
sudo service asterisk stop sudo rm /etc/init.d/asterisk sudo rm /etc/init.d/asterisk.org sudo rm -rf /etc/asterisk/ sudo rm -rf /var/log/asterisk/ sudo rm -rf /var/lib/asterisk/ sudo rm -rf /var/spool/asterisk/ sudo rm -rf /usr/lib/asterisk/
All of the Asterisk program and configuration files will now be deleted and you should have seen a notice about needing to run
systemctl daemon-reload because the service files have been removed (they’re the ones from /etc/init.d/).
If you then
whereis asterisk you may still see some leftovers in a few other places which you can also delete. Here is where I found remaining files: