centos6.3环境下nginx,php,memcache,memadmin的安装部署5

安装memcached

wget http://memcached.googlecode.com/files/memcached-1.4.15.tar.gz
wget --no-check-certificate https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz

tar xf libevent-2.0.21-stable.tar.gz
cd libevent-2.0.21-stable
./configure --prefix=/usr/local/libevent-2.0.21
make
make install

tar zxvf memcached-1.4.15.tar.gz
cd memcached-1.4.15
./configure --prefix=/usr/local/memcached-1.4.15 --with-libevent=/usr/local/libevent-2.0.21
make
make install
为memcached建立随机启动的服务脚本(安装包中有范例): 创建/etc/init.d/memcached文件,内容:

#!/bin/bash
#
# Init file for memcached
#
# chkconfig: 345 60 60
# description: The memcached daemon is a network memory cache service.
#
# processname: memcached
# config: /etc/sysconfig/memcached

. /etc/rc.d/init.d/functions
[ -f /etc/sysconfig/memcached ] && . /etc/sysconfig/memcached #将memcached的参数定义设置为独立配置文件
## Default variables
PORT=${PORT:-11211}
USER=${USER:-nobody}
MAXCONN=${MAXCONN:-1024}
CACHESIZE=${CACHESIZE:-64}
OPTIONS=${OPTIONS:-""}

RETVAL=0
prog="/usr/local/memcached-1.4.15/bin/memcached"
desc="network memory cache service"
lockfile="/var/lock/subsys/memcached"

start() {
echo -n $"Starting $desc (memcached): "
daemon $prog -d -p $PORT -u $USER -c $MAXCONN -m $CACHESIZE $OPTIONS
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch $lockfile
return $RETVAL
}

stop() {
echo -n $"Shutting down $desc (memcached): "
killproc $prog
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f $lockfile
return $RETVAL
}

restart() {
stop
start
}

reload() {
echo -n $"Reloading $desc ($prog): "
killproc $prog -HUP
RETVAL=$?
echo
return $RETVAL
}

case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
condrestart)
[ -e $lockfile ] && restart
RETVAL=$?
;;
reload)
reload
;;
status)
status $prog
RETVAL=$?
;;
*)
echo $"Usage: $0 {start|stop|restart|condrestart|status}"
RETVAL=1
esac

exit $RETVAL


建立memcached参数配置文件:
echo -e 'PORT="11211" \nUSER="root" \nMAXCONN="1024" \nCACHESIZE="64" \nOPTIONS="" ' > /etc/sysconfig/memcached


添加执行权限,加入到系统服务:
 chmod 755 /etc/init.d/memcached
chkconfig --add memcached
chkconfig memcached on
service memcached start



安装memadmin可视化管理界面:

wget http://www.junopen.com/memadmin/memadmin-1.0.12.tar.gz
tar zxvf memadmin-1.0.12.tar.gz
cd memadmin
mv * /web/htdocs/memadmin


到此为止,这5篇文章就写完了,如有不足之处,欢迎大家指正。
附参考文章列表:

http://tangs90.net/linux-nginx-memcache/
http://www.linuxidc.com/Linux/2012-11/73997p8.htm
http://blog.csdn.net/chaijunkun/article/details/7000600
http://blog.csdn.net/chaijunkun/article/details/6993264
http://www.cnblogs.com/wubaiqing/archive/2011/09/19/2181602.html

你可能感兴趣的:(Linux)