You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在CentOS 7(EC2实例)中完全卸载Puppet服务端及客户端?

彻底卸载CentOS 7(含EC2实例)上的Puppet服务端与客户端

Got it, let’s walk through completely wiping Puppet from your CentOS 7 system (including EC2 instances) — partial uninstalls are super common when folks miss hidden configs or leftover services, so we’ll cover every loose end here.

卸载Puppet客户端(Agent)

Start with stopping and disabling the agent service to avoid it running mid-uninstall:

  • Stop the puppet agent: systemctl stop puppet
  • Disable it from starting on boot: systemctl disable puppet
  • Remove the agent packages (cover all common package names): yum remove -y puppet puppet-agent puppet-release

Next, delete all leftover config, data, and log directories — these are often what cause "residual" Puppet issues:

  • rm -rf /etc/puppet/ /var/lib/puppet/ /var/log/puppet/
  • If you installed via Puppet Labs official repo, clean up their dedicated directory: rm -rf /opt/puppetlabs/

卸载Puppet服务端(Master/Server)

For servers, we need to handle the puppetservice specifically:

  • Stop the puppetserver service: systemctl stop puppetserver
  • Disable auto-start: systemctl disable puppetserver
  • Remove server-related packages: yum remove -y puppetserver puppet-server puppet puppet-release

Now wipe server-specific data (including SSL certificates, which are a big one for leftover traces):

  • rm -rf /etc/puppetlabs/ /var/lib/puppetlabs/ /var/log/puppetlabs/
  • Clear old SSL certs (if you had a CA setup): rm -rf /var/lib/puppet/ssl/

通用残留清理(适用于客户端和服务端)

Even after removing packages, there might be loose ends to tie up:

  1. Clean up YUM repos: If you added Puppet’s official repo, delete the repo file: rm -rf /etc/yum.repos.d/puppet*.repo
  2. Clear YUM cache: yum clean all
  3. Check for stray processes: Run ps aux | grep puppet — if any processes show up, kill them with kill -9 <pid> (replace <pid> with the process ID from the output)
  4. EC2-specific check: If you used cloud-init or user data to install Puppet on your EC2 instance, double-check these files to make sure Puppet isn’t set to reinstall on reboot:
    • /var/lib/cloud/instance/user-data.txt
    • /etc/cloud/cloud.cfg
      Remove any lines that reference Puppet installation if present.

验证卸载完成

To make sure everything’s gone, run these checks:

  • rpm -qa | grep puppet — should return no results
  • systemctl list-unit-files | grep puppet — should show no enabled/disabled Puppet services
  • Check that all the directories we deleted earlier don’t exist anymore

If you tried uninstalling before and it didn’t stick, this full cleanup should fix it — most partial uninstalls miss the SSL certs or /opt/puppetlabs/ directory.

内容的提问来源于stack exchange,提问作者envalentine

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.19 03:59:21