centos 最新版git 致命错误: zlib.h:没有那个文件或目录
遇到此类问题通常是缺少对应的库文件。
由于yum install是老版本的git 还是1.8的 如果需要安装新版本的git,官方给出的url:https://git-scm.com/download/linux
centos 需要下载对应源代码包,然后编译安装。
1 2 | . /configure make |
执行make的时候报错,cache.h:40:18: 致命错误:zlib.h:没有那个文件或目录
安装zlib
1 | yum install zlib #此时敲Tab会自动补全 |
zlib-ada-devel.x86_64 zlib-devel.i686 zlib-static.i686
zlib-ada.x86_64 zlib-devel.x86_64 zlib-static.x86_64
安装对应的就行 我安装的是
1 | yum install zlib-devel.x86_64 |
接着编译
1 | make && make install |
1 | git version # 查看版本号 |
git version 2.9.5
-------------------------其他版本安装---------------------------------------
Download for Linux and Unix
It is easiest to install Git on Linux using the preferred package manager of your Linux distribution. If you prefer to build from source, you can find the tarballs on kernel.org.
Debian/Ubuntu
For the latest stable version for your release of Debian/Ubuntu
# apt-get install git
For Ubuntu, this PPA provides the latest stable upstream Git version
# add-apt-repository ppa:git-core/ppa
# apt update; apt install git
Fedora
# yum install git
(up to Fedora 21)# dnf install git
(Fedora 22 and later)
Gentoo
# emerge --ask --verbose dev-vcs/git
Arch Linux
# pacman -S git
openSUSE
# zypper install git
Mageia
# urpmi git
Nix/NixOS
# nix-env -i git
FreeBSD
# pkg install git
Solaris 9/10/11 (OpenCSW)
# pkgutil -i git
Solaris 11 Express
# pkg install developer/versioning/git
OpenBSD
# pkg_add git
Alpine
$ apk add git
Red Hat Enterprise Linux, Oracle Linux, CentOS, Scientific Linux, et al.
RHEL and derivatives typically ship older versions of git. You can download a tarball and build from source, or use a 3rd-party repository such as the IUS Community Project to obtain a more recent version of git.
Slitaz
$ tazpkg get-install git
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南