How to uninstall Nginx (installed from source) on CentOS?

2

I compiled Nginx now I want to remove or uninstall it. How can I do that?

I usually don't install software by compiling it from source.

Hao

Posted 2011-05-11T06:48:46.360

Reputation: 375

Answers

4

By compile way of installing, do you mean "configure", "make" and "make install"?

If yes, you can go back to the same directory (that contains the source code) where you ran these make commands... You can then run "make uninstall" to uninstall the package..

You can see more detailed instructions to install and uninstall here:

http://articles.slicehost.com/2007/12/3/ubuntu-gutsy-installing-nginx-from-source

Note: Most package provide uninstall target, so that "make uninstall" works properly.. However, this may not always be true and uninstalling such programs might be a pain. For Nginx, it looks like uninstall target is provided and "make uninstall" works fine.

Vinay

Posted 2011-05-11T06:48:46.360

Reputation: 110

1tried "make uninstall" I got

"make: *** No rule to make target `uninstall'. Stop."

I followed the link you gave, shall I do:

rm -f -R /usr/local/nginx rm -f /usr/local/sbin/nginx

is it ok? – Hao – 2011-05-11T07:25:37.027

@Jusfeel: you need to run make uninstall from the directory in which you compiled nginx. – Lekensteyn – 2011-05-11T07:37:57.290

and next time use checkinstall to make a rpm and install it, rather than make install ;) – Journeyman Geek – 2011-05-11T07:46:48.227

I did make uninstall from the folder in which I compiled nginx. But seems there is no rule to make target "uninstall" - the message I got. What can I do now? – Hao – 2011-05-11T07:59:37.600

1Too bad that uninstall make target is not available for nginx. As @Lekensteyn suggested, you should always use checkinstall, instead of make install. For now, I guess the only option you have is to run "rm -f -R /usr/local/nginx rm -f /usr/local/sbin/nginx" to remove the files. I'm not sure if these are the only files that were created or whether there were more – Vinay – 2011-05-11T11:23:40.133

1@Vinay: JourneymanGeek suggested checkinstall. Another way to check which files would be created by make install is by printing the commands that would be run: make --dry-run install – Lekensteyn – 2011-05-11T11:29:45.560

Ah.. Sorry. My mistake. – Vinay – 2011-05-11T11:57:31.060

@It's not work for me, I just manually remove the related folder, hope add module can during the runtime, instead of recompile and install – mko – 2011-12-13T07:51:28.187