编译配置LAMP环境
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=bundled
- make; 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环境, 感谢原作者分享。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Google has introduced DisplayPort Alternate Mode with the Pixel 8 series, and it's present on the newly launched Pixel 9 lineup. While it's mainly there to let you mirror the smartphone display with a connected screen, you can also use it for desktop

Google AI has started to provide developers with access to extended context windows and cost-saving features, starting with the Gemini 1.5 Pro large language model (LLM). Previously available through a waitlist, the full 2 million token context windo

Google recently responded to the performance concerns about the Tensor G4 of the Pixel 9 line. The company said that the SoC wasn't designed to beat benchmarks. Instead, the team focused on making it perform well in the areas where Google wants the c

Google's AI assistant, Gemini, is set to become even more capable, if the APK teardown of the latest update (v15.29.34.29 beta) is to be considered. The tech behemoth's new AI assistant could reportedly get several new extensions. These extensions wi

The Pixel 9 series is almost here, having been scheduled for an August 13 release. Based on recent rumours, the Pixel 9, Pixel 9 Pro and Pixel 9 Pro XL will mirror the Pixel 8 and Pixel 8 Pro (curr. $749 on Amazon) by starting with 128 GB of storage.

A few months have passed since Android Authority demonstrated a new Android desktop mode that Google had hidden away within Android 14 QPR3 Beta 2.1. Arriving hot on the heels of Google adding DisplayPort Alt Mode support for the Pixel 8 and Pixel 8

More promotional materials relating to the Pixel 9 series have leaked online. For reference, the new leak arrived shortly after 91mobiles shared multiple images that also showcased the Pixel Buds Pro 2 and Pixel Watch 3 or Pixel Watch 3 XL. This time

Google is roughly a fortnight away from fully revealing new hardware. As usual, countless sources have leaked details about new Pixel devices, whether that be the Pixel Watch 3, Pixel Buds Pro 2 or Pixel 9 smartphones. It also seems that the company
