Reputation: 3698
Is uninstalling Chef-Client just as easy as removing the directory, and making sure its not in the rc files? Is there a way to use knife to uninstall chef-client?
--2013-06-26_EDIT--
Updating this question to say, how to remove chef and all its other pieces from OS X, and Linux after using 1.) The Omnibus installer, and 2.) A bootstrapped node? Since I was trying to use Chef on my Mac, and had RVM installed, chef would not work, so now, I need to figure out how to remove chef.
--2015-03-08 EDIT --
Seems Opscode has put out their own instructions for uninstalling ChefDK. As far as the agent goes, it'd be the same method, using the package manager, or Add/Remove Programs.
http://docs.chef.io/install_dk.html#uninstall
Upvotes: 26
Views: 45782
Reputation: 3753
Execute the below series of commands as a root user:
On Ubuntu/Debian:
dpkg -P chef;
rm -rf /opt/chef /var/chef /etc/chef;
for P in /usr/bin/chef-*; do [ -e "$P" ] && sudo rm -f "$P"; done;
rm -rf /usr/bin/knife /usr/bin/ohai /usr/bin/chef;
This is also a solution for the error below that occurs during the bootstrap process on Ubuntu [because of the presence of old version of chef-client]
ERROR: Cannot find a resource for apt_update on ubuntu version 14.04
On RHEL/CentOS:
rm -rf /opt/chef; rm -rf /etc/chef;
for P in /usr/bin/chef-*; do [ -e "$P" ] && sudo rm -f "$P"; done
rpm -qa | grep chef-server | xargs yum erase -y;
userdel -f chef_server; userdel -f opscode-pgsql;
rm -rf /usr/bin/knife /usr/bin/ohai /usr/bin/chef /opt/chef-server/ /var/chef/ /var/opt/chef-server/ /var/log/chef-server/ /etc/chef /etc/chef-server/ /etc/chef /etc/chef-server/;
Upvotes: 4
Reputation: 3698
To help answer my own question, I found that depending on how you install Chef, depends on how you uninstall it. You can do the:
Redhat/CentOS
rpm -qa *chef*
yum remove <package>
Or if you installed it with ruby gems:
gem uninstall chef-<version>
However, for using an Omnibus installer, there wasn't an RPM package, and on my Mac OSX 10.6.8, I couldn't find anything about it. So, I realized that chef is self-contained, so I just deleted the directory in the /opt/
directory. Once I did that, I was able to use my RVM Ruby's.
--2015-03-08--
Opscode provides their own instructions for uninstalling ChefDK, and the Agent.
http://docs.chef.io/install_dk.html#uninstall
Upvotes: 22
Reputation: 418
I came across this when trying to figure out how to remove chef from a cloud server (Ubuntu in this case). I used chef to configure a machine, but I want to bake an image and not have chef on it. So for those looking for similar
To remove chef-client that was installed in omnibus fashion:
sudo rm -rf /opt/chef
(This is where most of it is)sudo rm -rf /etc/chef
(Hints and the like for the chef-client)for P in /usr/bin/chef-*; do [ -e "$P" ] && sudo rm -f "$P"; done
(links for chef commands)sudo rm -f /usr/bin/knife /usr/bin/ohai /usr/bin/chef
(other links to chef commands)Upvotes: 8
Reputation: 733
If you're on debian/ubuntu (or a system with dpkg) just check the status of the package:
dpkg --list | grep chef # or dpkg --status chef
then purge (see man dpkg):
dpkg -P chef
Upvotes: 11