LAMP--源码MySQL集群版搭建
环境:RHEL6.1 x86
软件如下:
#ls
apr-1.4.6.tar.g memcached-1.4.13.tar.gz pcre-7.9.tar.gz
apr-iconv-1.2.1.tar.gz libevent-2.0.18-stable.tar.gz mysql-cluster-gpl-7.0.5.tar.gz
apr-util-1.4.1.tar.gz libiconv-1.13.tar.gz httpd-2.2.22.tar.gz
mysql-cluster-gpl-7.2.5.tar.gz jdk-6u18-ea-bin-b02-linux-i586-09_sep_2009.bin
1.卸载系统自带Java
# yum remove java -y
2.安装 java
#./ jdk-6u18-ea-bin-b02-linux-i586-09_sep_2009.bin
#mv jdk1.6.0_18/ /usr/java
# vim /etc/profile
---------------------加入如下内容到/etc/profile中---------------------
JAVA_HOME=/usr/java
CLASS_PATH=/usr/java/jre:/usr/java/lib
PATH=$PATH:/usr/java/bin/
---------------------------------------------------------------------------------
3.环境要生效
#source /etc/profile
4.libevent
libevent-2.0.18-stable.tar.gz --> 解压
#./configure
#make && make install
#echo /usr/local/lib >/etc/ld.so.conf.d/lamp.conf
# ldconfig //执行ldconfig使库生效
5编译 memcached
memcached-1.4.13.tar.gz --> 解压
#./configure --enable-sasl--enable-sasl-pwdb --with-libevent=/usr/local
#make && make install
6.安装 mysql-cluster <保证系统中有mysql用户,uid=27 gid=27 >
mysql-cluster-gpl-7.2.5.tar.gz
如果之前安装过MySQL则执行以下a、b操作:
a. stop mysql 停库
b. rm -rf /usr/local/mysql 删除MySQL安装目录
#cmake-DCMAKE_INSTALL_PREFIX:PATH=/usr/local/mysql -DMYSQL_DATADIR:PATH=/database-DMEMCACHED_HOME:PATH=/usr/local -DWITH_CLASSPATH:STRING=/usr/java-DWITH_EXTRA_CHARSETS:STRING=all -DWITH_INNOBASE_STORAGE_ENGINE:BOOL=ON-DWITH_NDBCLUSTER_STORAGE_ENGINE:BOOL=ON-DWITH_PARTITION_STORAGE_ENGINE:BOOL=ON-DWITH_PERFSCHEMA_STORAGE_ENGINE:BOOL=ON
#make && make install
c.启动脚本
#cp /usr/src/lamp/mysql-cluster-gpl-7.2.5/support-files/mysql.server/etc/rc.d/init.d/mysql5
d.配置文件
# mkdir /usr/local/mysql/etc
#vim /usr/local/mysql/etc/my.cnf
# cat /usr/local/mysql/etc
[mysqld]
user=mysql
basedir=/usr/local/mysql
datadir=/database
socket=/var/run/mysqld/mysql5.socket
pid-file=/var/run/mysqld/mysql5.pid
general-log
general-log-file=/var/log/mysqld/mysql5-access.log
log-error=/var/log/mysqld/mysql5-error.log
port=3306
e.startup
Apache及其相关软件安装
//删除之前安装的Apache目录
# rm -rf /usr/local/apache2
# yum install -y openssl* nss-develbzip2-devel libzip-* net-snmp-*
//yum安装之后所需要的一些软件
apr-1.4.6.tar.gz --> 解压
#./configure --disable-ipv6--enable-threads
#make && make install
……
Libraries have been installed in:
/usr/local/apr/lib
……
#echo /usr/local/apr/lib >>/etc/ld.so.conf.d/lamp.conf
//把/usr/local/apr/lib加入库共享库目录中,执行ldconfig命令生效
libiconv-1.13.tar.gz --> 解压
#./configure --enable-static
#make && make install
apr-iconv-1.2.1.tar.gz --> 解压
# ./configure--with-apr=/usr/local/apr/bin/apr-1-config
#make && make install
apr-util-1.4.1.tar.gz --> 解压
#ln -s /usr/src/lamp/apr-iconv-1.2.1/usr/src/lamp/apr-util-1.4.1/apr-iconv
#./configure--with-apr=/usr/local/apr/bin/apr-1-config --with-apr-iconv=./arp-iconv--with-openssl=/usr --with-nss=/usr --with-mysql=/usr/local/mysql--with-iconv=/usr/local
#make && make install
pcre-7.9.tar.gz --> 解压
#./configure --enable-rebuild-chartables--enable-utf8 --enable-newline-is-any --enable-pcregrep-libz --enable-pcregrep-libbz2
# make && make install
httpd-2.2.22.tar.gz --> 解压
# ./configure--enable-modules=all --enable-mods-shared=all --enable-file-cache--enable-cache --enable-disk-cache --enable-mem-cache --enable-dumpio--enable-echo --enable-example --enable-logio --enable-mime-magic--enable-expires --enable-headers --enable-unique-id --enable-proxy--enable-proxy-balancer --enable-proxy-http --enable-proxy-ajp--enable-proxy-connect --enable-ssl --enable-static-ab --enable-http--enable-info --enable-cgi --enable-vhost-alias --enable-so --enable-rewrite--with-apr=/usr/local/apr/bin/apr-1-config--with-apr-util=/usr/local/apr/bin/apu-1-config --with-pcre=/usr/local--with-ssl=/usr --with-mpm=prefork
#make && make install
