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

误删codedeploy-agent文件夹后无法重新安装或卸载该组件的解决方案求助

Fixing CodeDeploy Agent Reinstallation/Uninstallation After Deleting /opt/codedeploy-agent

The core problem here is that the RPM's pre-uninstall script is failing because it tries to stop the CodeDeploy agent via the init script, which depends on the deleted /opt/codedeploy-agent/ directory. We need to bypass that broken script first, then clean up remnants before doing a fresh install.

Step 1: Force Remove the Broken RPM

Since the pre-uninstall script is blocking the uninstall, we'll use rpm to remove the package without executing any pre/post scripts:

sudo rpm -e --noscripts codedeploy-agent-1.3.2-1902.noarch

(Make sure to use the exact package name from your error message—yours is codedeploy-agent-1.3.2-1902.noarch)

Step 2: Clean Up Leftover Files

Remove any remaining directories or files that might interfere with a fresh install:

sudo rm -rf /opt/codedeploy-agent/
sudo rm -rf /etc/init.d/codedeploy-agent
sudo rm -rf /var/log/aws/codedeploy-agent/
sudo rm -rf /etc/codedeploy-agent/

Step 3: Reinstall the CodeDeploy Agent

Now we can perform a clean install. Choose one of these methods:

Method A: Using the Official Install Script

  1. Download the install script for your AWS region (replace us-east-1 with your actual region):
    sudo wget https://aws-codedeploy-us-east-1.s3.us-east-1.amazonaws.com/latest/install
    
  2. Make the script executable:
    sudo chmod +x ./install
    
  3. Run the install with the --override flag to force installation (ignores cached version checks):
    sudo ./install auto --override
    

Method B: Install Directly from RPM

  1. Fetch the latest agent version number:
    curl https://aws-codedeploy-us-east-1.s3.us-east-1.amazonaws.com/latest/LATEST_VERSION
    
  2. Download the corresponding RPM (replace <VERSION> with the output from the previous command):
    sudo wget https://aws-codedeploy-us-east-1.s3.us-east-1.amazonaws.com/latest/codedeploy-agent-<VERSION>.noarch.rpm
    
  3. Install the RPM:
    sudo rpm -ivh codedeploy-agent-<VERSION>.noarch.rpm
    

Verify the Installation

After installation, confirm the agent is running:

sudo service codedeploy-agent status

You should see a message indicating the agent is active and running.

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.04.27 17:38:12