I am trying to install git. I run the following command:
sudo apt-get install git-core git-gui git-doc
But receive the following error:
sudo: apt-get: command not found
What should I do?
aptcentoscommand linegityum
I am trying to install git. I run the following command:
sudo apt-get install git-core git-gui git-doc
But receive the following error:
sudo: apt-get: command not found
What should I do?
Best Answer
Since you're using CentOS 5, the default package manager is
yum
, notapt-get
. To install a program using it, you'd normally use the following command:However, when trying to install git this way, you'll encounter the following error on CentOS 5:
This tells you that the package repositories that
yum
knows about don't contain the required rpms (RPM Package Manager files) to installgit
. This is presumably because CentOS 5 is based on RHEL 5, which was released in 2007, beforegit
was considered a mature version control system. To get around this problem, we need to add additional repositories to the list thatyum
uses (We're going to add the RPMforge repository, as per these instructions).This assumes you want the i386 packages. Test by running
uname -i
. If you want the x86_64 packages, replace all occurrences of i386 with x86_64 in the following commandsFirst, download the
rpmforge-release
package:Next, verify and install the package:
And now we should be able to install
git
:yum
will work out the dependencies, and ask you at relevant points if you want to proceed. Press y for Yes, and n or return for No.