1.5 Getting Started - Installing Git
一、从源代码编译安装 git
If you do want to install Git from source, you need to have the following libraries that Git depends on: autotools, curl, zlib, openssl, expat, and libiconv.
官方文档说了,如果你想编译安装git,你需要有以下依赖库:autotools、curl、zlib、openssl、expat、libiconv
如果你使用的是基于dnf的包管理工具,像Fedora,你可以使用下面的命令安装这些依赖:
$ sudo dnf install dh-autoreconf curl-devel expat-devel gettext-devel openssl-devel perl-devel zlib-devel
如果你使用的是基于Debian的linux,像ubuntu,你可以使用下面的命令安装依赖:
$ sudo apt-get install dh-autoreconf libcurl4-gnutls-dev libexpat1-dev gettext libz-dev libssl-dev
(可选)如果你还想生成多种格式的文档,你还需要安装下面这些依赖:
# dnf
sudo dnf install asciidoc xmlto docbook2X
# apt
sudo apt-get install asciidoc xmlto docbook2x
If you’re using a Debian-based distribution (Debian/Ubuntu/Ubuntu-derivatives), you also need the install-info package:
如果完全使用的是基于debian的系统,你还需要安装install-info依赖包。
$ sudo apt-get install install-info
If you’re using a RPM-based distribution (Fedora/RHEL/RHEL-derivatives), you also need the getopt package (which is already installed on a Debian-based distro):
如果完全使用的是RPM的发行版,你需要安装getopt依赖包。
$ sudo dnf install getopt
Additionally, if you’re using Fedora/RHEL/RHEL-derivatives, you need to do this:
$ sudo ln -s /usr/bin/db2x_docbook2texi /usr/bin/docbook2x-texi
编译安装步骤
当完成这一切,你就可以安装git了:
$ tar -zxf git-2.8.0.tar.gz
$ cd git-2.8.0
$ make configure
$ ./configure --prefix=/usr
$ make all doc info
$ sudo make install install-doc install-html install-info