RPMパッケージを利用してMySQL4.1をCentOS6.4にインストールする
環境
- CentOS6.4
VagrantのBox(Vagrantbox.es)は下記を利用している。
CentOS 6.4 x86_64 Minimal (VirtualBox Guest Additions 4.3.2, Chef 11.8.0, Puppet 3.3.1)
RPMパッケージの選定
インストールしたいのはメジャーバージョンがMySQL4.1でマイナーバージョンが最新のものなので、 Index of /MySQL/Downloads/MySQL-4.1 を見ると、メジャーバージョンの最新は「4.1.22」らしい。
MySQL公式ドキュメント Index of /MySQL/Downloads/MySQL-4.1 を参照すると、VagrantのBoxとして「CentOS 6.4 x86_64 Minimal」を利用しているので、PLATFORMは「glibc23」、CPU値*1は「x86_64」のRPMパッケージをインストールすればいいようだ。
今回は下記のRPMパッケージを利用する。
- MySQL-server-4.1.22-0.glibc23.x86_64.rpm
- MySQL-client-4.1.22-0.glibc23.x86_64.rpm
- MySQL-devel-4.1.22-0.glibc23.x86_64.rpm
- MySQL-shared-4.1.22-0.glibc23.x86_64.rpm
インストール手順
スーパーユーザになっておく。
$ su -
既存のMySQLパッケージを調べる。
# rpm -qa | grep mysql mysql-libs-5.1.66-2.el6_3.x86_64
既存のパッケージをアンインストールしておく。
# yum -y remove mysql-libs
RPMパッケージをDLする。
# cd /usr/local/src # wget http://download.softagency.net/MySQL/Downloads/MySQL-4.1/MySQL-server-4.1.22-0.glibc23.x86_64.rpm # wget http://download.softagency.net/MySQL/Downloads/MySQL-4.1/MySQL-client-4.1.22-0.glibc23.x86_64.rpm # wget http://download.softagency.net/MySQL/Downloads/MySQL-4.1/MySQL-devel-4.1.22-0.glibc23.x86_64.rpm # wget http://download.softagency.net/MySQL/Downloads/MySQL-4.1/MySQL-shared-4.1.22-0.glibc23.x86_64.rpm
DLしたRPMパッケージをインストールする。
※ rpmコマンド(rpm -ivh MySQL-*
)ではなく、yumコマンドを使うと依存関係のある「perl-DBI」も同時にインストールしてくれる。
# ls -all total 20752 -rw-r--r-- 1 root root 4478227 Nov 23 2006 MySQL-client-4.1.22-0.glibc23.x86_64.rpm -rw-r--r-- 1 root root 2917745 Nov 23 2006 MySQL-devel-4.1.22-0.glibc23.x86_64.rpm -rw-r--r-- 1 root root 12605102 Nov 23 2006 MySQL-server-4.1.22-0.glibc23.x86_64.rpm -rw-r--r-- 1 root root 1238667 Nov 23 2006 MySQL-shared-4.1.22-0.glibc23.x86_64.rpm # yum -y install MySQL* (省略) Installed: MySQL-client.x86_64 0:4.1.22-0.glibc23 MySQL-devel.x86_64 0:4.1.22-0.glibc23 MySQL-server.x86_64 0:4.1.22-0.glibc23 MySQL-shared.x86_64 0:4.1.22-0.glibc23 Dependency Installed: perl-DBI.x86_64 0:1.609-4.el6 Complete!
細かい設定は置いておいて、MySQLのRPMパッケージのインストールのみ完了。
メモ
perl(DBI) is needed by 〜
RPMパッケージをインストールする際に、下記のようなエラーメッセージが出る場合は「perl-DBI」をインストールすること。
# rpm -ivh MySQL-* error: Failed dependencies: perl(DBI) is needed by MySQL-client-4.1.22-0.glibc23.x86_64 perl(DBI) is needed by MySQL-server-4.1.22-0.glibc23.x86_64
# yum -y install perl-DBI
file 〜 from install of 〜 conflicts with file from package 〜
CentOS 6.4 にはデフォルトで 5.1 系の mysql-libs がインストールされており、mysql-libs に依存しているパッケージがいくつかあります。
インストール時にパッケージがコンフリクトした場合、
# rpm -i MySQL-server-4.1.22-0.glibc23.x86_64.rpm file /usr/share/mysql/charsets/README from install of MySQL-server-4.1.22-0.glibc23.x86_64 conflicts with file from package mysql-libs-5.1.66-2.el6_3.x86_64 (省略)
インストール済みのパッケージを調べ、
# rpm -qa | grep mysql mysql-libs-5.1.66-2.el6_3.x86_64
コンフリクトしたパッケージをアンインストールする。
# yum -y remove mysql-libs
※ rpmコマンドを使用すると、下記のように依存関係にあるパッケージをアンインストールしてくれないので、yumコマンドを使用するとよい。
# rpm -e mysql-libs-5.1.66-2.el6_3.x86_64 error: Failed dependencies: libmysqlclient.so.16()(64bit) is needed by (installed) postfix-2:2.6.6-2.2.el6_1.x86_64 libmysqlclient.so.16(libmysqlclient_16)(64bit) is needed by (installed) postfix-2:2.6.6-2.2.el6_1.x86_64 mysql-libs is needed by (installed) postfix-2:2.6.6-2.2.el6_1.x86_64
rpmコマンドでインストールする場合
rpmコマンドで「MySQL-client-4.1.22-0.glibc23.x86_64」と「MySQL-server-4.1.22-0.glibc23.x86_64」をインストールする場合、perl-DBIをインストールする必要がある。
# yum -y install perl-DBI # rpm -ivh MySQL-* Preparing... ########################################### [100%] 1:MySQL-shared ########################################### [ 25%] 2:MySQL-server ########################################### [ 50%] PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER ! To do so, start the server, then issue the following commands: /usr/bin/mysqladmin -u root password 'new-password' /usr/bin/mysqladmin -u root -h localhost.localdomain password 'new-password' See the manual for more instructions. Please report any problems with the /usr/bin/mysqlbug script! The latest information about MySQL is available on the web at http://www.mysql.com Support MySQL by buying support/licenses at http://shop.mysql.com Starting MySQL SUCCESS! 3:MySQL-devel ########################################### [ 75%] 4:MySQL-client ########################################### [100%]