1 (edited by romeu 2016-03-01 23:17:58)

Topic: Wipe iRedMail 0.9.4 at Ubuntu

======== Required information ====
- iRedMail version (check /etc/iredmail-release): 0.9.4
- Linux/BSD distribution name and version: Ubuntu 14.04
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MySQL
- Web server (Apache or Nginx): Apache
====

Recently I was installing iRedMail at a VPS where I don't have the reinstall OS option at its control panel. I messed up the installation, cancelled too late, with apt-get install already, had to fix dpkg and got a very dirty unstable result.
So I made a small script to wipe iRedMail to reinstall it as clean as I could.

Please note: This script will wipe ALL your MySQL databases and Apache configs, if you've those installed for other purposes, make sure to backup your configuration and databases!!

#!/bin/sh

PURGE="apache2* postfix* dovecot* mysql* php* libapache2* clamav* amavis* spamassassin spamc roundcube"

apt-get purge $PURGE
apt-get autoremove
apt-get autoclean
rm /etc/ssl/certs/iRedMail.crt
rm /etc/ssl/private/iRedMail.key

rm -R /var/vmail
rm -R /etc/apache2
rm -R /opt/*
rm -R /etc/php5
rm -R /etc/postfix
rm -R /etc/dovecot
rm -R /var/lib/mysql
rm -R /etc/mysql
rm -R /etc/clamav
rm /etc/logrotate.d/clamav
rm -R /etc/amavis
rm -R /etc/mail/spamassassin

NOTES: Adjust the PURGE var with the packages you may had install with iRedMail, such as sogo, fail2ban, nginx or awstats (I didn't install those) and add the needed "rm -R path to config files" for those.

Manual steps:
Remove /var/spool/cron/crontabs/amavis
cat /dev/null > /var/spool/cron/crontabs/root

Remove the iRedMail install folder (rm -R iRedMail..... the place where you extracted it to) and untar again from the bzip file.

Final note: Use this *ONLY* if you came to a situation where you got a messy iRedMail installation and can't reinstall the OS! Also make sure to not use it at a server that is already in production with some other services - webserver, ircd, ftpd and so on!

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: Wipe iRedMail 0.9.4 at Ubuntu

Thanks for sharing.

It's recommended to reinstall OS if possible to get a clean/fresh server, to avoid possible installation failure.