Search code examples
amazon-elastic-beanstalkpackage-managerssshpass

How do I specify a repo for yum install in aws beanstalk file install_packages.config?


I need to install sshpass on my AWS beanstalk when it is deployed.

I created a new clone to check that I could do it from the ssh shell command line and found that unless I specified the epel repo, it would not find the package:

$ sudo yum -y install sshpass
Failed to set locale, defaulting to C
Loaded plugins: priorities, update-motd, upgrade-helper
amzn-main                                                                                                                                  | 2.1 kB  00:00:00
amzn-updates                                                                                                                               | 2.5 kB  00:00:00
No package sshpass available.
Error: Nothing to do

but this works:

$ sudo yum --enablerepo=epel -y install sshpass
Failed to set locale, defaulting to C
Loaded plugins: priorities, update-motd, upgrade-helper
1070 packages excluded due to repository priority protections
Resolving Dependencies
--> Running transaction check
---> Package sshpass.x86_64 0:1.06-1.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==================================================================================================================================================================
 Package                                Arch                                  Version                                   Repository                           Size
==================================================================================================================================================================
Installing:
 sshpass                                x86_64                                1.06-1.el6                                epel                                 20 k

Transaction Summary
==================================================================================================================================================================
Install  1 Package

Total download size: 20 k
Installed size: 34 k
Downloading packages:
sshpass-1.06-1.el6.x86_64.rpm                                                                                                              |  20 kB  00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : sshpass-1.06-1.el6.x86_64                                                                                                                      1/1
  Verifying  : sshpass-1.06-1.el6.x86_64                                                                                                                      1/1

Installed:
  sshpass.x86_64 0:1.06-1.el6

Complete!

So how would I do this in the .ebextensions/-1-packages/install-packages.config file? The syntax is defined in the AWS example as follows:

packages: 
  yum:
    libmemcached: [] 
    ruby-devel: []
    gcc: []
  rpm:
    epel: http://download.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
  rubygems: 
    chef: '0.10.2'

But I'm not sure how to implement that for my case where i just want to tell it to use the epel repo

packages:
  yum:
    ...
    ...
    sshpass: []

I'm guessing the above won't automatically cause it to use the epel repo?


Solution

  • There might be a better way, but this worked:

    commands:
      24-sshpass:
        command: "yum --enablerepo=epel -y install sshpass"