Skip to content

Instantly share code, notes, and snippets.

@qichunren
Created February 15, 2011 02:15
Show Gist options
  • Save qichunren/826986 to your computer and use it in GitHub Desktop.
Save qichunren/826986 to your computer and use it in GitHub Desktop.
How to install git on centos

在CentOS 5上安装Git

git的官方网站

现在都流行这个Git分布式版本控制系统,我也在服务器上装一个学一下.

首先安装Git依赖的一些包.

  yum install zlib-devel
  yum install openssl-devel
  yum install perl
  yum install cpio
  yum install expat-devel
  yum install gettext-devel

接下来,如果你已经安装过Curl了,那么跳过这一步,没有的话,就装一下.

    wget http://curl.haxx.se/download/curl-7.18.0.tar.gz
    tar xzvf curl-7.18.0.tar.gz
    cd curl-7.18.0
    ./configure
    make
    make install

确定一下ld.so.conf文件里有/usr/local/lib,这个是为git-http-push准备的.

         vi /etc/ld.so.conf

插入下面的代码 /usr/local/lib

保存文件,接着运行:

        /sbin/ldconfig

最好,我们下载Git并安装它

 wget http://www.codemonkey.org.uk/projects/git-snapshots/git/git-latest.tar.gz
 tar xzvf git-latest.tar.gz
 cd git-{date}
 autoconf
 ./configure --with-curl=/usr/local  可以去掉--with-curl=/usr/local,另外也可以加上--prefix=/opt/git
 make
 make install

这就是所有的安装步骤,不算是太麻烦吧.

最后将git加到path环境变量中去。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment