InstallScript icon indicating copy to clipboard operation
InstallScript copied to clipboard

uninstall script

Open icf20 opened this issue 8 years ago • 24 comments

is there any script to undo all the changes made by this script ?

icf20 avatar Oct 31 '17 19:10 icf20

That would be brilliant. A real time saver. For those who want to fast uninstall, and test run a new versions of the script. Without having to reinstall the OS, which takes a longer time.

chris001 avatar Oct 31 '17 21:10 chris001

No there isn't at the moment. Since you're not the first one to ask this I believe we should create one. @chris001 I'd love your feedback here. A new script next to the install script where you provide the parameters and it deletes everything?

Yenthe666 avatar Nov 01 '17 11:11 Yenthe666

@Yenthe666 For better maintainability, I vote for the same script, with the --uninstall command line parameter. It should be simple to get done, every command has its inverse/opposite!

chris001 avatar Nov 01 '17 16:11 chris001

Interesting and usable idea.

Remember also the "multi-Odoo" case in uninstaller. Does it make it too complex at this point?

Another alternative, that the "uninstall" simply uninstalls all instances of Odoo on that host. As long as user knows his stuff, I guess it's ok.

jpaulin avatar Dec 01 '17 11:12 jpaulin

@jpaulin

  1. I've implemented --uninstall in the script.
  • The way it works right now is, it will uninstall the one /home/odoo directory (default name), and delete the one odoo user (default name), these defaults come from the fixed parameters.
  • I'll add a command line parameter to allow for uninstall ALL odoo on a multi-odoo case.
  1. I've implemented --delete-start-over
  • This uninstalls the one /home/odoo directory and user odoo, and creates a new user odoo (the username is in the fixed parameters). This is great for when you want to run the installer on an empty server, as non-root user, odoo.
  • This will also get updated to accept all command-line parameters for username, etc., and handle the mutl-odoo case.

chris001 avatar Dec 01 '17 16:12 chris001

@chris001 Thanks :) Will check it. Don't you guys think this issue should be closed as uninstall has been implemented?

bishisht avatar Jan 05 '18 15:01 bishisht

@bishisht nope, as it is only just a PR at this point and it hasn't been merged in with my 'official' branches. So, this is still relevant.

Yenthe666 avatar Jan 05 '18 15:01 Yenthe666

@Yenthe666 I think you should merge this asap. :) Its good feature. :)

bishisht avatar Jan 12 '18 03:01 bishisht

@bishisht we're working on it. It asks quite some time from @chris001 to fix/change and add features and quite some time for me to double check and give feedback too. Give us some time, it'll be worth it 😉

Yenthe666 avatar Jan 12 '18 07:01 Yenthe666

yes i vote to add this feautre too

tamer-badawy avatar May 29 '18 14:05 tamer-badawy

@Yenthe666 is the feature added?

lalitsharmaprofile-work avatar Feb 27 '19 11:02 lalitsharmaprofile-work

Hi - no haven't gotten around to it (yet).

Yenthe666 avatar Feb 27 '19 12:02 Yenthe666

Hi all, I have also been facing the same issue with uninstalling from an ubuntu 16.04 deployment. I would also vote for the addition of this feature if possible in the main install script (like a roll back feature) so one would not have to worry too much about multi installations being affected. any thoughts?

sablematrix avatar Apr 18 '19 10:04 sablematrix

