google docs版本在此,欢迎参与完善文档 https://docs.google.com/document/d/14ed599rn9yqvt_v_bi8ukwbfpmtwz3la73-kipwf4_m/edit 发现google docs没法像zoho那样把文档嵌入html,所以只好粘贴一份在这里。 编译安装 安装apache依赖库pcre 8.3: 解压源码,
google docs版本在此,欢迎参与完善文档
https://docs.google.com/document/d/14ed599rn9yqvt_v_bi8ukwbfpmtwz3la73-kipwf4_m/edit
发现google docs没法像zoho那样把文档嵌入html,所以只好粘贴一份在这里。
编译安装安装apache依赖库pcre 8.3:解压源码,运行命令
$./configure –prefix=/data/cherrotluo/local/pcre$make$make install安装apache httpd 2.4:下载apache httpd源码解压,然后下载apr和apr-utils分别放置在httpd源码目录的srclib/apr和srclib/apr-util目录。执行命令
$./configure –prefix=/data/cherrotluo/local/httpd –with-included-apr –with-pcre=/data/cherrotluo/local/pcre$make$make install安装mysql 5.5.25a:安装cmake。mysql 5.5 使用cmake代替configure脚本配置安装过程。所以需要实现安装或编译安装cmake,很简单,不再赘述。使用cmake配置mysql。参考mysql官方文档:http://forge.mysql.com/wiki/cmake#very_quick_how-to-build
和这篇教程: http://www.cnblogs.com/church/archive/2012/07/17/2595749.html
最终我的配置命令是:
$mkdir build-cherrot
$cd build-cherrot
$/cmake \
#安装目录
-dcmake_install_prefix=/data/cherrotluo/local/mysql \
#数据库存放目录
-dmysql_datadir=~/data/mysql \
#unix socket文件路径
-dmysql_unix_addr=~/data/mysql/mysql.socket \
#安装myisam存储引擎
-dwith_myisam_storage_engine=1 \
#安装innobase存储引擎
-dwith_innobase_storage_engine=1 \
#安装archieve存储引擎
-dwith_archive_storage_engine=1 \
#安装blackhole存储引擎
-dwith_blackhole_storage_engine=1 \
#安装数据库分区存储引擎
-dwith_partition_storage_engine=1 \
#允许从本地导入数据
-denabled_local_infile=1 \
#使用mysql源码中自带的zlib库。我的系统zlib库版本较老,如果没有这一句,虽然可以通过cmake,但make到56%时会出错误:storage/innobase/page/page0zip.c:2968: error: `z_block’ undeclared (first use in this function) (参见: http://bugs.mysql.com/bug.php?id=65856)
-dwith_zlib=bundled \
#使用系统readline库实现快捷键功能
-dwith_readline=system \
#使用系统自带ssl库
-dwith_ssl=system \
#使用utf-8字符集
-ddefault_charset=utf8 \
#校验字符集
-ddefault_collation=utf8_general_ci \
#安装全部扩展字符集
-dextra_charsets=all \
#设定监听端口
-dmysql_tcp_port=8600 ..安装mysql 5.1因为机器上已经有一个mysql 5.0了,和5.5大大的不兼容(https://discussions.apple.com/thread/2698727),于是退回5.1重新编译
./configure –prefix=/data/cherrotluo/local/mysql5.1 –localstatedir=/data/cherrotluo/data/mysql –enable-local-infile –with-charset=utf8 –with-collation=utf8_general_ci –with-extra-charsets=all ?–with-unix-socket-path=/data/cherrotluo/data/mysql/mysql.socket –with-tcp-port=8600 ?–with-mysqld-user=cherrotluo –with-zlib-dir=bundledmake; make install初始化数据库:
./bin/mysql_install_db –datadir=/data/cherrotluo/data/mysql使用自己的配置文件启动mysqld:
./bin/mysqld_safe –defaults-file=~/source/mysql-5.1.63/support-files/my-large.cnf修改密码:
mysqladmin -u root -h 127.0.0.1 password ‘new-password’ #使用localhost代替127.0.0.1时还需要使用 -s 指定socket路径安装php5.4.5./configure –prefix=/data/cherrotluo/local/php –with-apxs2=/data/cherrotluo/local/httpd… –with-mysql=/data/cherrot/local/mysql5.1/ –with-mysql-sock=/data/cherrotluo/data/mysql/ –with-pdo-mysql=/data/cherrot/local/mysql5.1/make; make install多实例运行多实例运行主要涉及到是mysql多实例和apache多实例。
mysql多实例运行$mysqld_safe –defaults-file=~/data/mysql/my.cnf
$mysql -h localhost -p 8600 -s ~/data/mysql/mysql.socket -u root -p
#或者 $mysql -h 127.0.0.1 -p 8600 -u root -p, 下面命令同理可以替换
$mysqladmin -h localhost -p 8600 -s ~/data/mysql/mysql.socket -u root -p shutdown
默认开启了匿名用户,因此只能使用root或者不指定用户密码匿名登录,使用其他用户登录会提示access denied。删除匿名用户后就可以使用其他用户登录mysql了。
编辑配置文件(my.cnf),将no-auto-rehash改为auto-rehash以支持自动补全。客户端连接数据库时多加一个 –auto-rehash 参数就可以tab自动补全了,但只能补全表、列名。
原文地址:编译配置lamp环境, 感谢原作者分享。
