2012年7月6日星期五

在debian squeeze上编译安装mysql-5.5.24

由于mysql-5.5已经发布,为了观察mysql-5.5的性能如何,这次决定在deiban上使用mysql-5.5.24,但debian源上并没有mysql-5.5,因此需要编译安装。

准备
首先去下载mysql-5.5.24

另外从源码编译mysql-5.5.24还需要安装以下包:
aptitute install cmake make gcc g++ ncurses-dev

编译及安装
解压源码包:
tar xvf mysql-5.5.24.tar.gz && cd mysql-5.5.24

编译及安装:
cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql-5.5.24 && make && make install

后续操作
添加用户和用户组并修改属主:
groupadd mysql
useradd -r -g mysql mysql
cd /usr/local/mysql-5.5.24
chown -R mysql .
chgrp -R mysql .
scripts/mysql_install_db --user=mysql
chown -R root .

参考
源码包中的INSTALL-SOURCE关于安装mysql需要的软件:
Source Installation System Requirements

   Installation of MySQL from source requires several development
   tools. Some of these tools are needed no matter whether you use a
   standard source distribution or a development source tree. Other
   tool requirements depend on which installation method you use.

   To install MySQL from source, your system must have the following
   tools, regardless of installation method:

     * CMake, which is used as the build framework on all platforms.
       CMake can be downloaded from http://www.cmake.org.

     * A good make program. Although some platforms come with their
       own make implementations, it is highly recommended that you
       use GNU make 3.75 or newer. It may already be available on
       your system as gmake. GNU make is available from
       http://www.gnu.org/software/make/.

     * A working ANSI C++ compiler. GCC 4.2.1 or later, Sun Studio 10
       or later, Visual Studio 2008 or later, and many current
       vendor-supplied compilers are known to work.

     * Perl is needed if you intend to run test scripts. Most
       Unix-like systems include Perl. On Windows, you can use a
       version such as ActiveState Perl.
源码包中INSTALL-SOURCE关于mysql的相关操作步骤:
# Preconfiguration setup
shell> groupadd mysql
shell> useradd -r -g mysql mysql
# Beginning of source-build specific instructions
shell> tar zxvf mysql-VERSION.tar.gz
shell> cd mysql-VERSION
shell> cmake .
shell> make
shell> make install
# End of source-build specific instructions
# Postinstallation setup
shell> cd /usr/local/mysql
shell> chown -R mysql .
shell> chgrp -R mysql .
shell> scripts/mysql_install_db --user=mysql
shell> chown -R root .
shell> chown -R mysql data
# Next command is optional
shell> cp support-files/my-medium.cnf /etc/my.cnf
shell> bin/mysqld_safe --user=mysql &
# Next command is optional
shell> cp support-files/mysql.server /etc/init.d/mysql.server

没有评论: