uninstalling on linux

2019-07-20 06:44发布

问题:

I'm new to compiling and installing programs on linux. I understand the common process is to do ./configure

make

make install

I'd like to know if there is some way I can "rollback" if I make a mistake somewhere or if something goes wrong.

回答1:

Agree with other answers, and I wanted to clarify a bit. If my understanding is correct, typically ./configure is a script that makes sure / sets up your system so that compilation will go correctly. Then make runs a Makefile that actually compiles. Then make install runs the makefile with install as a parameter that actually copies your binaries and config files to the appropriate (as determined by the script author) system directories, which is why often make install must be run with elevated privileges.

Often the make script takes an uninstall parameter that actually erases everything that was copied to system directories. In my experience, this isn't always going to be a clean process. There's no fireproof way to roll back without ensuring yourself that all changes are tracked perfectly and writing the rollback script yourself.

In short, try make uninstall and if that doesn't work and you can't figure it out yourself, try posting on a mailing list or forum pertaining to the particular product in question.

Edit for more info: just running make should get you everything you need to run a program, as long as you keep your working directory as wherever you ran make from. That is, make will create all your binaries and config files, etc, and you can use the software fine from that directory. You won't have any globally accessible binaries or proper environment variables, though, if you don't copy things to system directories, such as with make install. So if you're just trying to run a self-contained binary that isn't software that something else will rely on, you don't actually need to run make install and won't have to worry about rolling back. Everything will be contained within your original working directory.



回答2:

If make unistall does not make the trick then you have to remove the files on your own (except if there is an unistall script.

One good way to avoid all the mess is to use the checkinstall after installing something from source. This way it will create also a package file for your system meaning that you will be able to unistall the software from the package manager e.g. apt-get remove my_software.



回答3:

Check if Makefile script has

make uninstall

target. It is not unusual to find these.

Otherwise, you might need to check where stuff gets installed and have your own backout script.



回答4:

typically ./configure takes in various parameters.

So lets say you did a make and make install and then realized that you want to reconfigure your software, you will have to first uninstall it using uninstall scripts that the software provides.

make uninstall may also work.