Thursday, March 17, 2022

[SOLVED] Git Large File Storage / How to install git lfs on AWS EC2 Linux 2 / "No package git-lfs available."

Issue

How to install git-lfs on an Amazon EC2 (Amazon Linux 2) instance?

Based on https://github.com/git-lfs/git-lfs/blob/main/INSTALLING.md did I tried:

sudo yum install git -y;
cd /home/ec2-user;
curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.rpm.sh | sudo bash
   -> which tells me afterwards: 
   The repository is setup! You can now install packages.
sudo yum install git-lfs
   -> gives me: 
   Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
   No package git-lfs available.
   Error: Nothing to do

Future commands (not possible yet duo git: 'lfs' is not a git command. See 'git --help'. after git lfs install) would than be based on https://git-lfs.github.com/

git lfs install
...
git clone https://yourrepo.git;

Amazon Linux 2 AMI (HVM) - Kernel 5.10, SSD Volume Type / Arm


Solution

With Amazon Linux 2, you can use the Extras Library to install application and software updates on your instances. These software updates are known as topics.

Below are the steps:

  1. Connect to your EC2 Linux instance using SSH.

  2. Use the which command to confirm that the amazon-linux-extras package is installed:

    $ which amazon-linux-extras

    /usr/bin/amazon-linux-extras

If the amazon-linux-extras package isn't installed, you can use yum to install it:

$ sudo yum install -y amazon-linux-extras

To list the available topics, you can use the following command:

$ amazon-linux-extras list
  1. git-lfs usually comes as part of the epel-release, so you need to first to install epel release for Amazon Linux:

    $ sudo amazon-linux-extras install epel -y

    For the Amazon Linux AMI, access to the Extra Packages for Enterprise Linux (EPEL) repository is configured, but it is not enabled by default.

    sudo yum-config-manager --enable epel

  2. Now you can install git-lfs or whatever else you like from epel-release:

    $ sudo yum install git-lfs



Answered By - Arpit Jain
Answer Checked By - Terry (WPSolving Volunteer)