1002 安装配置lamp和memcached

1002 安装配置lamp memcached
内容概要:
如何配置lamp ZendOptimizer memcache PHP 扩展支持、ioncube )环境
如何配置memcached 服务器
 
1.0 安装apache+mysql+gd +php +ZendOptimizer+ioncube
下载最新稳定版本的软件至下载安装源文件放在 /data/src/
1.1 安装mysql
useradd mysql && echo "mysql" |passwd --stdin mysql
cd /data/src/
tar -xzvf ./mysql- 5.1.34 -linux-i686-icc-glibc23.tar.gz
cp -rp ./mysql- 5.1.34 -linux-i686-icc-glibc23 /usr/local/mysql
cd /usr/local/mysql/
./scripts/mysql_install_db --user=mysql
chown -R root .
chown -R mysql data
chgrp -R mysql .
\cp bin/* /usr/bin/
\cp support-files/mysql.server /etc/init.d/mysqld
 
1.2 安装apache
cd /data/src/
tar -xzvf ./httpd- 2.2.11 .tar.gz
cd ./httpd- 2.2.11
./configure --enable-so --with-mpm=event
make &&make install
\cp /usr/local/apache2/bin/apachectl /etc/init.d/httpd
echo '/usr/local/apache2/bin/apachectl -k start' >>/etc/rc.local
 
1.3 安装gd
1.3.1 zlib
cd /data/src/
tar -xzvf ./zlib- 1.2.3 .tar.gz
cd ./zlib- 1.2.3
CFLAGS="-O3 -fPIC" ./configure               # 修正 64 位系统报错问题
make &&make install
 
1.3.2 libpng
cd /data/src
tar -xzvf ./libpng- 1.2.35 .tar.gz
cd libpng- 1.2.35
cp ./scripts/makefile.linux ./makefile
make &&make install
 
1.3.3 freetype
cd /data/src
tar -xzvf ./freetype- 2.3.9 .tar.gz
cd ./freetype- 2.3.9
./configure --prefix=/usr/local/freetype
make &&make install
 
1.3.4 jpeg-6b
cd /data/src
tar -xzvf ./jpegsrc.v6b.tar.gz
mkdir /usr/local/jpeg6
mkdir /usr/local/jpeg6/bin
mkdir /usr/local/jpeg6/lib
mkdir /usr/local/jpeg6/include
mkdir -p /usr/local/jpeg6/man/man1
cd jpeg-6b
\cp /usr/share/libtool/config.guess ./           # 修正 64 位系统报错问题
\cp /usr/share/libtool/config.sub ./              # 修正 64 位系统报错问题
./configure --prefix=/usr/local/jpeg6 --enable-shared --enable-static
make &&make install
 
1.3.5 libxml2
cd /data/src/
tar -xzvf ./libxml2- 2.7.3 .tar.gz
cd libxml2- 2.7.3
./configure --prefix=/usr/local/xml2
make &&make install
 
1.3.6 gd
cd /data/src
tar -xzvf ./gd- 2.0.35 .tar.gz
cd ./gd- 2.0.35
./configure --prefix=/usr/local/gd --with-jpeg=/usr/local/jpeg6 --with-png=/usr/local \
--with-zlib --with-freetype=/usr/local/freetype
make &&make install
 
1.4 安装php
1.4.1 libmcrypt
cd /data/src
tar -xzvf ./libmcrypt- 2.5.8 .tar.gz
cd ./libmcrypt- 2.5.8
./configure
make &&make install
 
1.4.2 p hp
yum install gettext-devel
cd /data/src
tar -xzvf php- 5.2.9 .tar.gz
cd php- 5.2.9
./configure --prefix=/usr/local/php \
--with-apxs2=/usr/local/apache2/bin/apxs \
--with-mysql=/usr/local/mysql \
--with-config-file-path=/usr/local/php/etc \
--with-gd=/usr/local/gd/ \
--enable-gd-native-ttf \
--enable-gd-jis-conv \
--with-jpeg-dir=/usr/local/jpeg6/ \
--with-zlib \
--with-png-dir=/usr/local \
--with-freetype-dir=/usr/local/freetype/ \
--with-libxml-dir=/usr/local/xml2/ \
--enable-mbstring \
--with-gettext \
--enable-force-cgi-redirect \
--disable-cgi \
--enable-sockets \
--with-mcrypt \
--with-pdo-mysql
make &&make install
cp -p php.ini-dist /usr/local/php/etc/php.ini
 
1.4.3 mbstring php-5.2.9 好像已经不需要手动扩展安装
cd /data/src/php- 5.2.6 /ext/mbstring
sh /usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config
make && make install
cp /usr/local/php/lib/php/extensions/no-debug-zts-20060613/mbstring.so \
/usr/local/php/lib/php/extensions/
 
1.4.4 memcache PHP module
cd /data/src
tar -xzvf memcache- 2.2.5 .tgz
cd memcache- 2.2.5
/usr/local/php/bin/phpize
./configure --enable-memcache --with-php-config=/usr/local/php/bin/php-config --with-zlib-dir
make && make install
cp /usr/local/php/lib/php/extensions/no-debug-zts-20060613/ memcache.so \
/usr/local/php/lib/php/extensions/
修改 /usr/local/php/etc/php.ini 加入以下两行:
extension_dir = "/usr/local/php/lib/php/extensions/"
extension=memcache.so
 
1.4.5 ZendOptimizer
cd /data/src/
tar -xzvf ./ZendOptimizer- 3.3.3 -linux-glibc23-i386.tar.gz
cd ZendOptimizer- 3.3.3 -linux-glibc23-i386
sh install.sh
       OK-EXIT-YES-/usr/local/Zend-OK-/usr/local/php/etc-OK-YES-YES-OK-OK-YES-OK
 
1.5 安装ioncube
cd /data/src/
tar �Cxzvf ./ ioncube_loaders_lin_x86.tar.gz
mv ./ioncube_loaders_lin_x86 /var/www/html/ioncube
修改 /usr/local/php/etc/php.ini :(在 engine = On 行下添加一行)
zend_extension_ts = /var/www/html/ioncube/ioncube_loader_lin_5.2_ts.so
测试是否安装成功: http://localhost/ioncube/ioncube-loader-helper.php 提示 successfully 即说明安装成功
 
2.0 安装memcached 服务器
2.1 安装memcached
2.1.1 libevent
cd /data/src/
tar -xzvf ./libevent- 1.4.10 -stable.tar.gz
cd libevent- 1.4.10 -stable
./configure --prefix=/usr/local/libevent
make && make install
 
2.1.2 memcached
cd /data/src/
tar -xzvf ./memcached- 1.2.8 .tar.gz
cd memcached- 1.2.8
\cp /usr/share/libtool/config.guess ./                   # 修正 64 位系统报错问题
\cp /usr/share/libtool/config.sub ./
#cp -r /usr/local/libevent/lib/libevent* /usr/lib64/
./configure --prefix=/usr/local/memcached --with-libevent=/usr/local/libevent --enable-64bit
make && make install
运行 /usr/local/memcached/bin/memcached -h 可能出现如下错误信息:
./memcached: error while loading shared libraries: libevent-1.4.so.2: cannot open shared object file: No such file or directory
解决方法: ln -s /usr/local/libevent/lib/libevent-1.4.so.2 /usr/lib/libevent-1.4.so.2
 
2.2 memcached 使用方法
2.2.1 怎样运行memcached
/usr/local/memcached/bin/memcached -h 有详细使用说明
/usr/local/memcached/bin/memcached -d -l 192.168.0.212 -m 2048 -p 22489 -u root 并加入 /etc/rc.d/rc.local 文件里以便能随机启动
 
2.2.2 查看memcached 运行状态
ps -ef |grem memcached
pidof memcached
 
2.2.3 重启memcached
ps -ef |grem memcached 列出一个或多个 memcached 运行的进程号
kill -9 想要结束的 pid
重新运行
 
By Shaw

你可能感兴趣的:(linux,职场,休闲)