赞
踩
一、下载安装包
下载Linux下的Git安装包,地址:
https://mirrors.edge.kernel.org/pub/software/scm/git/
将下载的压缩包上传至Linux服务器的/usr目录下面
进入到/usr目录下:cd /usr
解压压缩包:
tar -zxvf git-2.9.5.tar.gz
5.进入到解压后的文件夹:
cd git-2.9.5
6. 编译Git源码:
make prefix=/usr/local/git all
7.安装Git到/usr/local/git路径:
make prefix=/usr/local/git install
8. 配置环境变量:
sudo vi /etc/profile
9.在环境变量配置文件最后加上:
export PATH=$PATH:/usr/local/git/bin
10. 刷新环境变量:
source /etc/profile
11. 查看Git是否安装完成:
git --version
二、安装过程报错解决
fatal error: openssl/ssl.h: No such file or directory
解决方法:
sudo apt-get install libssl-dev
提示界面如下:
问题现象:
在安装libssl-dev 的时候提示错误:
解决方法:
linux的版本依赖问题很令人纠结,不过我们可以通过使用aptitude软件包管理器来解决这个依赖问题,aptitude是可以选择合适的版本与匹配软件安装。
首先安装aptitude工具
sudo apt-get install aptitude
再利用aptitude来安装libssl-dev
sudo aptitude install libssl-dev
sqtu@ubuntu:/usr/git-2.9.5$ sudo aptitude install libssl-dev The following NEW packages will be installed: libssl-dev{b} 0 packages upgraded, 1 newly installed, 0 to remove and 36 not upgraded. Need to get 1,372 kB of archives. After unpacking 6,863 kB will be used. The following packages have unmet dependencies: libssl-dev : Depends: libssl1.1 (= 1.1.0g-2ubuntu4) but 1.1.1-1ubuntu2.1~18.04.6 is installed The following actions will resolve these dependencies: Keep the following packages at their current version: 1) libssl-dev [Not Installed] Accept this solution? [Y/n/q/?] n The following actions will resolve these dependencies: Upgrade the following packages: 1) libmysqlclient20 [5.7.30-0ubuntu0.18.04.1 (now) -> 5.7.33-0ubuntu0.16.04. Downgrade the following packages: 2) libpython2.7 [2.7.17-1~18.04ubuntu1 (now) -> 2.7.15~rc1-1 (bionic)] 3) libpython2.7-minimal [2.7.17-1~18.04ubuntu1 (now) -> 2.7.15~rc1-1 (bionic 4) libpython2.7-stdlib [2.7.17-1~18.04ubuntu1 (now) -> 2.7.15~rc1-1 (bionic) 5) libssl1.1 [1.1.1-1ubuntu2.1~18.04.6 (now) -> 1.1.0g-2ubuntu4 (bionic)] 6) python2.7 [2.7.17-1~18.04ubuntu1 (now) -> 2.7.15~rc1-1 (bionic)] 7) python2.7-minimal [2.7.17-1~18.04ubuntu1 (now) -> 2.7.15~rc1-1 (bionic)] Accept this solution? [Y/n/q/?] y The following packages will be DOWNGRADED: libpython2.7 libpython2.7-minimal libpython2.7-stdlib libssl1.1 python2.7 python2.7-minimal The following NEW packages will be installed: libssl-dev The following packages will be upgraded: libmysqlclient20 1 packages upgraded, 1 newly installed, 6 downgraded, 0 to remove and 35 not upgraded. Need to get 8,010 kB of archives. After unpacking 6,265 kB will be used. Do you want to continue? [Y/n/?] y Get: 1 http://mirrors.aliyun.com/ubuntu xenial-updates/main amd64 libmysqlclient20 amd64 5.7.33-0ubuntu0.16.04.1 [684 kB] Get: 2 http://archive.ubuntu.com/ubuntu bionic/main amd64 python2.7 amd64 2.7.15~rc1-1 [238 kB] Get: 3 http://archive.ubuntu.com/ubuntu bionic/main amd64 libpython2.7 amd64 2.7.15~rc1-1 [1,053 kB] Get: 4 http://archive.ubuntu.com/ubuntu bionic/main amd64 libpython2.7-stdlib amd64 2.7.15~rc1-1 [1,910 kB] Get: 5 http://archive.ubuntu.com/ubuntu bionic/main amd64 libssl1.1 amd64 1.1.0g-2ubuntu4 [1,128 kB] Get: 6 http://archive.ubuntu.com/ubuntu bionic/main amd64 python2.7-minimal amd64 2.7.15~rc1-1 [1,292 kB] Get: 7 http://archive.ubuntu.com/ubuntu bionic/main amd64 libpython2.7-minimal amd64 2.7.15~rc1-1 [334 kB] Get: 8 http://archive.ubuntu.com/ubuntu bionic/main amd64 libssl-dev amd64 1.1.0g-2ubuntu4 [1,372 kB] Fetched 8,010 kB in 8s (1,045 kB/s) Preconfiguring packages ... dpkg: warning: downgrading python2.7 from 2.7.17-1~18.04ubuntu1 to 2.7.15~rc1-1 (Reading database ... 142514 files and directories currently installed.) Preparing to unpack .../0-python2.7_2.7.15~rc1-1_amd64.deb ... Unpacking python2.7 (2.7.15~rc1-1) over (2.7.17-1~18.04ubuntu1) ... dpkg: warning: downgrading libpython2.7:amd64 from 2.7.17-1~18.04ubuntu1 to 2.7.15~rc1-1 Preparing to unpack .../1-libpython2.7_2.7.15~rc1-1_amd64.deb ... Unpacking libpython2.7:amd64 (2.7.15~rc1-1) over (2.7.17-1~18.04ubuntu1) ... Preparing to unpack .../2-libmysqlclient20_5.7.33-0ubuntu0.16.04.1_amd64.deb ... Unpacking libmysqlclient20:amd64 (5.7.33-0ubuntu0.16.04.1) over (5.7.30-0ubuntu0.18.04.1) ... dpkg: warning: downgrading libpython2.7-stdlib:amd64 from 2.7.17-1~18.04ubuntu1 to 2.7.15~rc1-1 Preparing to unpack .../3-libpython2.7-stdlib_2.7.15~rc1-1_amd64.deb ... Unpacking libpython2.7-stdlib:amd64 (2.7.15~rc1-1) over (2.7.17-1~18.04ubuntu1) ... dpkg: warning: downgrading libssl1.1:amd64 from 1.1.1-1ubuntu2.1~18.04.6 to 1.1.0g-2ubuntu4 Preparing to unpack .../4-libssl1.1_1.1.0g-2ubuntu4_amd64.deb ... Unpacking libssl1.1:amd64 (1.1.0g-2ubuntu4) over (1.1.1-1ubuntu2.1~18.04.6) ... dpkg: warning: downgrading python2.7-minimal from 2.7.17-1~18.04ubuntu1 to 2.7.15~rc1-1 Preparing to unpack .../5-python2.7-minimal_2.7.15~rc1-1_amd64.deb ... Unpacking python2.7-minimal (2.7.15~rc1-1) over (2.7.17-1~18.04ubuntu1) ... dpkg: warning: downgrading libpython2.7-minimal:amd64 from 2.7.17-1~18.04ubuntu1 to 2.7.15~rc1-1 Preparing to unpack .../6-libpython2.7-minimal_2.7.15~rc1-1_amd64.deb ... Unpacking libpython2.7-minimal:amd64 (2.7.15~rc1-1) over (2.7.17-1~18.04ubuntu1) ... Selecting previously unselected package libssl-dev:amd64. Preparing to unpack .../7-libssl-dev_1.1.0g-2ubuntu4_amd64.deb ... Unpacking libssl-dev:amd64 (1.1.0g-2ubuntu4) ... Processing triggers for mime-support (3.60ubuntu1) ... Processing triggers for desktop-file-utils (0.23-1ubuntu3) ... Processing triggers for libc-bin (2.27-3ubuntu1) ... Setting up libssl1.1:amd64 (1.1.0g-2ubuntu4) ... Processing triggers for man-db (2.8.3-2) ... Setting up libmysqlclient20:amd64 (5.7.33-0ubuntu0.16.04.1) ... Processing triggers for gnome-menus (3.13.3-11ubuntu1) ... Setting up libpython2.7-minimal:amd64 (2.7.15~rc1-1) ... Setting up libpython2.7-stdlib:amd64 (2.7.15~rc1-1) ... Setting up python2.7-minimal (2.7.15~rc1-1) ... Setting up libssl-dev:amd64 (1.1.0g-2ubuntu4) ... Setting up python2.7 (2.7.15~rc1-1) ... Setting up libpython2.7:amd64 (2.7.15~rc1-1) ... Processing triggers for libc-bin (2.27-3ubuntu1) ... Current status: 35 (-1) upgradable.
至此,问题解决,以后遇到版本不对导致依赖不对应的问题也可以采用上述的方法进行解决。
fatal error: zlib.h: No such file or directory
解决方法:
sudo apt-get install zlib1g-dev
fatal error: curl/curl.h: No such file or directory
解决方法:
sudo apt-get install libcurl4-openssl-dev
fatal error: expat.h: No such file or directory
解决方法:
sudo apt-get install libexpat1-dev
MSGFMT po/pt_pt.msg Makefile:254: recipe for target 'po/pt_pt.msg' failed
make[1]: *** [po/pt_pt.msg] Error 127
Makefile:2159: recipe for target 'all' failed
make: *** [all] Error 2
解决方法:
sudo apt install gettext
cc: not found
解决方法:
sudo apt install gcc
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。