linux 的git的安装目录,Linux下Git安装及配置较详细-Go语言中文社区
1.下載git源碼
2.解壓安裝包
--解壓:tar -zxvf git-2.9.5.tar.gz
--移直目標文件:mv /root/git-2.9.5? /usr/git-2.9.5(使用Xftp操作也可)
--進入解壓包目錄 cd usr/git-2.9.5
3.安裝
--指定安裝目錄 ./configure? --prefix=/usr/git
./configure報錯
[root@localhost git-2.9.5]# ./configure --prefix=/home/Git configure: Setting lib to 'lib' (the default) configure: Will try -pthread then -lpthread to enable POSIX Threads. configure: CHECKS for site configuration checking for gcc... no checking for cc... no checking for cl.exe... no configure: error: in `/home/tools/git-2.9.5': configure: error: no acceptable C compiler found in $PATH See `config.log' for more details
執行報錯中看出gcc,cc,cl.exe為no。gcc是linux的c語言編譯器,說明我的機器中沒有安裝這些編譯器。
分別安裝以下gcc,gcc-c++,安裝成功之后執行一下git安裝命令:
[root@localhost git-2.9.5] #? yum install gcc
[root@localhost git-2.9.5] #? yum install gcc-c++
[root@localhost git-2.9.5] #? ./configure --prefix=/usr/git
--安裝 make && make install
make命令報錯
[root@localhost git-2.9.5]# make && make install * new build flags CC credential-store.o In file included from credential-store.c:1:0: cache.h:40:18: 致命錯誤:zlib.h:沒有那個文件或目錄 #include ^ 編譯中斷。 make: *** [credential-store.o] 錯誤 1
缺少zlib的頭文件,開發包沒裝。安裝zlib
[root@localhost git-2.9.5]# yum install zlib
[root@localhost git-2.9.5]# yum install zlib-devel
[root@localhost git-2.9.5]# yum install perl-ExtUtils-CBuilder perl-ExtUtils-MakeMaker
[root@localhost git-2.9.5]# make && make install
執行后繼續報錯,錯誤信息:
MSGFMT po/bg.msg make[1]:?*?[po/bg.msg] Error 127
解決方式:
yum install tcl build-essential tk gettext
再次執行安裝:
[root@localhost git-2.9.5]# make && make install
則安裝成功。
4.檢查git是否安裝完成
進入指定的安裝目錄,查看git版本
[root@localhost bin]# cd /usr/Git/bin
[root@localhost bin]# ./git --version
git version 2.9.5
5.配置環境變量:
vi /etc/profile
編輯配置文件,在最后追加下面的字符串,指定bin目錄地址
$PATH://usr/git/bin
修改完成之后,執行命令,生效配置文件
source /etc/profile
檢查是否配置成功,可切換路徑到其他目錄,執行 git --version。返回git版本則表示環境變量配置完成。
在安裝過程中,查到的資料鏈接如下:
總結
以上是生活随笔為你收集整理的linux 的git的安装目录,Linux下Git安装及配置较详细-Go语言中文社区的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 怎么修改linux用户名密码忘记,lin
- 下一篇: 嵌入式linux root免密码,给嵌入