CentOs 6.3 can't install Git

drivard asked:

I am trying to install git on an OpenVZ container using the CentOs 6.3 precreated template.
When I try the command line

yum install git

I get the message:

Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: www.cubiculestudio.com
 * epel: mirror.csclub.uwaterloo.ca
 * extras: www.cubiculestudio.com
 * rpmforge: mirror.us.leaseweb.net
 * updates: www.cubiculestudio.com
Setting up Install Process
No package git available.
Error: Nothing to do

As I understand, the git package should be in the centos6 base repository:
http://pkgs.org/centos-6-rhel-6/centos-rhel-x86_64/git-1.7.1-2.el6_0.1.x86_64.rpm.html

But it doesn’t find it, I even have the EPEL and RPMForge repo enabled, but still can’t find the git package.

yum repolist
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: www.cubiculestudio.com
 * epel: mirror.csclub.uwaterloo.ca
 * extras: www.cubiculestudio.com
 * rpmforge: mirror.us.leaseweb.net
 * updates: www.cubiculestudio.com
repo id                           repo name                                                           status
base                              CentOS-6 - Base                                                     4,776
epel                              Extra Packages for Enterprise Linux 6 - i386                        6,523
extras                            CentOS-6 - Extras                                                       4
rpmforge                          RHEL 6 - RPMforge.net - dag                                         4,501
updates                           CentOS-6 - Updates                                                    596
vz-base                           vz-base                                                                 3
vz-updates                        vz-updates                                                              0
repolist: 16,403

The weirdest thing is that my OpenVZ server is running on CentOs 6.3 and I was able to install git without any issue.

Can you help me understanding why it doesn’t find the package?

Thank you in advance.

My answer:


Your VPS provider has disabled the default CentOS repositories and replaced them with repos which do not actually provide access to the base system packages. This seems to be a common OpenVZ configuration issue.

I worked around it by:

  1. Deleting any file in /etc/yum.repos.d which referenced VZ repositories.
  2. Getting a clean copy of the latest centos-release RPM and installing that over the existing one:

    rpm -Uvh --replacefiles --replacepkgs centos-release-6*.rpm
    

The long-term solution is probably to stop using OpenVZ. I have yet to find a single public OpenVZ provider which manages to run a decent configuration.


View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.