2013年12月9日月曜日

CentOS 5.8 にyumでPHP5.5をインストールする。

CentOS5.8(i386)に、yumからPHP5.5をインストールする。

始めに、remi.repoの中にremi-php55のリポジトリ設定が存在するか確認し、存在しない場合はリポジトリの追加を行って下さい。

[root@centos5.8 ~]# cat /etc/yum.repos.d/remi.repo
 - 以下、抜粋 -
[remi-php55]
name=Les RPM de remi de PHP 5.5 pour Enterprise Linux 5 - $basearch
#baseurl=http://rpms.famillecollet.com/enterprise/5/php55/$basearch/
mirrorlist=http://rpms.famillecollet.com/enterprise/5/php55/mirror
# WARNING: If you enable this repository, you must also enable "remi"
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi

さっそく、remiたんの[remi-php55]からPHP5.5を取ってみます。

[root@centos5.8 ~]# yum install --enablerepo=remi,remi-php55 php
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile

~中略~

php-cli-5.5.6-1.el5.remi.i386 from remi-php55 has depsolving problems
  --> Missing Dependency: libedit.so.0 is needed by package php-cli-5.5.6-1.el5.remi.i386 (remi-php55)
Error: Missing Dependency: libedit.so.0 is needed by package php-cli-5.5.6-1.el5.remi.i386 (remi-php55)
 You could try using --skip-broken to work around the problem
 You could try running: package-cleanup --problems
                        package-cleanup --dupes
                        rpm -Va --nofiles --nodigest

