This article will outline how to completely uninstall an Odoo instance from an Ubuntu VPS.
Step 1: Stop the Odoo Service
You will first need to stop the Odoo service from running on the machine. To do this, use this command
sudo service "service-name" stop
Make sure to replace the "service-name" placeholder with the name the Odoo service was assigned.
Step 2: Remove all Odoo Files
The next step is to remove the entire Odoo repository which will remove all the application code files. Use this command to do this.
sudo rm -R /opt/odoo
Step 3: Remove Configuration files
The next step is to remove all application configuration files that the Odoo instance used. Use these commands to achieve this.
sudo rm -f /etc/odoo.conf
sudo rm -f /etc/odoo/odoo.conf
sudo rm -f /etc/odoo-server.conf
The second and third commands check for and remove extra config files that might have been created. The following commands will remove the Odoo startup process.
sudo update-rc.d -f "service-name" remove
rm -f /etc/init.d/"service-name"
Make sure to replace the "service-name" placeholder with the name the Odoo service was assigned.
Step 4: Remove log files
Next, we're going to remove all of Odoo's log files. You can skip this step if you want to keep the log files. Use this command.
rm -R /var/log/odoo
Step 5: Remove User and User group for PostgreSQL
Use the following commands to remove the system database user and user group before we actually remove the database.
sudo userdel -r postgres
sudo groupdel postgres
Step 6: Remove the PostgreSQL Database
The last step is to remove all databases and database services. Use the following commands.
sudo service postgresql stop
apt-get remove postgresql -y
apt-get --purge remove postgresql\* -y
rm -r -f /etc/postgresql/
rm -r -f /etc/postgresql-common/
rm -r -f /var/lib/postgresql/
Congratulations! You have successfully uninstalled Odoo from your Ubuntu machine.