New Year New Git!
Centos 7 has a very old version of Git packaged with it. One way to update Git would be compile our own version, which is easy enough. However this method cannot then be managed by a package manager and instead has to be manual. Surely it would be much better to install a package? Oh but then its a third party repository and the question of “Can it be trusted?” comes up. So, if we shouldn’t compile our own and cant trust a third party to package it for us, whats the next option? Package it our selves!
For this, we will use the Fedora Koji source packages.
Here’s a brief overview of how to do it:
Grab the most recent source RPM from Fedora:
$ wget https://kojipkgs.fedoraproject.org/packages/git/2.24.1/1.fc32/src/git-2.24.1-1.fc32.src.rpm
Install the build dependencies for the source RPM:
# yum-builddep git-2.24.1-1.fc32.src.rpm
Build the RPM!
$ rpmbuild --rebuild git-2.24.1-1.fc32.src.rpm
Now you can move the built RPM’s (in ~/rpmbuild/RPMS) to the server we want to update git on and install them:
# yum install ~/rpmbuild/RPMS/noarch/perl-Git-2.24.1-1.el7.noarch.rpm ~/rpmbuild/RPMS/x86_64/git-2.24.1-1.el7.x86_64.rpm ~/rpmbuild/RPMS/x86_64/git-core-2.24.1-1.el7.x86_64.rpm ~/rpmbuild/RPMS/noarch/git-core-doc-2.24.1-1.el7.noarch.rpm