2009/02/26

MySQL 3.23.58 を CentOS 5.2 にインストールする

MySQL ::  世界でもっとも普及している、オープン ソース データベース
[10.09.15 update]ソースファイルのリンクを修正

自社サーバを一台新調することになったのですが、とある事情から MySQL は Ver 3.23.58 を使用しなければならず、でも Apache は 2.2 系を使いたい!

というわけで、OS やその他の環境は最新の CentOS 5.2 を使用し、MySQL 3.23.58 はソースからインストールすることにしました。

しかしながら、最新の環境にきわめて古いソフトをインストールすると、ほぼ間違いなく躓くもので。


ダウンロード


まずはダウンロードですが、もはや公式サイトのアーカイブにも見当たりません・・・

ので、MySQL日本正規代理店の SoftAgency 様から拝借いたします。

既に SoftAgency 様にも見当たらなくなってしまいました。
ですので、ソースファイルはこちらにアップしておきます。

>> Download MySQL-3.23.58

$ wget http://download.softagency.net/MySQL/Downloads/MySQL-3.23/mysql-3.23.58.tar.gz
$ tar -zxvf mysql-3.23.58.tar.gz
$ cd mysql-3.23.58/


Configure


Makefile ファイルを作成するために、configure を実行します。

$ ./configure \
 --prefix=/usr/local/mysql \
 --with-charset=sjis \
 --with-extra-charsets=all \
 --with-mysqld-user=mysql \
 --without-bench \
 --localstatedir=/home/mysql/data

checking "LinuxThreads"... "Not found"
configure: error: This is a linux system and Linuxthreads was not
found. On linux Linuxthreads should be used.  Please install Linuxthreads
(or a new glibc) and try again.  See the Installation chapter in the
Reference Manual for more information.

やっぱりエラーが。

どうやら CentOS 5 では Linuxthreads はサポートされなくなったようで(CentOS 4 まではサポートされていたようです)、configure のオプションで thread の方法を指定します。

$ ./configure \
 --prefix=/usr/local/mysql \
 --with-charset=sjis \
 --with-extra-charsets=all \
 --with-mysqld-user=mysql \
 --without-bench \
 --localstatedir=/home/mysql/data \
 --with-named-thread-libs="-lpthread"

checking for termcap functions library... configure: error: No curses/termcap library found

今度は、curses library がないとおっしゃいます。インストールし、再チャレンジ。

$ yum search ncurses
ncurses.i386 : A terminal handling library
ncurses-devel.i386 : Development files for the ncurses library

$ sudo yum install ncurses.i386
Package ncurses - 5.5-24.20060715.i386 is already installed.

$ sudo yum install ncurses-devel.i386
Installed: ncurses-devel.i386 0:5.5-24.20060715
Complete!

$ ./configure \
 --prefix=/usr/local/mysql \
 --with-charset=sjis \
 --with-extra-charsets=all \
 --with-mysqld-user=mysql \
 --without-bench \
 --localstatedir=/home/mysql/data \
 --with-named-thread-libs="-lpthread"

MySQL has a Web site at http://www.mysql.com/ which carries details on the
latest release, upcoming features, and other information to make your
work or play with MySQL more productive. There you can also find
information about mailing lists for MySQL discussion.

Remember to check the platform specific part of the reference manual for
hints about installing MySQL on your platform. Also have a look at the
files in the Docs directory.

Thank you for choosing MySQL!

OK! うまくいきました!


Make


さて、お次はコンパイルです。

$ make
mysqld.o: In function `main':
mysqld.cc:(.text+0x3450): undefined reference to `my_fast_mutexattr'
mysqld.cc:(.text+0x3464): undefined reference to `my_fast_mutexattr'
mysqld.cc:(.text+0x3478): undefined reference to `my_fast_mutexattr'
mysqld.o:mysqld.cc:(.text+0x34a0): more undefined references to `my_fast_mutexattr' follow
collect2: ld returned 1 exit status
make[4]: *** [mysqld] エラー 1

my_fast_mutexattr が定義されてないと。

そこで、定義を強制するように修正します。

$ vi mysys/my_thr_init.c
/my_fast_mutexattr

#ifdef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP
pthread_mutexattr_t my_fast_mutexattr;
#endif

これを、下記のようにします。

//#ifdef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP
pthread_mutexattr_t my_fast_mutexattr;
//#endif

これでなんとかコンパイルができました。


Maike Install


最後にインストールです。ここまでくればOKでしょう。

$ sudo make install

お疲れ様です!

1 件のコメント:

Unknown さんのコメント...

ありがとうございます
This saved me.
It seems also that mysql-3.23.58 is not compatible with gXX-4.3 so I had to install also gcc-4.1 g++-4.1 cpp-4.1