1, 安装mysql
# cd /home/eric/下载/software/dev/server/lamp/
# tar -zxvf mysql-5.1.44.tar.gz
或者使用下面解压
gunzip < mysql-5.1.44.tar.gz | tar -xvf -
为运行mysql建个新组和一个新用户名
# groupadd mysql
# useradd -g mysql mysql
# cd mysql-5.1.44
下面进行配置,mysql需要libncurses5-dev否则会出现 error: no curses/termcap library,先要确认自己系统里安装过libncurses5-dev,如果没有的话configure时会出错,我电脑上就没有,先用apt-get安装之,centos系统则用yum,包名可以自己查询一下。参见步骤0 - 安装基本支持库
# ./configure --prefix=/usr/local/webserver/mysql --enable-assembler --with-charset=utf8 --with-extra-charsets=complex --enable-local-infile --with-big-tables --with-readline --with-ssl --with-embedded-server --enable-thread-safe-client --with-plugins=innobase
# make
# make install
# cd support-files
# cp my-medium.cnf /usr/local/webserver/mysql/etc/my.cnf
# cd /usr/local/webserver/mysql
#bin/mysql_install_db --user=mysql --basedir=/usr/local/webserver/mysql --datadir=/usr/local/webserver/mysql/data
在这里如果不指定basedir,datadir则会报错找不到mysqld
调整权限
# chown -R root .
# chown -R mysql lib data etc
# chgrp -R mysql .
2, 安装apache
# cd /home/eric/下载/software/dev/server/lamp/
# tar zxvf httpd-2.2.14.tar.gz
# cd lamp/httpd-2.2.14
# ./configure --prefix=/usr/local/webserver/apache --enable-so --enable-mods-shared=all
# make
# make install
将
<Directory />
</Directory>
和
<Directory "/usr/local/webserver/apache/htdocs">
</Directory>
俩节相应的部分改为 (如有必要,比如不使用虚拟主机来跑网站,要设置虚拟主机可以修改/etc/hosts来增加一点虚拟的域名)
AllowOverride All
Order allow,deny
Allow from all
Shift + G 转到配置文件末尾
取消掉对Virtual hosts和various default settings俩项include的注释
3, 安装php和一些扩展
3.1 安装编译php5.3所需的基本支持库
# cd /home/eric/下载/software/dev/server/lamp/
# tar zxvf libiconv-1.13.1.tar.gz
# cd libiconv-1.13.1
# ./configure --prefix=/usr/local
# make
# make install
# cd ..
# tar zxvf libmcrypt-2.5.8.tar.gz
# cd libmcrypt-2.5.8
# ./configure
# make
# make install
# /sbin/ldconfig
# cd libltdl
# ./configure --enable-ltdl-install
# make
# make install
# cd ../..
# tar zxvf mhash-0.9.9.9.tar.gz
# cd mhash-0.9.9.9
# ./configure
# make
# make install
# cd ..
# tar zxvf mcrypt-2.6.8.tar.gz
# cd mcrypt-2.6.8/
# /sbin/ldconfig
# ./configure
# make
# make install
# cd ../
没有先安装libperl-dev的话,这里make install会遇到麻烦,而在centos服务器上似乎无此问题
# tar zxvf ImageMagick.tar.gz
# cd ImageMagick-6.6.0-0
# ./configure
# make
# make install
# cd ..
3.3 安装php扩展模块
# tar zxvf memcache-2.2.5.tgz
# cd memcache-2.2.5/
# /usr/local/webserver/php/bin/phpize
# ./configure --with-php-config=/usr/local/webserver/php/bin/php-config
# make
# make install
# cd ../
# tar zxvf PDO_MYSQL-1.0.2.tgz
# cd PDO_MYSQL-1.0.2/
# /usr/local/webserver/php/bin/phpize
# ./configure --with-php-config=/usr/local/webserver/php/bin/php-config --with-pdo-mysql=/usr/local/webserver/mysql
# make
# make install
# cd ../
tar zxvf imagick-2.3.0.tgz
cd imagick-2.3.0/
/usr/local/webserver/php/bin/phpize
./configure --with-php-config=/usr/local/webserver/php/bin/php-config
make
make install
cd ../
安装xcache
# tar zxvf xcache-1.3.0.tar.gz
# /usr/local/webserver/php/bin/phpize
# ./configure --enable-xcache --enable-xcache-coverager --with-php-config=/usr/local/webserver/php/bin/php-config
# make
# make install
# cat xcache.ini >> /usr/local/webserver/php/etc/php.ini
# vi /etc/hosts
添加俩行
127.0.0.1 test.local
127.0.0.1 www.test.local
下面为apache添加一个虚拟主机
# cd /usr/local/webserver/apache/conf/extra/
# vi httpd-vhosts.conf
将配置文件中原先俩个用来演示的配置注释掉,添加如下指令
<VirtualHost *:80>
ServerAdmin greathqy@gmail.com
DocumentRoot "/home/eric/projects/php/testing"
ServerName www.test.local
ErrorLog "logs/testing-error_log"
CustomLog "logs/testing-access_log" common
<Directory "/home/eric/projects/php/testing">
Options Indexes FollowSymLinks
AllowOverride All
Order deny,allow
Allow from all
</Directory>
</VirtualHost>
保存并关闭