編譯安裝git 2.8.0,依照官方文件所說的步驟,安裝出錯,安裝步驟如下:
第一步:
$ sudo yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel
第二步:
$ sudo yum install asciidoc xmlto docbook2x
第三步:
$ 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
問題出在執行到make all doc info
的時候,錯誤訊息如下:
反正問題跟docbook2x有關,又單獨安裝docbook2x顯示已經安裝:
[root@i001 git-2.8.0]# yum install docbook2x Loaded plugins: axelget, langpacks No metadata available for base No metadata available for dockerrepo No metadata available for elrepo No metadata available for epel No metadata available for extras No metadata available for mariadb No metadata available for nginx No metadata available for remi No metadata available for remi-php70 No metadata available for remi-php70-test No metadata available for remi-safe No metadata available for remi-test No metadata available for rpmforge No metadata available for rpmforge-extras No metadata available for rpmforge-testing No metadata available for salt-2015.8 No metadata available for updates No package docbook2x available. Error: Nothing to do
試了3次,都是顯示一樣的錯誤訊息。然後在stackoverflow上找到一個步驟,如下:
第一步:
# yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel # yum install gcc perl-ExtUtils-MakeMaker
第二步:
# yum remove git
第三步:
# cd /usr/src # wget https://www.kernel.org/pub/software/scm/git/git-2.8.0.tar.gz # tar xzf git-2.8.0.tar.gz
第四步:
# cd git-2.8.0 # make prefix=/usr/local/git all # make prefix=/usr/local/git install # echo "export PATH=$PATH:/usr/local/git/bin" >> /etc/bashrc # source /etc/bashrc
第五步:
# git --version git version 2.8.0
依照這個步驟安裝成功,指令差異在於編譯的時候:
成功
# make prefix=/usr/local/git all
有錯誤
$ make configure $ ./configure --prefix=/usr $ make all doc info
問題:
這兩組指令的差別是什麼?
主要區別是第一個命令不生成git的幫助文檔(man/info之類的),而第二個會生成,所以其實是
`
make all跟
make all doc info之间的的区别),prefix只是指定一个目录前缀,在安装(
make install`
)時起作用,對編譯過程沒太大影響。這些在INSTALL文檔裡都有說明的。