问题起因
linux服务器内安装git工具包,下载git-2.28.0.tar.xz并解压成文件夹。
编译git
sudo make prefix=/usr/local/git all
出现以下问题-No.1
make: curl-config: Command not found
CC http.o
In file included from http.c:2:
http.h:6:10: fatal error: curl/curl.h: No such file or directory
#include <curl/curl.h>
^~~~~~~~~~~~~
compilation terminated.
make: *** [http.o] Error 1
问题分析:curl环境不够完整
解决方案:下载依赖包
sudo yum install curl-devel expat-devel gettext-devel openssl-devel zlib=devel perl-ExtUtils-MakeMaker
出现以下问题-No.2
Error Downloading Packages:
libidn-devel-1.18-2.el6.x86_64: failure: Packages/libidn-devel-1.18-2.el6.x86_64.rpm from base: [Errno 256] No more mirrors to try.
libcurl-7.19.7-54.el6_10.x86_64: failure: Packages/libcurl-7.19.7-54.el6_10.x86_64.rpm from updates: [Errno 256] No more mirrors to try.
openssl-static-1.0.1e-58.el6_10.x86_64: failure: Packages/openssl-static-1.0.1e-58.el6_10.x86_64.rpm from updates: [Errno 256] No more mirrors to try.
openssl-1.0.1e-58.el6_10.x86_64: failure: Packages/openssl-1.0.1e-58.el6_10.x86_64.rpm from updates: [Errno 256] No more mirrors to try.
openssl-devel-1.0.1e-58.el6_10.x86_64: failure: Packages/openssl-devel-1.0.1e-58.el6_10.x86_64.rpm from updates: [Errno 256] No more mirrors to try.
libcurl-devel-7.19.7-54.el6_10.x86_64: failure: Packages/libcurl-devel-7.19.7-54.el6_10.x86_64.rpm from updates: [Errno 256] No more mirrors to try.
curl-7.19.7-54.el6_10.x86_64: failure: Packages/curl-7.19.7-54.el6_10.x86_64.rpm from updates: [Errno 256] No more mirrors to try.
expat-devel-2.0.1-13.el6_8.x86_64: failure: Packages/expat-devel-2.0.1-13.el6_8.x86_64.rpm from base: [Errno 256] No more mirrors to try.
问题分析:yum下载资源失败
解决方案:检查服务器网络是否正常访问公网
ping baidu.com
PING baidu.com (39.156.66.10) 56(84) bytes of data.
64 bytes from 39.156.66.10: icmp_seq=1 ttl=42 time=5.79 ms
64 bytes from 39.156.66.10: icmp_seq=2 ttl=42 time=5.52 ms
64 bytes from 39.156.66.10: icmp_seq=3 ttl=42 time=5.50 ms
64 bytes from 39.156.66.10: icmp_seq=4 ttl=42 time=5.48 ms
64 bytes from 39.156.66.10: icmp_seq=5 ttl=42 time=5.47 ms
清理yum缓存
yum clean all
Loaded plugins: fastestmirror
Cleaning repos: base docker-ce-stable epel erlang-solutions extras mongodb-org-4.0 updates
Cleaning up Everything
Cleaning up list of fastest mirrors
创建新的缓存
yum makecache
Loaded plugins: fastestmirror
Determining fastest mirrors
* epel: mirrors.aliyun.com
http://mirrors.163.com/centos/6/os/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
Trying other mirror.
To address this issue please refer to the below knowledge base article
https://access.redhat.com/articles/1320623
If above article doesn't help to resolve this issue please open a ticket with Red Hat Support.
Error: Cannot retrieve repository metadata (repomd.xml) for repository: base. Please verify its path and try again
问题原因:缺少repomd.xml文件-No.3
解决方案:把这个文件给它补上
cd /etc/yum.repos.d
vim CentOS-Base.repo
把这个文件的内容修改成下面这个样子
[base]
name=CentOS-$releasever - Base - 163.com
baseurl=http://mirrors.cloud.aliyuncs.com/centos/7/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
#released updates
[updates]
name=CentOS-7 - Updates - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/7/updates/$basearch/
http://mirrors.aliyuncs.com/centos/7/updates/$basearch/
http://mirrors.cloud.aliyuncs.com/centos/7/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
#additional packages that may be useful
[extras]
name=CentOS-7 - Extras - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/7/extras/$basearch/
http://mirrors.aliyuncs.com/centos/7/extras/$basearch/
http://mirrors.cloud.aliyuncs.com/centos/7/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-7 - Plus - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/7/centosplus/$basearch/
http://mirrors.aliyuncs.com/centos/7/centosplus/$basearch/
http://mirrors.cloud.aliyuncs.com/centos/7/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
#contrib - packages by Centos Users
[contrib]
name=CentOS-7 - Contrib - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/7/contrib/$basearch/
http://mirrors.aliyuncs.com/centos/7/contrib/$basearch/
http://mirrors.cloud.aliyuncs.com/centos/7/contrib/$basearch/
验证是否解决
yum makecache
出现以下问题
http://mirrors.cloud.aliyuncs.com/centos/7/os/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn't resolve host 'mirrors.cloud.aliyuncs.com'"
Trying other mirror.
Error: Cannot retrieve repository metadata (repomd.xml) for repository: base. Please verify its path and try again
问题原因:mirrors.cloud.aliyuncs.com这个域名访问失败-No.4
解决方案:修改DNS
vim/etc/resolv.conf
nameserver 8.8.8.8
nameserver 114.114.114.114
问题没有解决
尝试更换新的repo文件
wget https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo -O /etc/yum.repos.d/Centos-vault-8.5.2111.repo
wget https://mirrors.aliyun.com/repo/epel-archive-8.repo -O /etc/yum.repos.d/epel-archive-8.repo
替换域名
sed -i 's/mirrors.cloud.aliyuncs.com/mirrors.aliyun.com/g' /etc/yum.repos.d/Centos-vault-8.5.2111.repo
sed -i 's/mirrors.cloud.aliyuncs.com/mirrors.aliyun.com/g' /etc/yum.repos.d/epel-archive-8.repo
清理并重建缓存
yum clean all && yum makecache
问题3+问题4解决,回到问题2
sudo yum install curl-devel expat-devel gettext-devel openssl-devel zlib=devel perl-ExtUtils-MakeMaker
新问题:
Error: xz compression not available
问题分析:xz压缩不可用
尝试通过重新安装epel来解决,问题依然存在
rm -rf /var/cache/yum/x86_64/6Server/epel/
rpm -ivh epel-release-6-8.noarch.rpm
wget -O/etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
wget -O /etc/yum.repos.d/epel.repohttp://mirrors.aliyun.com/repo/epel-6.repo
尝试重装pyliblzma
sudo dnf reinstall pyliblzma包来解决问题
sudo: dnf: command not found
没有dnf用rpm来安装
sudo wget http://rpmfind.net/linux/centos/7.9.2009/os/x86_64/Packages/pyliblzma-0.5.3-11.el7.x86_64.rpm
sudo rpm -ivh pyliblzma-0.5.3-11.el7.x86_64.rpm --nodeps --force
warning: pyliblzma-0.5.3-11.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
Preparing... ########################################### [100%]
1:pyliblzma ########################################### [100%]
问题依然存在,只能重新安装yum了。。。
时间关系,不详细展示命令了,请看相关参考资料:
http://www.manongjc.com/detail/28-rvjlfqgimoapiro.html
~一个小时后:
重新安装的过程发现问题根源:
1、yum默认关联的是Python2,但是Python在服务器上有两版,一个Python2一个Python3
https://www.cnblogs.com/phpzhou/p/9675099.html
2、yum源要正确更换,yum源要切记centOS6系统不能配置成centOS7的源
可以参考https://blog.csdn.net/Coin_Collecter/article/details/130071493更换yum源
现在回到问题2
sudo yum install curl-devel expat-devel gettext-devel openssl-devel zlib=devel perl-ExtUtils-MakeMaker
Error: Multilib version problems found. This often means that the root
cause is something else and multilib version checking is just
pointing out that there is a problem. Eg.:
1. You have an upgrade for nss which is missing some
dependency that another package requires. Yum is trying to
solve this by installing an older version of nss of the
different architecture. If you exclude the bad architecture
yum will tell you what the root cause is (which package
requires what). You can try redoing the upgrade with
--exclude nss.otherarch ... this should give you an error
message showing the root cause of the problem.
2. You have multiple architectures of nss installed, but
yum can only see an upgrade for one of those arcitectures.
If you don't want/need both architectures anymore then you
can remove the one with the missing update and everything
will work.
3. You have duplicate versions of nss installed already.
You can use "yum check" to get yum show these errors.
...you can also use --setopt=protected_multilib=false to remove
this checking, however this is almost never the correct thing to
do as something else is very likely to go wrong (often causing
much more problems).
Protected multilib versions: nss-3.27.1-13.el6.i686 != nss-3.28.4-4.el6_9.x86_64
Error: Protected multilib versions: nss-util-3.27.1-3.el6.i686 != nss-util-3.28.4-1.el6_9.x86_64
Error: Protected multilib versions: libcurl-7.19.7-52.el6.i686 != libcurl-7.19.7-53.el6_9.x86_64
这次还好,报错完全跟上面不一样了,上面都是找不到资源之类的问题,现在集中在Multilib version problems found这个问题上
问题分析:这里面提示multilib版本有冲突
sudo yum install curl-devel expat-devel gettext-devel openssl-devel zlib=devel perl-ExtUtils-MakeMaker --setopt=protected_multilib=false
Error Downloading Packages:
openssl-1.0.1e-57.el6.i686: failure: Packages/openssl-1.0.1e-57.el6.i686.rpm from CentOS6.9: [Errno 256] No more mirrors to try.
readline-6.0-4.el6.i686: failure: Packages/readline-6.0-4.el6.i686.rpm from CentOS6.9: [Errno 256] No more mirrors to try.
krb5-libs-1.10.3-65.el6.i686: failure: Packages/krb5-libs-1.10.3-65.el6.i686.rpm from CentOS6.9: [Errno 256] No more mirrors to try.
libidn-1.18-2.el6.i686: failure: Packages/libidn-1.18-2.el6.i686.rpm from CentOS6.9: [Errno 256] No more mirrors to try.
libssh2-1.4.2-2.el6_7.1.i686: failure: Packages/libssh2-1.4.2-2.el6_7.1.i686.rpm from CentOS6.9: [Errno 256] No more mirrors to try.
db4-4.7.25-22.el6.i686: failure: Packages/db4-4.7.25-22.el6.i686.rpm from CentOS6.9: [Errno 256] No more mirrors to try.
nss-3.27.1-13.el6.i686: failure: Packages/nss-3.27.1-13.el6.i686.rpm from CentOS6.9: [Errno 256] No more mirrors to try.
nspr-4.13.1-1.el6.i686: failure: Packages/nspr-4.13.1-1.el6.i686.rpm from CentOS6.9: [Errno 256] No more mirrors to try.
nss-softokn-3.14.3-23.3.el6_8.i686: failure: Packages/nss-softokn-3.14.3-23.3.el6_8.i686.rpm from CentOS6.9: [Errno 256] No more mirrors to try.
libcom_err-1.41.12-23.el6.i686: failure: Packages/libcom_err-1.41.12-23.el6.i686.rpm from CentOS6.9: [Errno 256] No more mirrors to try.
cyrus-sasl-lib-2.1.23-15.el6_6.2.i686: failure: Packages/cyrus-sasl-lib-2.1.23-15.el6_6.2.i686.rpm from CentOS6.9: [Errno 256] No more mirrors to try.
sqlite-3.6.20-1.el6_7.2.i686: failure: Packages/sqlite-3.6.20-1.el6_7.2.i686.rpm from CentOS6.9: [Errno 256] No more mirrors to try.
openldap-2.4.40-16.el6.i686: failure: Packages/openldap-2.4.40-16.el6.i686.rpm from CentOS6.9: [Errno 256] No more mirrors to try.
libcurl-7.19.7-52.el6.i686: failure: Packages/libcurl-7.19.7-52.el6.i686.rpm from CentOS6.9: [Errno 256] No more mirrors to try.
nss-util-3.27.1-3.el6.i686: failure: Packages/nss-util-3.27.1-3.el6.i686.rpm from CentOS6.9: [Errno 256] No more mirrors to try.
libselinux-2.0.94-7.el6.i686: failure: Packages/libselinux-2.0.94-7.el6.i686.rpm from CentOS6.9: [Errno 256] No more mirrors to try.
ncurses-libs-5.7-4.20090207.el6.i686: failure: Packages/ncurses-libs-5.7-4.20090207.el6.i686.rpm from CentOS6.9: [Errno 256] No more mirrors to try.
keyutils-libs-1.4-5.el6.i686: failure: Packages/keyutils-libs-1.4-5.el6.i686.rpm from CentOS6.9: [Errno 256] No more mirrors to try.
好家伙这么多资源都找不到。。。这个只能一个一个安装了,因为不知道哪个包带来的
sudo yum install curl-devel --setopt=protected_multilib=false
就是它
经过与专业运维沟通,centOS6的rpm资源已经不维护了,如果404了只能手动找安装包,安全性难以保障。没有办法最后只能重装Linux系统了。重装的系统里面自带了git。so,f**k
结论与收获
1、yum,rpm,dnf
2、centos6和7
3、yum源的设置
4、curl