3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

CentOS6.4でPHPのRPMをリビルドしてMySQL5.6のRPMを使う

Posted at

CentOS6.4でMySQL5.6でphpMyAdminをっていう要件が出たのでPHPをソースから入れるのもあれだし@baseリポジトリのSRPMをリビルドしてパッケージを作る (できればこの作業はビルド専用の環境でやろう)

まずRPMビルドのための環境構築をする

% sudo yum install rpm-build
% echo "%_topdir $HOME/rpms" > ~/.rpmmacros
% mkdir -p ~/rpms/{BUILD,SOURCES,SPECS,SRPMS,RPMS}

PHPのSRPMを持ってきて入れる

% wget http://vault.centos.org/6.4/os/Source/SPackages/php-5.3.3-22.el6.src.rpm
% rpm -ivh php-5.3.3-22.el6.src.rpm

もし入っていればMySQL関連のパッケージを削除しておく

% sudo yum remove mysql

とりあえずリビルド

% rpmbuild -ba ~/rpms/SPECS/php.spec

をすると、パッケージが足りないというエラーが出たのでmysql-develを除外して求められたパッケージを入れる

% sudo yum -y install bzip2-devel db4-devel gmp-devel httpd-devel pam-devel pcre-devel libedit-devel libtool-ltdl-devel libc-client-devel cyrus-sasl-devel openldap-devel postgresql-devel unixODBC-devel net-snmp-devel libxslt-devel libXpm-devel libtidy-devel aspell-devel recode-devel libicu-devel enchant-devel

次にMySQLの公式RPMを入れる

% sudo yum -y localinstall \
http://ftp.jaist.ac.jp/pub/mysql/Downloads/MySQL-5.6/MySQL-client-5.6.11-2.el6.x86_64.rpm \
http://ftp.jaist.ac.jp/pub/mysql/Downloads/MySQL-5.6/MySQL-devel-5.6.11-2.el6.x86_64.rpm \
http://ftp.jaist.ac.jp/pub/mysql/Downloads/MySQL-5.6/MySQL-embedded-5.6.11-2.el6.x86_64.rpm \
http://ftp.jaist.ac.jp/pub/mysql/Downloads/MySQL-5.6/MySQL-server-5.6.11-2.el6.x86_64.rpm \
http://ftp.jaist.ac.jp/pub/mysql/Downloads/MySQL-5.6/MySQL-shared-5.6.11-2.el6.x86_64.rpm \
http://ftp.jaist.ac.jp/pub/mysql/Downloads/MySQL-5.6/MySQL-shared-compat-5.6.11-2.el6.x86_64.rpm \
http://ftp.jaist.ac.jp/pub/mysql/Downloads/MySQL-5.6/MySQL-test-5.6.11-2.el6.x86_64.rpm

mysql_configのパスを調べる

% type -a mysql_config
mysql_config is /usr/bin/mysql_config

SPECファイルを修正する(mysql_configのパスとパッケージ名)

% vi ~/rpms/SPECS/php.spec
- %define mysql_config %{_libdir}/mysql/mysql_config
+ %define mysql_config %{_bindir}/mysql_config
- BuildRequires: mysql-devel >= 4.1.0
+ BuildRequires: MySQL-devel >= 4.1.0

再度リビルド

% rpmbuild -ba ~/rpms/SPECS/php.spec

リビルドがうまく行ったら作成したPHPパッケージを入れてみる

% sudo yum localinstall ~/rpms/php-*.rpm

とりあえずうごいた

3
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?