Over the last few days I installed community edition first - worked OK. Then ran script again to try Enterprise Ed. - it Failed no idea why - been trying (with no success ever since to get either of them working but for some reason I cannot remove and re-install it all looks OK doesn't show any error but the service isn't running..

I could really use a proper uninstall at this point

Stewart-odoo avatar Oct 10 '19 14:10 Stewart-odoo

Here is it >>

Stop service

sudo service odoo-server stop sudo pkill -u odoo

Remove config file(s)

sudo rm -f /etc/odoo-server.conf sudo rm -f /etc/odoo.conf

Remove application code

sudo rm -R /odoo

Remove startup process

sudo update-rc.d -f odoo-server remove sudo rm -f /etc/init.d/odoo-server

Remove logs

sudo rm -R /var/log/odoo

Remove databases

sudo service postgresql stop sudo apt-get remove postgresql -y sudo apt-get --purge remove postgresql* -y sudo rm -r -f /etc/postgresql/ sudo rm -r -f /etc/postgresql-common/ sudo rm -r -f /var/lib/postgresql/

Delete users and groups

sudo userdel -r postgres sudo groupdel postgres sudo userdel -r odoo sudo groupdel odoo

mfhm95 avatar Jun 17 '20 01:06 mfhm95

Thanks!

On Wed, 17 Jun 2020 at 03:16, mohamed fouad [email protected] wrote:

Here is it >> Stop service

sudo service odoo-server stop sudo pkill -u odoo Remove config file(s)

sudo rm -f /etc/odoo-server.conf sudo rm -f /etc/odoo.conf Remove application code

sudo rm -R /odoo Remove startup process

sudo update-rc.d -f odoo-server remove sudo rm -f /etc/init.d/odoo-server Remove logs

sudo rm -R /var/log/odoo Remove databases

sudo service postgresql stop sudo apt-get remove postgresql -y sudo apt-get --purge remove postgresql* -y sudo rm -r -f /etc/postgresql/ sudo rm -r -f /etc/postgresql-common/ sudo rm -r -f /var/lib/postgresql/ Delete users and groups

sudo userdel -r postgres sudo groupdel postgres sudo userdel -r odoo sudo groupdel odoo

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Yenthe666/InstallScript/issues/67#issuecomment-645090111, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANN4XY3G7EUTNO2QKVCFOH3RXAKNTANCNFSM4EBVHLMQ .

Stewart-odoo avatar Jun 17 '20 11:06 Stewart-odoo

Hello EveryOne I have problem after installation of odoo using scripts my postgresl is now activate(exited) Please I need your helper Screenshot from 2020-10-15 14-30-10

gikwereresteven avatar Oct 15 '20 12:10 gikwereresteven

Try a restart. Don't hijack other issues that are unrelated though, start a new issue with details.

Yenthe666 avatar Oct 15 '20 12:10 Yenthe666

I try many times but there still the same issues Sir last time was working well.

gikwereresteven avatar Oct 15 '20 13:10 gikwereresteven

Again, create a ticket with clear steps/info/logs. Don't spam an unrelated thread with this.

Yenthe666 avatar Oct 15 '20 13:10 Yenthe666

Yes I create it Sir

On Thu, Oct 15, 2020 at 3:12 PM Yenthe Van Ginneken < [email protected]> wrote:

Again, create a ticket with clear steps/info/logs. Don't spam an unrelated thread with this.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Yenthe666/InstallScript/issues/67#issuecomment-709315174, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJWGPC7IQ2T5XKL4FEAHBCLSK3YMRANCNFSM4EBVHLMQ .

gikwereresteven avatar Oct 15 '20 13:10 gikwereresteven

Hey guys I was inspired by mfhm95 to make this. Takes all the steps and runs them in a bash script. https://github.com/tunahorse/Odoo_UninstallScript

tunahorse avatar May 09 '23 16:05 tunahorse

Stuff like sudo apt-get remove postgresql -y is really dangerous though :) What if there is something else running on PSQL?

Yenthe666 avatar May 10 '23 06:05 Yenthe666

Stuff like sudo apt-get remove postgresql -y is really dangerous though :) What if there is something else running on PSQL?

Good point. I updated the script to ask the user, if they just want to nuke PSQL or remove a specific db.

Step 6: Remove databases
green "Would you like to remove PostgreSQL completely or just a specific database? [COMPLETE/DB_NAME]: "
read -r db_choice

if [[ $db_choice == "COMPLETE" ]]; then
 green "Removing PostgreSQL..."
 sudo service postgresql stop
 sudo apt-get remove postgresql -y
 sudo apt-get --purge remove postgresql* -y
 sudo rm -r -f /etc/postgresql/
 sudo rm -r -f /etc/postgresql-common/
 sudo rm -r -f /var/lib/postgresql/
else
 green "Removing the database $db_choice..."
 sudo su - postgres -c "psql -c \"SELECT pg_terminate_backend(pg_stat_activity.pid) FROM pg_stat_activity WHERE pg_stat_activity.datname = '$db_choice' AND pid <> pg_backend_pid();\""
 sudo su - postgres -c "psql -c \"DROP DATABASE $db_choice;\""
fi

tunahorse avatar May 17 '23 19:05 tunahorse