Posted on 

CentOS 7 安裝 remi repository 並透過 remi 安裝 php 5.4、5.5、5.6

首先到 http://dl.fedoraproject.org/pub/epel/7/x86_64/e/ 找檔案名稱類似為 epel-release-X.noarch.rpm

中間的大 X 是版本,因為版本隨時都在變,過一陣子就會換版本,所以用這方法找檔案比較保險

以下以本文發佈後最新的版本 7.1 來當範例

1
2
wget http://dl.fedoraproject.org/pub/epel/beta/7/x86_64/epel-release-7-1.noarch.rpm
wget http://rpms.famillecollet.com/enterprise/remi-release-7.rpm

下載完後執行以下指令

1
rpm -ivh epel-release-*.rpm remi-release-*.rpm

執行時會看到類似進度條的東西在跑,跑到 100% 就好了

來在透過 yum 安裝 php,請執行以下指令

1
yum --enablerepo=remi install php

預設會安裝 php 5.4 最新版

如果要安裝 php 5.5,請執行以下指令

1
yum --enablerepo=**remi-php55,**remi install php

是的,在 enablerepo 處打上 remi-php55

如果要安裝 5.6,將 remi-php55 改成 remi-php56 就可以囉~~~

參考來源文章:

PHP 5.4.30 and 5.5.14 - Les RPM de Remi - Blog
Install Remi and EPEL yum repo Centos 7 - Brian Nelson Ramblings
How to Enable EPEL Repository for RHEL/CentOS 7.x/6.x/5.x