6

I've got some errors, while trying to install the AWS code-deploy agent via :

wget https://bucket-name.s3.region-identifier.amazonaws.com/latest/install

./install auto

I know the AWS documentation said 16.04 or 18.04. But wondering if I am the first who tried it.

Traceback (most recent call last):
    8: from ./install:33:in `<main>'
    7: from ./install:33:in `new'
    6: from /usr/lib/ruby/2.7.0/logger.rb:389:in `initialize'
    5: from /usr/lib/ruby/2.7.0/logger.rb:389:in `new'
    4: from /usr/lib/ruby/2.7.0/logger/log_device.rb:18:in `initialize'
    3: from /usr/lib/ruby/2.7.0/logger/log_device.rb:83:in `set_dev'
    2: from ./install:21:in `method_missing'
    1: from ./install:21:in `map'
./install:22:in `block in method_missing': undefined method `path' for #<IO:<STDOUT>> (NoMethodError)

Would be nice if some one have a tip.

best and thx

mickmack
  • 93
  • 1
  • 6

3 Answers3

16

Apparently CodeDeploy is not yet compatible with Ubuntu 20.04 since the latter comes with ruby 2.7 while CodeDeploy supports max 2.5. There is a solution here which repacks the deb package to force the check to pass:

sudo su
apt-get update
apt-get install -y ruby
wget https://aws-codedeploy-us-east-1.s3.amazonaws.com/releases/codedeploy-agent_1.0-1.1597_all.deb
mkdir codedeploy-agent_1.0-1.1597_ubuntu20
dpkg-deb -R codedeploy-agent_1.0-1.1597_all.deb codedeploy-agent_1.0-1.1597_ubuntu20
sed 's/2.0/2.7/' -i ./codedeploy-agent_1.0-1.1597_ubuntu20/DEBIAN/control
dpkg-deb -b codedeploy-agent_1.0-1.1597_ubuntu20
dpkg -i codedeploy-agent_1.0-1.1597_ubuntu20.deb
systemctl start codedeploy-agent
systemctl enable codedeploy-agent
Khalid Hazam
  • 176
  • 1
  • 2
5

Not sure about 20.04 but I do have a fix for 22.04 in case someone needs. Here it is,

Installing Code deploy agent on ubuntu 22.04 EC2 Instance

Source:- Github discussions

!/bin/bash

# This installs the CodeDeploy agent and its prerequisites on Ubuntu 22.04.

sudo apt-get update

sudo apt-get install ruby-full ruby-webrick wget -y

cd /tmp

wget https://aws-codedeploy-us-east-1.s3.us-east-1.amazonaws.com/releases/codedeploy-agent_1.3.2-1902_all.deb

mkdir codedeploy-agent_1.3.2-1902_ubuntu22

dpkg-deb -R codedeploy-agent_1.3.2-1902_all.deb codedeploy-agent_1.3.2-1902_ubuntu22

sed 's/Depends:.*/Depends:ruby3.0/' -i ./codedeploy-agent_1.3.2-1902_ubuntu22/DEBIAN/control

dpkg-deb -b codedeploy-agent_1.3.2-1902_ubuntu22/

sudo dpkg -i codedeploy-agent_1.3.2-1902_ubuntu22.deb

systemctl list-units --type=service | grep codedeploy

sudo service codedeploy-agent status

Igor Parra
  • 10,214
  • 10
  • 69
  • 101
4

To install the latest version of the CodeDeploy agent on Ubuntu 20.04:

sudo ./install auto > /tmp/logfile

Note: Writing the output to a temporary log file is a workaround that should be used while AWS address a known bug with the install script on Ubuntu 20.04.

Source: https://docs.aws.amazon.com/codedeploy/latest/userguide/codedeploy-agent-operations-install-ubuntu.html