如何在CENTOS 5.5上安装git?
如何在 CENTOS 5.5 机器上安装 git? 我尝试从 yum 安装它,但收到以下消息。
root@host [~]# sudo yum install git
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* addons: centos.mirrors.tds.net
* base: mirror.ubiquityservers.com
* extras: mirrors.serveraxis.net
* updates: pubmirrors.reflected.net
addons | 951 B 00:00
base | 2.1 kB 00:00
extras | 2.1 kB 00:00
updates | 1.9 kB 00:00
Excluding Packages in global exclude list
Finished
Setting up Install Process
No package git available.
Nothing to do
root@host [~]#
How can I install git on CENTOS 5.5 machine?
I tried to install it from yum but got following msg.
root@host [~]# sudo yum install git
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* addons: centos.mirrors.tds.net
* base: mirror.ubiquityservers.com
* extras: mirrors.serveraxis.net
* updates: pubmirrors.reflected.net
addons | 951 B 00:00
base | 2.1 kB 00:00
extras | 2.1 kB 00:00
updates | 1.9 kB 00:00
Excluding Packages in global exclude list
Finished
Setting up Install Process
No package git available.
Nothing to do
root@host [~]#
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(14)
如果您使用 CentOS,内置的 yum 存储库似乎没有包含 git,因此您需要向系统添加一个额外的存储库。对于我的服务器,我发现 Webtatic 存储库似乎是相当最新的,并且
git
的安装将如下所示:要解决
Missing Dependency: perl(Git)
错误:If you are using CentOS the built in
yum
repositories don't seem to havegit
included and as such, you will need to add an additional repository to the system. For my servers I found that the Webtatic repository seems to be reasonably up to date and the installation forgit
will then be as follows:To work around
Missing Dependency: perl(Git)
errors:从源头?来自回购?最简单的方法是使用存储库:
sudo yum install git
应该可以做到。如果主库未提供 git,可能首先需要设置一个额外的存储库,例如 EPEL回购协议。如果你想从源安装,你可以尝试 这些说明。如果您安装了 yum-utils,实际上也比这更容易**:
**将
<>
中包含的部分替换为您需要的路径。确切的过程可能略有不同,因为我个人没有从源代码编译 git(例如,可能有一个配置脚本)。如果您不知道我在说什么,那么您可能只想按照我的第一个建议从存储库安装。From source? From the repos? The easiest way is to use the repos:
sudo yum install git
should do it. It may first be necessary to set up an additional repo such as EPEL first if git is not provided by the main repos.If you want to install from source, you can try these instructions. If you have
yum-utils
installed it's actually easier than that, too**:**Substitute the portions enclosed in
<>
with the paths you need. Exact procedure may vary slightly as I have not compiled git from source, personally (there may be a configure script, for example). If you have no idea what I'm talking about, then you may want to just install from the repo as per my first suggestion.只是:
Just:
我尝试了这个问题中的几种方法,但它们在我的 CentO 上都失败了,要么是因为错误的存储库,要么是文件丢失。
这是适合我的方法(安装版本 1.7.8 时):
您可能想从这里下载不同的版本:
http://code.google.com/p/git-core/downloads/list
I've tried few methods from this question and they all failed on my CentOs, either because of the wrong repos or missing files.
Here is the method which works for me (when installing version 1.7.8):
You may want to download a different version from here:
http://code.google.com/p/git-core/downloads/list
用于安装 git
For installing git
我确信这个问题现在即将消失,因为 RHEL 5 已接近生命周期的尽头,但现在答案似乎变得简单得多:
在全新安装的 CentOS 5.11 上为我工作。
I'm sure this question is about to die now that RHEL 5 is nearing end of life, but the answer seems to have gotten a lot simpler now:
worked for me on a fresh install of CentOS 5.11.
好吧,还有更多的事情要做,你需要 zlib。 zlib是CentOS的一部分,但是你需要开发形式来获取zlib.h...注意zlib开发的yum名称
可能与 ubuntu/debian 上的 apt-get 有很大不同,下面的内容实际上有效
与我的 CentOS 版本
特别是,您在 git 上执行 ./configure,然后尝试 make,第一个构建因缺少 zlib.h 而失败
我使用了两步程序来解决这个问题
a) 获得了适用于我的 CentOS 版本的 RPMFORGE
看:
www.centos.org/modules/newbb/viewtopic.php?topic_id=18506&forum=38
还有这个:
wiki.centos.org/AdditionalResources/Repositories/RPMForge
就我而言[作为 root,或使用 sudo]
(此安装默认将其放在
/usr/local/bin/git
中......不是我最喜欢的选择,但默认情况下还可以).. .并且 git 工作正常!OK, there is more to it than that, you need zlib. zlib is part of CentOS, but you need the development form to get zlib.h ... notice that the yum name of zlib development
is quite different possibly than for apt-get on ubuntu/debian, what follows actually works
with my CentOS version
in particular, you do ./configure on git, then try make, and the first build fails with missing zlib.h
I used a two-step procedure to resolve this
a) Got RPMFORGE for my version of CentOS
See:
www.centos.org/modules/newbb/viewtopic.php?topic_id=18506&forum=38
and this:
wiki.centos.org/AdditionalResources/Repositories/RPMForge
In my case [as root, or with sudo]
(this install put it by default in
/usr/local/bin/git
... not my favorite choice, but OK for the default)... and git works fine!CentOS 5 的存储库似乎正在消失。这个问题中提到的大多数人都不再在线,似乎没有 Git,或者拥有非常旧的 Git 版本。下面是我用来从源代码构建 OpenSSL、IDN2、PCRE、cURL 和 Git 的脚本。
git://
和https://
协议都可用于克隆。随着时间的推移,档案的名称将需要更新。例如,在撰写本文时,
openssl-1.0.2k.tar.gz
是 1.0.2 系列中的最新版本。Dale Anderson 使用 RHEL 存储库的答案目前看起来不错,但它是一个相当旧的版本。 Red Hat 提供 Git 版本 1.8,而下面的脚本从源代码构建 2.12。
It looks like the repos for CentOS 5 are disappearing. Most of the ones mentioned in this question are no longer online, don't seem to have Git, or have a really old version of Git. Below is the script I use to build OpenSSL, IDN2, PCRE, cURL and Git from sources. Both the
git://
andhttps://
protocols will be available for cloning.Over time the names of the archives will need to be updates. For example, as of this writing,
openssl-1.0.2k.tar.gz
is the latest available in the 1.0.2 family.Dale Anderson's answer using RHEL repos looks good at the moment, but its a fairly old version. Red Hat provides Git version 1.8, while the script below builds 2.12 from sources.
只需在 2017 年及以后更新此内容,因为 CentOS 5 已达到 EOL 并且 EPEL 的 URL 已更改:
这将让您获得 git 1.8.2.3
Just updating this for 2017 and later, as CentOS 5 has reached EOL and the URL for EPEL has changed:
This gets you git 1.8.2.3
刚刚按照以下说明安装了 git:
安装 EPEL V5
#rpm -Uvh http://archives.fedoraproject.org/pub/archive/epel/5/x86_64/epel-release-5-4.noarch.rpm
安装 Git
# yum install git git-daemon
检查
# git --version
git版本1.8.2.3
可选择安装 Git GUI
# yum install git-gui
对于 i386,请在第 1 步的 URL 中用 i386 替换 x86_64。
#rpm -Uvh http://archives.fedoraproject.org/pub/archive/epel/5/i386/epel-release-5-4.noarch.rpm
Just installed git using the following instructions:
Install EPEL V5
#rpm -Uvh http://archives.fedoraproject.org/pub/archive/epel/5/x86_64/epel-release-5-4.noarch.rpm
Install Git
# yum install git git-daemon
Check
# git --version
git version 1.8.2.3
Optionally install Git GUI
# yum install git-gui
For i386 substitute x86_64 by i386 in the URL at step #1.
#rpm -Uvh http://archives.fedoraproject.org/pub/archive/epel/5/i386/epel-release-5-4.noarch.rpm
编辑
/etc/yum.repos.d/Centos*
,以便所有具有enabled = 0
的行改为具有enabled = 1
。Edit
/etc/yum.repos.d/Centos*
so that all lines that haveenabled = 0
instead haveenabled = 1
.这在 CentOS 上对我有用:
安装依赖项:
获取 Git
构建 Git
<预置><代码>./配置
制作
进行安装
This worked for me on CentOS:
Install dependencies:
Get Git
Build Git