安装Git需要依赖的库有curl, zlib, openssl, perl,expat, asciidoc, xmlto等,可以查看源码目录下的INSTALL文件,里面对于依赖库有详细的描述(以下列举了开头部分):
- - Git is reasonably self-sufficient, but does depend on a few external
-
programs and libraries. Git can be used without most of them by adding
-
the approriate "NO_
=YesPlease" to the make command line or -
config.mak file.
-
- - "zlib", the compression library. 。。。。以下省略若干条目
PS:在配置依赖包的时候可能需要新下载一些软件包,这是会发现同名软件包可能会有多个版本,我们应该选择哪一个安装呢,根据源码安装的特点,我们尽量选择-dev版本的,原因如下:
- Because compiling from sources is considered “development” work, the normal binary versions of installed libraries are not sufficient. Instead, you need the -dev versions because the development variants also supply header files required during compilation.
将所有依赖库配置妥当后,就可以进行安装了,以前博客中介绍了关于如何源码安装软件http://blog.chinaunix.net/space.php?uid=1721137&do=blog&id=85144,这次又加深了理解,不错不错,勤动手勤思考。哈哈。下面是安装步骤:
- /×
-
* 将Git安装到 home directory
-
×/
-
-
$> cd git-1.7.4
-
$> ./configure
-
$> make all doc
- #> make install install-doc // use root
- /*
-
* 将Git安装到指定位置 /usr
-
*/
-
-
$> cd git-1.7.4
-
$> ./configure --prefix=/usr
-
$> make all doc
- #> make install install-doc // use root
等待Git成功安装后,就可以继续下一步Git的配置工作,请参考链接:
当Git配置完成后,就可以大肆地Git了,但是在Linux状态下,git是通过命令行来进行工作的,网上有个关于常用命令的参考,大家可以查看链接:
为了图文并茂,上图一张。。。
最后祝大家Git愉快!~