Missing Dependency
依存関係を解決出来ない様子。(*´∩ω・`)゚
結局、remi, remi-php55に加えepelリポジトリの参照指定を増やすことで解決しました。

[root@centos5.8 ~]# yum install --enablerepo=epel,remi,remi-php55 php
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile

~中略~

Dependencies Resolved

========================================================================================================================
 Package                       Arch                 Version                              Repository                Size
========================================================================================================================
Installing:
 php                           i386                 5.5.6-1.el5.remi                     remi-php55               2.9 M
Installing for dependencies:
 apr                           i386                 1.2.7-11.el5_6.5                     base                     124 k
 apr-util                      i386                 1.2.7-11.el5_5.2                     base                      80 k
 httpd                         i386                 2.2.3-83.el5.centos                  updates                  1.2 M
 libcurl                       i386                 7.27.0-11.el5.remi                   remi-php55               221 k
 libedit                       i386                 2.11-2.20080712cvs.el5               epel                      79 k
 libssh2                       i386                 1.2.7-1.el5.remi                     remi                      82 k
 libxslt                       i386                 1.1.17-4.el5_8.3                     base                     420 k
 php-cli                       i386                 5.5.6-1.el5.remi                     remi-php55               2.8 M
 php-common                    i386                 5.5.6-1.el5.remi                     remi-php55               1.2 M
 php-pear                      noarch               1:1.9.4-23.el5.remi                  remi                     428 k
 php-pecl-jsonc                i386                 1.3.2-2.el5.remi.1                   remi-php55                67 k
 php-pecl-zip                  i386                 1.12.2-2.el5.remi.5.5                remi-php55               315 k
 php-process                   i386                 5.5.6-1.el5.remi                     remi-php55                60 k
 php-xml                       i386                 5.5.6-1.el5.remi                     remi-php55               277 k
 postgresql-libs               i386                 8.1.23-6.el5_8                       base                     197 k
Updating for dependencies:
 openldap                      i386                 2.3.43-25.el5_8.1                    base                     298 k

Transaction Summary
========================================================================================================================
Install      16 Package(s)
Upgrade       1 Package(s)

Total download size: 11 M
Is this ok [y/N]: y
Downloading Packages:
(1/17): php-process-5.5.6-1.el5.remi.i386.rpm                                                    |  60 kB     00:00
(2/17): php-pecl-jsonc-1.3.2-2.el5.remi.1.i386.rpm                                               |  67 kB     00:00
(3/17): libedit-2.11-2.20080712cvs.el5.i386.rpm                                                  |  79 kB     00:00
(4/17): apr-util-1.2.7-11.el5_5.2.i386.rpm                                                       |  80 kB     00:00
(5/17): libssh2-1.2.7-1.el5.remi.i386.rpm                                                        |  82 kB     00:00
(6/17): apr-1.2.7-11.el5_6.5.i386.rpm                                                            | 124 kB     00:00
(7/17): postgresql-libs-8.1.23-6.el5_8.i386.rpm                                                  | 197 kB     00:00
(8/17): libcurl-7.27.0-11.el5.remi.i386.rpm                                                      | 221 kB     00:00
(9/17): php-xml-5.5.6-1.el5.remi.i386.rpm                                                        | 277 kB     00:00
(10/17): openldap-2.3.43-25.el5_8.1.i386.rpm                                                     | 298 kB     00:00
(11/17): php-pecl-zip-1.12.2-2.el5.remi.5.5.i386.rpm                                             | 315 kB     00:00
(12/17): libxslt-1.1.17-4.el5_8.3.i386.rpm                                                       | 420 kB     00:00
(13/17): php-pear-1.9.4-23.el5.remi.noarch.rpm                                                   | 428 kB     00:00
(14/17): php-common-5.5.6-1.el5.remi.i386.rpm                                                    | 1.2 MB     00:02
(15/17): httpd-2.2.3-83.el5.centos.i386.rpm                                                      | 1.2 MB     00:00
(16/17): php-cli-5.5.6-1.el5.remi.i386.rpm                                                       | 2.8 MB     00:05
(17/17): php-5.5.6-1.el5.remi.i386.rpm                                                           | 2.9 MB     00:04
------------------------------------------------------------------------------------------------------------------------
Total                                                                                   509 kB/s |  11 MB     00:21

Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Updating       : openldap                                                                                        1/18
  Installing     : apr                                                                                             2/18
  Installing     : postgresql-libs                                                                                 3/18
  Installing     : apr-util                                                                                        4/18
  Installing     : httpd                                                                                           5/18
  Installing     : libxslt                                                                                         6/18
  Installing     : libssh2                                                                                         7/18
  Installing     : libcurl                                                                                         8/18
  Installing     : libedit                                                                                         9/18
  Installing     : php-xml                                                                                        10/18
  Installing     : php-common                                                                                     11/18
  Installing     : php-cli                                                                                        12/18
  Installing     : php-process                                                                                    13/18
  Installing     : php-pear                                                                                       14/18
  Installing     : php-pecl-zip                                                                                   15/18
  Installing     : php                                                                                            16/18
  Installing     : php-pecl-jsonc                                                                                 17/18
  Cleanup        : openldap                                                                                       18/18

Installed:
  php.i386 0:5.5.6-1.el5.remi

Dependency Installed:
  apr.i386 0:1.2.7-11.el5_6.5                                apr-util.i386 0:1.2.7-11.el5_5.2
  httpd.i386 0:2.2.3-83.el5.centos                           libcurl.i386 0:7.27.0-11.el5.remi
  libedit.i386 0:2.11-2.20080712cvs.el5                      libssh2.i386 0:1.2.7-1.el5.remi
  libxslt.i386 0:1.1.17-4.el5_8.3                            php-cli.i386 0:5.5.6-1.el5.remi
  php-common.i386 0:5.5.6-1.el5.remi                         php-pear.noarch 1:1.9.4-23.el5.remi
  php-pecl-jsonc.i386 0:1.3.2-2.el5.remi.1                   php-pecl-zip.i386 0:1.12.2-2.el5.remi.5.5
  php-process.i386 0:5.5.6-1.el5.remi                        php-xml.i386 0:5.5.6-1.el5.remi
  postgresql-libs.i386 0:8.1.23-6.el5_8

Dependency Updated:
  openldap.i386 0:2.3.43-25.el5_8.1

Complete!


最後にインストールされたPHPのバージョンを確認して終わりにします。

[root@centos5.8 ~]# php -v
PHP 5.5.6 (cli) (built: Nov 13 2013 08:00:07)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2013 Zend Technologies

少ない内容ですがお役に立てたら嬉しいです。 c(・ω・´c⌒っ




[番外編]

PHP 5.5のphp-mcryptをインストール。

[root@centos5.8 ~]# yum install --enablerepo=remi-php55 'php-mcrypt'
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile

~中略~

Dependencies Resolved

========================================================================================================================
 Package                      Arch                 Version                             Repository                  Size
========================================================================================================================
Installing:
 php-mcrypt                   i386                 5.5.6-1.el5.remi                    remi-php55                  44 k
Installing for dependencies:
 libmcrypt                    i386                 2.5.8-4.el5.centos                  extras                     116 k
 libtool-ltdl                 i386                 1.5.22-7.el5_4                      base                        37 k

Transaction Summary
========================================================================================================================
Install       3 Package(s)
Upgrade       0 Package(s)

Total download size: 196 k
Is this ok [y/N]: y
Downloading Packages:
(1/3): libtool-ltdl-1.5.22-7.el5_4.i386.rpm                                                      |  37 kB     00:00
(2/3): php-mcrypt-5.5.6-1.el5.remi.i386.rpm                                                      |  44 kB     00:00
(3/3): libmcrypt-2.5.8-4.el5.centos.i386.rpm                                                     | 116 kB     00:00
------------------------------------------------------------------------------------------------------------------------
Total                                                                                   212 kB/s | 196 kB     00:00
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : libtool-ltdl                                                                                     1/3
  Installing     : libmcrypt                                                                                        2/3
  Installing     : php-mcrypt                                                                                       3/3

Installed:
  php-mcrypt.i386 0:5.5.6-1.el5.remi

Dependency Installed:
  libmcrypt.i386 0:2.5.8-4.el5.centos                         libtool-ltdl.i386 0:1.5.22-7.el5_4

Complete!

先日の事件もあったので、念の為に確認x確認。

[root@centos5.8 ~]# cat /etc/php.d/mcrypt.ini
; Enable mcrypt extension module
extension=mcrypt.so

(●,,`З´b)b OKッ☆