Page 1 of 1

Properly uninstall vestacp in centos

Posted: Fri Jan 09, 2015 6:38 pm
by mattluu
Sorry I don't know where to put this topic . Can moderators help me move it to right place please?

Here is my problem. I'm writing a script that used for automatically install, uninstall, check version, start, stop... for vestacp and its components like mysql, postgre, memcached ....

When I tried to test uninstalling vestacp on my CentOS 6.5 , I checked service after uninstalling with steps on vesta's document. But later I found out that mysqld, named, exim, messagebus ... were still running. They were all program installed by vesta. And iptable still had some lines like fail2ban, vesta-iptables... I couldn't reinstalling vesta too because it said me those services still running.

So I decied to uninstalled them and reset my iptables . Here is the script

Code: Select all

service "vesta" stop
# kill named process
kill "$(pgrep named)"
yum -y remove vesta*
rm -f /etc/yum.repos.d/vesta.repo
# PACKAGES is an array i made with "httpd","apache","fail2ban","mysqld""nginx","dovecot","vsftpd","exim","messagebus" to check if they still exists after uninstalling vesta
for i in "${PACKAGES[@]}"; do
      service.exists $i && service $i stop >/dev/null && writeln "Unistalling $i" && yum -y remove $i
done
# delete admin user and cronjobs
passwd -l admin >/dev/null
crontab -r -u admin >/dev/null
userdel -r admin
rm -f /home/admin
# reset iptables rules
iptables --flush && service iptables save && service iptables stop && service iptables start && iptables --list
rm -rf /usr/local/vesta >/dev/null
Everytime I executed this function, I lost connection to my vps through putty, and couldn't access to vps anymore. So I had to reinstall the vps 's OS.

Could you please point me out why I got those errors and show me how to improve my script for a chance a centos user want to reinstall their vestaCP but can't uninstall properly?

Thank you in advance

Re: Properly uninstall vestacp in centos

Posted: Fri Jan 09, 2015 8:49 pm
by sim
You probably forgot that default policy is DROP for INPUT in iptables. As soon as you clear rule allowing SSH traffic it's gone.

Issue this command:

Code: Select all

iptables --policy INPUT ACCEPT
Before clearing all rules

Re: Properly uninstall vestacp in centos

Posted: Sat Jan 10, 2015 6:44 am
by mattluu
sim wrote:You probably forgot that default policy is DROP for INPUT in iptables. As soon as you clear rule allowing SSH traffic it's gone.

Issue this command:

Code: Select all

iptables --policy INPUT ACCEPT
Before clearing all rules
Thank you so much :D