文章来自:循序渐渐linux:基础知识 一书 7.3章LAMP服务器搭建 日常故障

centos上好多软件升级需要配置epel源 其中有一点小插曲 需要手动更改

1、很多时候,对PHP环境要求较新的版本,例如,PHP 7环境,如果通过源码编译、安装,将会非常麻烦。这里提供一种通过yum工具安装最新PHP 版本的方法。首先,需要在系统上安装一个扩展yum源,即epel源,

可从http://fedoraproject.org/wiki/EPEL 网站下载针对CentOS 7版本的epel文件,然后进行安装,操作过程如下。 网络上好多yum安装的我尝试好多次不成功报错 所以手动安装

    [root@localhost ~]# wget  \
>http://mirrors.neusoft.edu.cn/epel/7/x86_64/e/epel-release-7-5.noarch.rpm
[root@localhost ~]# rpm -ivh epel-release-7-5.noarch.rpm

2、接着,还需要一个REMI源,这个yum源提供了最新的PHP版本的下载和安装,它的官方网站为http://rpms.famillecollet.com/。安装REMI源的过程如下。

    [root@localhost ~]# rpm --import http://rpms.famillecollet.com/RPM-GPG-KEY-remi
[root@localhost ~]# wget http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
[root@localhost ~]# rpm -ivh remi-release-7.rpm

3、默认情况下,REMI是禁用的。要检查REMI源是否已经成功安装,可以执行如下命令。

    [root@localhost ~]# yum repolist disabled | grep remi
!remi Les RPM de remi pour Enterprise Linux 7 - x86_64
remi-debuginfo/x86_64 Les RPM de remi pour Enterprise Linux 7 - x86_64 -
!remi-php55 Les RPM de remi de PHP 5.5 pour Enterprise Linux 7
remi-php55-debuginfo/x86_64 Les RPM de remi de PHP 5.5 pour Enterprise Linux 7
!remi-php56 Les RPM de remi de PHP 5.6 pour Enterprise Linux 7
remi-php56-debuginfo/x86_64 Les RPM de remi de PHP 5.6 pour Enterprise Linux 7
remi-test Les RPM de remi en test pour Enterprise Linux 7 -
remi-test-debuginfo/x86_64 Les RPM de remi en test pour Enterprise Linux 7 -

从输出可知,有三个REMI仓库,分别是remi、remi-php55和remi-php56。默认情况下,这三个REMI仓库都处于禁用状态,但是最好禁用REMI仓库,只有在需要的时候再启用,以防止多个yum源产生冲突。

从输出可知,有三个REMI仓库,分别是remi、remi-php55和remi-php56。默认情况下,这三个REMI仓库都处于禁用状态,但是最好禁用REMI仓库,只有在需要的时候再启用,以防止多个yum源产生冲突。

要搜索REMI仓库中是否有可用的包,可以执行如下命令。

    [root@localhost ~]# yum --enablerepo=remi list php

或者

    [root@localhost ~]# yum --enablerepo=remi-php72 list php

通过这种方式,就可以很方便地安装自己需要的PHP版本。例如,要安装PHP,7.2版本,执行如下命令即可。

    [root@localhost ~]# yum --enablerepo=remi-php72 install php

通过这样方式,PHP很快就可以安装完成。

问题会出现在第一步、

需要安装epel源。

解决方法: 一句话:把/etc/yum.repos.d/epel.repo,文件第3行注释去掉,把第四行注释掉。具体如下:

打开/etc/yum.repos.d/epel.repo,将配置文件修改为如下即可 :

[epel]
name=Extra Packages for Enterprise Linux 7 - $basearch
baseurl=http://download.fedoraproject.org/pub/epel/7/$basearch
#metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=$basearch
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7

[epel-debuginfo]
name=Extra Packages for Enterprise Linux 7 - $basearch - Debug
#baseurl=http://download.fedoraproject.org/pub/epel/7/$basearch/debug
metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-debug-7&arch=$basearch
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
gpgcheck=1

[epel-source]
name=Extra Packages for Enterprise Linux 7 - $basearch - Source
baseurl=http://download.fedoraproject.org/pub/epel/7/SRPMS
#metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-source-7&arch=$basearch
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
gpgcheck=1

再清理源,重新安装

  1. yum clean all
  2. yum install -y 需要的包

如果还是不行,修改DNS,到/etc/resolv.conf下添加一下:

nameserver 8.8.8.8
search localdomain

然后重启network服务:service network restart

