How do I completely remove and reinstall Samba on Debian?

10

My Samba installation has become a mess, and now the services won't even start correctly anymore, for some reason.

Is there a way to completely remove Samba, as if it was never there, and then reinstall it so I can have a fresh setup?

Jane Panda

Posted 2010-08-28T21:10:09.073

Reputation: 1 089

Answers

9

sudo apt-get purge samba

will remove the entire package, along with configuration files, which apt-get remove samba won't. After the purge, reinstall samba using

sudo apt-get install samba

from man apt-get:

purge
    purge is identical to remove except that packages are removed and
    purged (any configuration files are deleted too).

BloodPhilia

Posted 2010-08-28T21:10:09.073

Reputation: 27 374

Well it looks like that sort of worked, but now it seems to have hung on "Starting Samba daemons: nmbd smbd". I didn't see any errors before that, but to be fair it went by fairly quick, heh. – Jane Panda – 2010-08-28T21:58:44.573

1@Bob you may need a reboot – BloodPhilia – 2010-08-28T22:00:07.540

Awesome, that did the trick! I guess sometimes rebooting -does- work on *nixy stuff. Thanks! – Jane Panda – 2010-08-28T22:17:38.547

1@Bob Great it worked for you! Good luck with your fresh samba install! Haha! ;) – BloodPhilia – 2010-08-28T22:24:38.933

4

On Ubuntu (17) I did

apt purge samba samba-common

followed by

apt install system-config-samba

which worked for me.

loop

Posted 2010-08-28T21:10:09.073

Reputation: 41

2Debian 9.0 does not have a package called system-config-samba. But the hint of the package samba-common saved my day! So what I did was (as root) apt purge samba samba-common, apt --purge autoremove and finally apt-get install samba. – Antonio Vinicius Menezes Medei – 2017-08-10T17:18:25.550

This worked for me in Ubuntu 14.04 – Sanjok Gurung – 2019-01-28T10:17:55.200