Score:0

How to uninstall all software and files in Ubuntu server?

us flag

I have a Ubuntu Server. And over the course of time, I have installed countless apps like Apache, Minecraft server etc. but Now I need to uninstall all software and files in Ubuntu server except the OS, (like Factory reset in mobile)

Also, I am connected to the server using ssh so I don,t want my connection to break.

in flag
Depending on how long you’ve used the server, your entire installation history will be stored in the log files within `/var/log/apt`. Go through those and `sudo apt remove --purge {package}`. This will not give you a “fresh install”, but it will remove the apps and some of their configuration files.
Artur Meinild avatar
vn flag
By far the easiest solution will be to copy out/backup anything you need and reinstall the OS. There is no easy way to "factory reset" a running server.
Score:0
de flag

One option could be to uninstall just the main packages with apt remove --purge apache (for example) and do a apt autoremove --purge afterwards, which will remove automatically installed dependencies.

But there is still the possibility that there are modified config files in /etc or other files on the file system which needs to be deleted manually.

You can check the logs in /var/log/apt and the list of installed packages in dpkg -l.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.