文章来自:循序渐渐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. appium---Android app资源监控

    我们在做app测试的过程中,都会对app内存,cpu这些做一个简单的测试,今天简单的写下如何通过python监控app这些资源变化 实现原理 1.通过adb命令查看app资源内存 2.通过python ...

  2. django获取某一个字段的列表 values values_list flat=true

    1.values() print(Question.objects.values('title')) #得到的是一个字典 <QuestionQuerySet [{'title': '查询优化之s ...

  3. [C2W2] Improving Deep Neural Networks : Optimization algorithms

    第二周:优化算法(Optimization algorithms) Mini-batch 梯度下降(Mini-batch gradient descent) 本周将学习优化算法,这能让你的神经网络运行 ...

  4. office 2016 下载链接

    [安装环境]:win7/win8/win10 [64位下载] 百度网盘链接:pan.baidu.com/s/1AkiLQtjhayGdx6mw1DQyqw  提取码:qyx9

  5. 线程让步yield

    一.yield()的作用 yield()的作用是让步.它能让当前线程由“运行状态”进入到“就绪状态”,从而让其它具有相同优先级的等待线程获取执行权:但是,并不能保证在当前线程调用yield()之后,其 ...

  6. zz《分布式服务架构 原理、设计与实战》综合

    这书以分布式微服务系统为主线,讲解了微服务架构设计.分布式一致性.性能优化等内容,并介绍了与微服务系统紧密联系的日志系统.全局调用链.容器化等. 还是一样,每一章摘抄一些自己觉得有用的内容,归纳整理, ...

  7. MySQL学习笔记1——DDL

    DDL 1.数据库 *查看所有数据库:SHOW DATABASES;*切换(选择要操作的)数据库:USE 数据库名;*创建数据库:CREATE DATABASES [IF NOT EXISTS] my ...

  8. Leetcode173. 二叉搜索树迭代器

    空间复杂度O(h)而不是O(n),因此不能直接在初始化函数中做中序遍历将结果存储到数组中.next()和hasNext()时间复杂度为O(1)首先本题很容易想到用二叉树的中序遍历去解决,外加注意点1. ...

  9. Java并发编程核心知识体系精讲

    第1章 开宗明义[不看错过一个亿]本章一连串设问:为什么学并发编程?学并发编程痛点?谁适合学习本课?本课程包含内容和亮点?首先4大个理由告诉你为什么要学,其实源于JD岗位要求就不得不服了.其次5个痛点 ...

  10. 【新特性速递】单元格导航(上下左右键,TAB键和ENTER键)

    上下左右按键 其实单元格导航(上下左右按键,需要启用表格的ShowSelectedCell属性)一直都存在,只不过之前的版本(v5.5.0)有一些小的BUG. BUG1 比如锁定列存在时,上下左右键只 ...