=========
Uninstall
=========

Begin by setting the AEN Functional ID (NFI). The NFI is the username of the AEN
Service Account which is used to run all AEN services and is also the username
of the AEN Admin account. The NFI may be any name. The default NFI is
``wakari``. The NFI is also often set to ``aen_admin``. The NFI (and AEN
Functional Group or NFG) are described in
:doc:`the installation instructions <index>`.

Set the NFI with this command::

    export AEN_SRVC_ACCT="wakari"

Replace the name wakari with the NFI that was set in your installation of Anaconda Enterprise Notebooks.

Server
======

To remove the Anaconda Enterprise Notebooks Server, execute the
following commands as ``root`` (or via ``sudo``) on the AEN *Server*
host system:

Stop the *Server* processes:

::

    service wakari-server stop

Stop MongoDB:

::

    service mongod stop

Remove AEN *Server* software, AEN database files, and ``nginx``
configuration:

::

    rm -Rf /opt/wakari/wakari-server
    rm -Rf /opt/wakari/miniconda
    rm -Rf /var/lib/mongo/wakari*
    rm -Rf /etc/nginx/conf.d/www.enterprise.conf

Note: remove ``/etc/nginx/conf.d/www.enterprise.https.conf`` if SSL is enabled on the *Server*

Restart MongoDB and Nginx:

::

    service mongod restart
    service nginx restart

Check for any outstanding AEN *Server* processes and stop them:

::

    ps -ef | grep -e wakari-server -e wk-server

Remove the AEN Service Account:

::

    userdel $AEN_SRVC_ACCT

Check for and remove any references to ``aen`` or ``wakari`` from the
``root`` user's ``.condarc`` file:

::

    grep -i aen ~/.condarc
    grep -i wakari ~/.condarc

Gateway
=======

To remove the *Gateway*, execute the following commands as ``root`` (or
via ``sudo``) on the *Gateway* host system:

Stop the *Gateway* processes:

::

    service wakari-gateway stop

Remove *Gateway* software:

::

    rm -Rf /opt/wakari/wakari-gateway

Check for any outstanding *Gateway* processes and stop them:

::

    ps -ef | grep -e wakari-gateway -e wk-gateway

Remove the AEN Service Account:

::

    userdel $AEN_SRVC_ACCT

Check for and remove any references to ``aen`` or ``wakari`` from the
``root`` user's ``.condarc`` file:

::

    grep -i aen ~/.condarc
    grep -i wakari ~/.condarc

Compute Node
============

To remove the *Compute* Node, execute the following commands as ``root``
(or via ``sudo``) on each *Compute* host system:

Stop the *Compute* processes:

::

    service wakari-compute stop

Remove *Compute* software:

::

    rm -Rf /opt/wakari/wakari-compute
    rm -Rf /opt/wakari/miniconda
    rm -Rf /opt/wakari/anaconda

Check for any outstanding *Compute* processes and stop them:

::

    ps -ef | grep -e wakari-compute -e wk-compute

Remove the AEN Service Account:

::

    userdel $AEN_SRVC_ACCT

Check for and remove any references to ``aen`` or ``wakari`` from the
``root`` user's ``.condarc`` file:

::

    grep -i aen ~/.condarc
    grep -i wakari ~/.condarc

OPTIONAL: If you want to remove all AEN *Projects* as well (this is an
extreme measure):

::

    rm -Rf /projects
