安装mysql
./configure --prefix=/opt/test/mysql --localstatedir=/opt/test/var/mysql/var --with-unix-socket-path=/opt/test/mysql/mysql.sock --with-mysqld-user=mysql --with-plugins=archive,partition,myisam,innobase,heap,csv --with-extra-charsets=gbk,gb2312,utf8,ascii --with-charset=utf8 --with-collation=utf8_general_ci --with-big-tables --enable-assembler --enable-profiling --enable-local-infile --enable-thread-safe-client --with-fast-mutexes --with-pthread --with-zlib-dir=bundled --with-readline --without-geometry --without-embedded-server --without-debug --without-ndb-debug --with-client-ldflags=-all-static --with-mysqld-ldflags=-all-static
make && make install
安装nginx
./configure --prefix=/opt/test/nginx --user=www --group=www --with-poll_module --with-http_ssl_module --with-http_gzip_static_module --with-pcre
安装php
./configure --prefix=/opt/test/php --with-mysql=/opt/test/mysql --with-curl --with-freetype-dir --enable-gd-native-ttf --with-ttf --with-sybase --with-mssql --with-zlib --with-gd --with-jpeg-dir --enable-mbstring=all --enable-mbregex --enable-soap --with-mcrypt --enable-sockets --enable-ftp --enable-zip --with-iconv --with-xsl --with-xmlrpc --with-png-dir --with-openssl --with-db4=/opt/test/db4/
Make && make install
cp php.ini-production /opt/test/php/lib/php.ini
修改extension_dir
extension_dir = "/opt/test/php/include/php/ext"
安装APC扩展
Cd APC-*
/opt/test/php/bin/phpize
./configure --with-php-config=/opt/test/php/bin/php-config
Make
cp modules/apc.so /opt/test/php/include/php/ext/
在php.ini中添加
extension=apc.so
memcache扩展
/opt/test/php/bin/phpize;./configure --with-php-config=/opt/test/php/bin/php-config
Make
cp modules/memcache.so /opt/test/php/include/php/ext/
在php.ini中添加
extension=memcache.so
安装ImageMagick
./configure
Make
Make install
安装imagick扩展
/opt/test/php/bin/phpize;./configure --with-php-config=/opt/test/php/bin/php-config
Make
cp modules/imagick.so /opt/test/php/include/php/ext/
修改php.ini
extension=imagick.so
安装MagickWandForPHP扩展
/opt/test/php/bin/phpize
./configure --with-php-config=/opt/test/php/bin/php-config
Make
cp modules/magickwand.so /opt/test/php/include/php/ext/
修改php.ini
extension=magickwand.so
安装memcached扩展
安装memcached
./configure --prefix=/usr/local/memcached
make && sudo make install
安装libmemcached
./configure --with-memcached=/usr/local/memcached/bin/memcached
make && sudo make install
安装memcached扩展
/opt/test/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config
Make
cp modules/memcached.so /opt/test/php/include/php/ext/
编辑php.ini
extension=memcached.so
启动fast-cgi
spawn-fcgi -a 127.0.0.1 -p 10080 -C 250 -u www -f /opt/test/php/bin/php-cgi
启动nginx
/opt/test/nginx/sbin/nginx -c /opt/test/nginx/conf/nginx.conf
Memcached高可用搭建
编译安装libevent
tar zxvf libevent-1.4.9-stable.tar.gz
cd libevent-1.4.9-stable/
./configure - -prefix=/usr
make && make install
编译安装Memcached
tar zxvf memcached-1.2.6.tar.gz
cd memcached-1.2.6/
./configure - -with-libevent=/usr
make && make install
编译安装magent
mkdir magent
cd magent/
wget http://memagent.googlecode.com/files/magent-0.5.tar.gz
tar zxvf magent-0.5.tar.gz
/sbin/ldconfig
sed -i “s#LIBS = -levent#LIBS = -levent -lm#g” Makefile
make
cp magent /usr/bin/magent
实例
memcached -m 1 -u root -d -l 127.0.0.1 -p 11211
memcached -m 1 -u root -d -l 127.0.0.1 -p 11212
memcached -m 1 -u root -d -l 127.0.0.1 -p 11213
magent -u root -n 51200 -l 127.0.0.1 -p 12000 -s 127.0.0.1:11211 -s 127.0.0.1:11212 -b 127.0.0.1:11213