Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a RHEL 6.4 VM provisioned by my companies internal KVM.

We are having some trouble using yum (Cannot retrieve repository metadata, which Ive confirmed in this case is peculiar to my company's internal cloud), so I have to build Git from source.

EDIT #1:

Downloading the RPM file and issuing

sudo yum localinstall ....rpm

Gives me the same Cannot retrieve repository metadata error


sudo rpm -ivh ....rpm

Fails with an error: Failed dependencies and then lists all the packages I need to install. I assume I could find the download links for all of them, but I've tried this before and was unable to find the d/l links for the right versions for the right packages.

EDIT #2:

The following code actually works, thanks to @slm's answer:

wget ftp://fr2.rpmfind.net/linux/dag/redhat/el6/en/x86_64/extras/RPMS/perl-Git-
wget http://pkgs.repoforge.org/git/git-
rpm -ivh perl-Git- git-

If I just download the git code, untar it, and build it, like:

wget https://www.kernel.org/pub/software/scm/git/git-1.8.5.tar.gz
tar -xvf git-1.8.5.tar.gz
cd git-1.8.5
make install

I receive the following error when cloning from the http:// protocol:

fatal: Unable to find remote helper for 'http'

Googling told me that I needed curl-devel and expat. I can not use yum, so I went and built those as well:

cd ..
wget http://curl.haxx.se/download/curl-7.34.0.tar.gz
tar -xvf curl-7.34.0.tar.gz
cd curl-7.34.0
make install

cd ..
wget http://downloads.sourceforge.net/expat/expat-2.1.0.tar.gz
tar expat-2.1.0.tar.gz
cd expat-2.1.0
make install

However, upon rebuilding Git, I receive the same error. After Googling more I determined that I needed to pass the following parameters to Git's ./configure:

cd git-1.8.5
./configure --with-curl=<curl_install_path> --with-expat=<expat_install_path> 

However, I couldn't determine where the curl and expat install paths were located.

So what I did instead was build Git, curl, and expat using the ./configure --prefix=/path/to/desired/install/path

mkdir curl
cd curl-7.34.0
./configure --prefix=/home/downloads/curl
mkdir expat
cd expat-2.1.0
./configure --prefix=/home/downloads/expat
mkdir git
cd git-1.8.5
./configure --prefix=/home/downloads/git --with-curl=/home/downloads/curl --with-expat=/home/downloads/expat

and from this I was able to clone with Git from the http protocol. However this violates the linux file structure.

2 Questions:

  1. When building Git from source, you need to include the curl and expat install paths to ./configure. Where are these install paths when installing curl and expact without the prefix argument?
  2. I learned that I needed curl and expact's install paths when I got an error and searched for it. Are there any other programs I need to tell Git so I don't get errors in the future?
share|improve this question
another option might be simply using an ssh url instead of a http url. – michas Jan 4 '14 at 2:57
up vote 3 down vote accepted

I think I would suggest not installing these items from source directly but rather harness the power of your package manager to still maintain these packages.

locally installing

You can use a command line tool such as curl or wget to still download the packages necessary to install them either using yum or rpm directly.

$ sudo yum localinstall some.rpm
$ sudo rpm -ivh some.rpm

I would suggest looking to the repositories RepoForge as well as EPEL for RPMs. For example the git packages are here.

A simple command in the terminal will download it:

$ wget http://pkgs.repoforge.org/git/git-

Rebuilding a source RPM

On the off chance you have to have the latest versions, you can still make use of RPMs but rather than download the .rpm version of a package, you'll want to get the .src.rpm version. These can be rebuilt using the following command:

$ rpmbuild --rebuild some.src.rpm

Rebuilding a tar.gz using a donor source RPM

You can also take your .tar.gz tarballs and reuse the .spec file that's included in the above .src.rpm. You do this through the following commands.

$ mkdir -p ~/rpm/{BUILD,RPMS,SOURCES,SPECS,SRPMS,tmp}

Then create a ~/.rpmmacros file.

%packager Your Name
%_topdir /home/YOUR HOME DIR/rpm
%_tmppath /home/YOUR HOME DIR/rpm/tmp

Now we're ready to "install" the donor .src.rpm.

$ rpm -ivh some.src.rpm

This will deposit a tarball and a .spec file in your ~/rpm directories. You can then edit this .spec file and replace the tarball with the newer one.

Now to rebuild it:

$ rpmbuild -ba ~/rpm/SPECS/some.spec

This will create a .rpm and a new .src.rpm file once it's complete.

Additional tips

You can use the tool yum-builddep to make sure you have all the required RPMs installed before getting started.

$ sudo yum-builddep some.src.rpm
share|improve this answer
Thanks for the response. However, my yum isn't working. sudo yum localinstall ....rpm gave me the same yum error as usual (Cannot retrieve repository metadata). sudo rpm -ivh ....rpm gave me `error: Failed dependencies: <package_name> is needed by git-all' I'll try the src method. – Matthew Moisen Jan 4 '14 at 3:38
@MatthewMoisen - you need to download all the required .rpm files and do a sudo rpm -ivh 1.rpm 2.rpm 3.rpm.... – slm Jan 4 '14 at 3:42
@MatthewMoisen - I caution you I've been dealing with this stuff for 20+ years. Compiling these from source can be painful, more so than dealing with gathering up the required RPMs! – slm Jan 4 '14 at 3:45
I have had difficulty finding and downloading all the required .rpm files, for example, git-all requires emacs-git, git, git-arch, each of which require other rpms. I'll try the RepoForge however and report back – Matthew Moisen Jan 4 '14 at 3:45
@MatthewMoisen - yes the advantage of staying with the repo is all the required pkgs are there! – slm Jan 4 '14 at 3:45

The install path is easy enough to find. Most configure scripts are pretty standard, and the usually have a -h flag that prints a help message. Have a look at git's:

$ ./configure -h | grep -A 2 Insta
Installation directories:
  --prefix=PREFIX         install architecture-independent files in PREFIX

So, you installed curl using --prefix=/home/downloads/curl and it was detected by git with --with-curl=/home/downloads/curl. Therefore, if you had installed to the default locations, you would have run --with-curl=/usr/local/.

As for other possible problems, no idea. You'll cross that bridge when you get to it.

On a more general note, I recommend you try searching for RPM packages before installing from source. You don't need yum to install RPM packages, you can simply do:

rpm -i rpmfile.rpm

I found RHEL 6 RPMs for git and curl on rpm.pbone.net. Couldn't find a RHEL 6 one for expat but there were various for Fedora and CentOS, one of them would probably work for you too.

share|improve this answer
Promote these repos: fedoraproject.org/wiki/EPEL & repoforge.org. Heed the warnings on this CentOS wiki when mixing repositories: wiki.centos.org/AdditionalResources/Repositories – slm Jan 4 '14 at 3:01
@slm is repoforge actually safe? I have ran into quite a few issues with rpmforge over the years. – jordanm Jan 4 '14 at 7:12
@jordanm - I use it. They've been segregating packages recently to address the mixing of it, you'll see rfx packages now, which can be some of the problematic ones, but in general I've used it. Mixing RF with others is where it gets messy. – slm Jan 4 '14 at 9:33

Answering 1. The install path to additional packages depends on how they are installed. If you install them as admin, they should be installed to standard /usr or /usr/share locations. Someplace which is already on system path. You can find this from config.log or other logs left by the configure script. Furthermore, some admins might choose to install these packages on /opt directory which stands for 'optional packages'. However, if you install them as a mortal user, you can install them anywhere you have write access, most likely your /home. I normally use a location such as /home/myname/curl-install.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.