Love澤's Room

技術系ネタをまとめていたブログ。現在はカテゴリにこだわらず更新中。

CentOS 6.5にGDライブラリのインストール(yumを使用)

新サイトへ移転しました
約3秒後に自動的にリダイレクトします。


phpを利用してグラフを表示させたいので、GDライブラリをインストールする。とりあえず、ググったところyumると良いらしい。簡単じゃんyumyum。

ということでyumってみた。まずは、「確かにyumでインストールできそうだなー」ってことを確認。

# yum list | grep php-gd
php-gd.x86_64                              5.3.3-27.el6_5              updates

お、ちゃんとあるじゃん。ということでインストール。

# yum -y install php-gd
Loaded plugins: downloadonly, fastestmirror, priorities, security
Loading mirror speeds from cached hostfile
 * base: ftp.iij.ad.jp
 * extras: ftp.iij.ad.jp
 * rpmforge: ftp.kddilabs.jp
 * updates: ftp.iij.ad.jp
 * webtatic: us-east.repo.webtatic.com
21 packages excluded due to repository priority protections
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package php-gd.x86_64 0:5.3.3-27.el6_5 will be installed
--> Processing Dependency: php-common(x86-64) = 5.3.3-27.el6_5 for package: php-gd-5.3.3-27.el6_5.x86_64
--> Processing Dependency: libXpm.so.4()(64bit) for package: php-gd-5.3.3-27.el6_5.x86_64
--> Running transaction check
---> Package libXpm.x86_64 0:3.5.10-2.el6 will be installed
---> Package php-common.x86_64 0:5.3.3-27.el6_5 will be installed
--> Processing Conflict: php55w-common-5.5.13-2.w6.x86_64 conflicts php-common < 5.5.0
--> Restarting Dependency Resolution with new changes.
--> Running transaction check
---> Package php55w-common.x86_64 0:5.5.13-2.w6 will be updated
--> Processing Dependency: php55w-common(x86-64) = 5.5.13-2.w6 for package: php55w-cli-5.5.13-2.w6.x86_64
--> Processing Dependency: php55w-common(x86-64) = 5.5.13-2.w6 for package: php55w-mcrypt-5.5.13-2.w6.x86_64
--> Processing Dependency: php55w-common(x86-64) = 5.5.13-2.w6 for package: php55w-pdo-5.5.13-2.w6.x86_64
--> Processing Dependency: php55w-common(x86-64) = 5.5.13-2.w6 for package: php55w-mbstring-5.5.13-2.w6.x86_64
--> Processing Dependency: php55w-common(x86-64) = 5.5.13-2.w6 for package: php55w-5.5.13-2.w6.x86_64
---> Package php55w-common.x86_64 0:5.5.14-1.w6 will be an update
--> Running transaction check
---> Package php55w.x86_64 0:5.5.13-2.w6 will be updated
---> Package php55w.x86_64 0:5.5.14-1.w6 will be an update
---> Package php55w-cli.x86_64 0:5.5.13-2.w6 will be updated
---> Package php55w-cli.x86_64 0:5.5.14-1.w6 will be an update
---> Package php55w-mbstring.x86_64 0:5.5.13-2.w6 will be updated
---> Package php55w-mbstring.x86_64 0:5.5.14-1.w6 will be an update
---> Package php55w-mcrypt.x86_64 0:5.5.13-2.w6 will be updated
---> Package php55w-mcrypt.x86_64 0:5.5.14-1.w6 will be an update
---> Package php55w-pdo.x86_64 0:5.5.13-2.w6 will be updated
---> Package php55w-pdo.x86_64 0:5.5.14-1.w6 will be an update
--> Processing Conflict: php55w-common-5.5.14-1.w6.x86_64 conflicts php-common < 5.5.0
--> Finished Dependency Resolution
Error: php55w-common conflicts with php-common-5.3.3-27.el6_5.x86_64
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest

あれ?っとおもったけど、そういえば、phpのバージョンを、5.5にあげていたのでした。気を取り直してもう一度。

# yum list | grep php55w-gd
php55w-gd.x86_64                           5.5.14-1.w6                 webtatic
# yum -y install php55w-gd

うまくいきました。GDライブラリのインストールだけでなく、依存関係のある他のパッケージもインストールして、ついでに関連パッケージをアップデートしました。

その後、apacheを再起動させれば、GDモジュールが正常に稼働しました。

# /etc/rc.d/init.d/httpd restart

思ったよりも簡単なので良かったです。めでたしめでたし。

(2014/12/27 追記)
CentOS 7.0へのインストール方法を下記の記事で紹介しています。とはいえ、ほとんど同じなのですが。