centos7 升级php7 添加配置epel源 报错:Cannot retrieve metalink for repository: epel. Please verify its path and try again的更多相关文章

  1. 安装Nginx报错“Cannot retrieve metalink for repository: epel. Please verify its path and try again”

    CentOS 6.5中通过yum安装nginx报错. 搜了一下,很多都是修改某个配置文件的.但是在StackOverFlow的某个问题下,有人回答说修改配置文件并不是一个好的方法,虽然我采用了这个人的 ...

  2. yum报错: Error: Cannot retrieve metalink for repository: epel. Please verify its path and try again

    在Centos 5.x或6.x上安装RHEL EPEL Repo repository,资源库,源的意思.RHEL EPEL(Extra Packages for Enterprise Linux)  ...

  3. 运行yum报错:Error: Cannot retrieve metalink for repository: epel. Please verify its path

    Error: Cannot retrieve metalink for repository: epel. Please verify its path and try again 当我们安装第三方扩 ...

  4. 运行yum报错Error: Cannot retrieve metalink for repository: epel. Please verify its path and try again

    今天给Centos通过rpm -Uvh装了个epel的扩展后,执行yum就开始报错: Error: Cannot retrieve metalink for repository: epel. Ple ...

  5. Cannot retrieve metalink for repository: epel/x86_64. Please verify its path and try again 问题分析

    Cannot retrieve metalink for repository: epel/x86_64. Please verify its path and try again Loaded pl ...

  6. yum安装时出现:Cannot retrieve metalink for repository: epel. Please verify its path and try again

    在CentOS 6.3 x86_64下安装php-mcrypt的时候出现了问题:Error: Cannot retrieve metalink for repository: epel. Please ...

  7. Cannot retrieve metalink for repository: epel/x86_64. Please verify its path and try again

    虚拟机恢复快照后,使用yum安装软件,提示下面的信息,开始以为是yum源的问题或者DNS的问题,但是无果,最后再看一下服务器的时间,坑了,还原快照,时间变成以前的了. [root@localhost ...

  8. Cannot retrieve metalink for repository: epel 错误解决办法

    centos下安装完EPEL源, 然后更新一下yum缓存, 如果发现这样的错误:Error: Cannot retrieve metalink for repository: epel. Please ...

  9. Cannot retrieve metalink for repository: epel. Please verify its path and try again

    今天在测试环境使用yum安装,遇到一个问题: Error: Cannot retrieve metalink for repository: epel. Please verify its path ...

随机推荐

  1. Python的3种执行方式

    1.Python源程序就是一个特殊格式的文本文件,可以使用任意文本编辑器软件做python的开发,python的文件扩展名为 .py   2.执行python程序的三种方式 解释器:用命令行输入:如输 ...

  2. Xshell使用教程

    Xshell 是一个强大的安全终端模拟软件,它支持SSH1, SSH2, 以及Microsoft Windows 平台的TELNET 协议.Xshell 通过互联网到远程主机的安全连接以及它创新性的设 ...

  3. zabbix使用钉钉告警

    1.钉钉创建群 2.[root@localhost ~]# vim /etc/zabbix/zabbix_server.conf # 配置文件中查找”Alert”查看告警脚本存放路径 [root@lo ...

  4. 【简单的spfa+优先队列】

    题目是给出只有x和y构成的图,相同元素走路不花费,不同元素间花费1,给出起点终点,最少花费是 #include<cstdio>#include<algorithm>#inclu ...

  5. 【转】HTTPS建立连接的过程

    原文链接:https://www.cnblogs.com/shiqi17/p/9756880.html https://www.jianshu.com/p/bd75ab32ae57 HTTP建立连接的 ...

  6. win10 + 3ds Max 2014 问题记录

    3ds Max 下载: https://zixue.3d66.com/popsoft_201.html VRay 下载: https://zixue.3d66.com/softhtml/showsof ...

  7. Paper | Squeeze-and-Excitation Networks

    目录 1. 故事 2. SENet 2.1 概况 2.2 具体 3. 实验 本文的贡献点在于:通过显式建模特征注意力机制,达到了很好的效果.这是以往被默认隐式学习的操作.并且注意,此时建模出来的注意力 ...

  8. sessionStorage 、localStorage 、 cookie 和session之间的区别

    四者的异同 特性 Session   Cookie localStorage sessionStorage 数据的生命期   在一定时间内保存在服务器上.当访问增多,会比较占用你服务器的性能,考虑到减 ...

  9. 微信小程序开发-蓝牙功能开发

    0. 前言 这两天刚好了解了一下微信小程序的蓝牙功能.主要用于配网功能.发现微信的小程序蓝牙API已经封装的很好了.编程起来很方便.什么蓝牙知识都不懂的情况下,不到两天就晚上数据的收发了,剩下的就是数 ...

  10. 【Linux命令】Linux命令后面所接选项和参数的区别

    Linux命令后面所接选项和参数的区别 在使用Linux命令时,有时候后面会跟一些"选项"(options)或"参数"(agruments) 命令格式为: #中 ...