Is it necessary to uninstall first before updating .deb package?
Solution 1:
-
No, you don't have to remove previously installed one.
-
However, it depends on the package quality. Myself I don't uninstall first only if I already faced a problem.
The normal update installation just remove the previous keeping the configuration files then install new one.
dpkg
will ask you to overwrite or keep previous config file if it is in/etc
and they are different.If I'm going to remove 1st then I do purge instead that will remove all files including the configuration ones.
dpkg -P package... dpkg --purge package...
-
This post shows the upgrade flow diagram: https://askubuntu.com/a/1116587/26246
-
Upstream documentation here: https://www.debian.org/doc/debian-policy/ap-flowcharts.html
Solution 2:
You do not need to uninstall the package. If you run
dpkg -i some-package-v2.deb
the old version will be replaced by the new one. All files will be overwritten. This is a normal way to upgrade a package without using repositories.