设为首页 收藏本站
查看: 1558|回复: 6

[经验分享] 安装memcached+nginx+php+memadmin笔记

[复制链接]

尚未签到

发表于 2013-4-2 09:01:39 | 显示全部楼层 |阅读模式

首先准备软件包:

libevent-2.0.21-stable.tar.gz
libmcrypt-2.5.7.tar.gz
memadmin-1.0.12.tar.gz
memcache-2.2.7.tgz
memcached-1.4.15.tar.gz
nginx-1.2.7.tar.gz
php-5.4.11.tar.gz

下载链接

http://down./data/730444

参考

1、安装gcc

[iyunv@radius ~]# yum install gcc gcc-c++ autoconf automake

2、安装nginx

[iyunv@radius nginx-1.2.7]# yum -y install pcre-devel zlib-devel openssl openssl-devel

[iyunv@radius Package]# tar -zxvf nginx-1.2.7.tar.gz

[iyunv@radius Package]# cd nginx-1.2.7

[iyunv@radius nginx-1.2.7]# ./configure --prefix=/usr/local/nginx

[iyunv@radius nginx-1.2.7]# make

[iyunv@radius nginx-1.2.7]# make install

[iyunv@radius ~]# vim /etc/init.d/nginx

#!/bin/sh
#
# nginx - this script starts and stops the nginx daemon
#
# chkconfig: 345 85 15
# description: Nginx is an HTTP(S) server, HTTP(S) reverse
# proxy and IMAP/POP3 proxy server
# processname: nginx
# config: /opt/nginx/conf/nginx.conf
# pidfile: /opt/nginx/nginx.pid
# Source function library.
. /etc/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
if [ -f /etc/sysconfig/nginx ];then
. /etc/sysconfig/nginx
fi
# Check that networking is up.
[ "$NETWORKING" = "no" ] && exit 0
nginx="/usr/local/nginx/sbin/nginx"
prog=$(basename $nginx)
NGINX_CONF_FILE="/usr/local/nginx/conf/nginx.conf"
[ -f /etc/sysconfig/nginx ] && . /etc/sysconfig/nginx
lockfile=/var/lock/subsys/nginx
start() {
[ -x $nginx ] || exit 5
[ -f $NGINX_CONF_FILE ] || exit 6
echo -n $"Starting $prog: "
daemon $nginx #-c $NGINX_CONF_FILE
retval=$?
echo
[ $retval -eq 0 ] && touch $lockfile
return $retval
}
stop() {
echo -n $"Stopping $prog: "
killproc $prog -QUIT
retval=$?
echo
[ $retval -eq 0 ] && rm -f $lockfile
return $retval
killall -9 nginx
}
restart() {
configtest || return $?
stop
sleep 1
start
}
reload() {
configtest || return $?
echo -n $"Reloading $prog: "
killproc $nginx -HUP
RETVAL=$?
echo
}
force_reload() {
restart
}
configtest() {
$nginx -t #-c $NGINX_CONF_FILE
}
rh_status() {
status $prog
}
rh_status_q() {
rh_status >/dev/null 2>&1
}
case "$1" in
start)
    rh_status_q && exit 0
    $1
    ;;
stop)
rh_status_q || exit 0
    $1
    ;;
restart)
    $1
    ;;
test)
    configtest
    ;;
reload)
    rh_status_q || exit 7
    $1
    ;;
force-reload)
    force_reload
    ;;
status)
    rh_status
    ;;
condrestart|try-restart)
    rh_status_q || exit 0
    ;;
*)
echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload|test}"
exit 2
esac

[iyunv@radius ~]# chmod 755 /etc/init.d/nginx
[iyunv@radius ~]# chkconfig --add nginx
[iyunv@radius ~]# chkconfig nginx on
[iyunv@radius ~]# service nginx start

测试:http://192.168.137.35/

[iyunv@radius ~]# service nginx stop

3、安装PHP

[iyunv@radius ~]# yum install libxml2-devel bzip2-devel curl-devel

[iyunv@radius Package]# tar -zxvf libmcrypt-2.5.7.tar.gz

[iyunv@radius libmcrypt-2.5.7]# ./configure

[iyunv@radius libmcrypt-2.5.7]# make

[iyunv@radius libmcrypt-2.5.7]# make install

[iyunv@radius ~]# cd Package/

[iyunv@radius Package]# tar -zxvf php-5.4.11.tar.gz

[iyunv@radius Package]# cd php-5.4.11

[iyunv@radius php-5.4.11]# ./configure --prefix=/usr/local/php --enable-fastcgi --enable-fpm --with-mcrypt --with-zlib --enable-mbstring --disable-pdo --with-curl --disable-debug --enable-pic --disable-rpath --enable-inline-optimization --with-bz2 --with-xml --with-zlib --enable-sockets --enable-sysvsem --enable-sysvshm --enable-pcntl --enable-mbregex --with-mhash --enable-xslt --enable-memcache --enable-zip --with-pcre-regex --with-mysql

[iyunv@radius php-5.4.11]# make

[iyunv@radius php-5.4.11]# make install

[iyunv@radius php-5.4.11]# cp php.ini-production /usr/local/php/lib/php.ini

[iyunv@radius php-5.4.11]# cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf

[iyunv@radius php-5.4.11]# cp sapi/fpm/init.d.php-fpm /etc/rc.d/init.d/php-fpm

[iyunv@radius php-5.4.11]# chmod 755 /etc/rc.d/init.d/php-fpm

[iyunv@radius php-5.4.11]# chkconfig --add php-fpm

[iyunv@radius php-5.4.11]# chkconfig php-fpm on

4、整合nginx和php-fpm

[iyunv@radius ~]# mkdir /web

[iyunv@radius ~]# cd /web

[iyunv@radius web]# mkdir htdocs

[iyunv@radius ~]# vim /usr/local/nginx/conf/nginx.conf

修改server区段

...
location / {
root /web/htdocs;
index index.php index.html index.htm;
}
...
location ~ \.php$ {
root /web/htdocs;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /web/htdocs/$fastcgi_script_name;
include fastcgi_params;
}

测试

[iyunv@radius ~]# vim /web/htdocs/index.php

<?php
phpinfo();
?>

[iyunv@radius ~]# service nginx start

[iyunv@radius ~]# service php-fpm start

http://192.168.137.35/

[iyunv@radius ~]# service nginx stop

[iyunv@radius ~]# service php-fpm stop

5、安装PHP memcach

[iyunv@radius ~]# cd Package/

[iyunv@radius Package]# tar -zxf memcache-2.2.7.tgz

[iyunv@radius Package]# cd memcache-2.2.7

[iyunv@radius memcache-2.2.7]# /usr/local/php/bin/phpize

[iyunv@radius memcache-2.2.7]# ./configure --with-php-config=/usr/local/php/bin/php-config --enable-memcache

[iyunv@radius memcache-2.2.7]# make

[iyunv@radius memcache-2.2.7]# make install

出现如下提示:

Installing shared extensions:     /usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/

在[iyunv@radius ~]# vim /usr/local/php/lib/php.ini大约868行左右添加如下一行来载入memcache扩展

6、安装memcached

[iyunv@radius Package]# tar -xf libevent-2.0.21-stable.tar.gz

[iyunv@radius Package]# cd libevent-2.0.21-stable

[iyunv@radius libevent-2.0.21-stable]# ./configure --prefix=/usr/local/libevent-2.0.21

[iyunv@radius libevent-2.0.21-stable]# make

[iyunv@radius libevent-2.0.21-stable]# make install

[iyunv@radius ~]# cd Package/

[iyunv@radius Package]# tar -zxf memcached-1.4.15.tar.gz

[iyunv@radius Package]# cd memcached-1.4.15

[iyunv@radius memcached-1.4.15]# ./configure --prefix=/usr/local/memcached-1.4.15 --with-libevent=/usr/local/libevent-2.0.21

[iyunv@radius memcached-1.4.15]# make

[iyunv@radius memcached-1.4.15]# make install

为memcached建立启动脚本

[iyunv@radius ~]# vim /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参数配置文件:

[iyunv@radius ~]# echo -e 'PORT="11211" \nUSER="root" \nMAXCONN="1024" \nCACHESIZE="64" \nOPTIONS="" ' > /etc/sysconfig/memcached

添加执行权限,加入到系统服务:

[iyunv@radius ~]# chmod 755 /etc/init.d/memcached
[iyunv@radius ~]# chkconfig --add memcached
[iyunv@radius ~]# chkconfig memcached on

安装memadmin可视化管理界面:

[iyunv@radius Package]# tar -zxf memadmin-1.0.12.tar.gz
[iyunv@radius Package]# cd memadmin
[iyunv@radius memadmin]# mkdir /web/htdocs/memadmin
[iyunv@radius memadmin]# mv * /web/htdocs/memadmin/

测试

[iyunv@radius memadmin]# service memcached start

[iyunv@radius memadmin]# service php-fpm start

[iyunv@radius memadmin]# service nginx start

http://192.168.137.35/memadmin

用户名:admin

密码:admin

参考链接:

——————————————————————————————————————————————————

第一次做没有成功的笔记

2、安装libevent

[iyunv@radius libevent-2.0.19-stable]# ./configure --prefix=/usr/local/libevent

[iyunv@radius libevent-2.0.19-stable]# make && make install

3、安装memcached

[iyunv@radius ~]# tar -zxvf memcached-1.4.13.tar.gz

[iyunv@radius ~]# cd memcached-1.4.13

[iyunv@radius memcached-1.4.13]# ./configure --prefix=/usr/local/memcached --with-libevent=/usr/local/libevent

[iyunv@radius memcached-1.4.13]# make && make install

4、安装apache

[iyunv@radius httpd-2.2.15]# ./configure --prefix=/usr/local/apache --enable-so --enable-dav --enable-dav-fs --enable-maintainer-mode --enable-rewrite=shared



运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-4671-1-1.html 上篇帖子: 关于一些nginx的高级扩展应用 下篇帖子: 最新源码包通过脚本部署LAMP搭建Discuz论坛 安装 php

尚未签到

发表于 2013-4-2 09:10:04 | 显示全部楼层
人生重要的不是所站的位置,而是所朝的方向!

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

尚未签到

发表于 2013-5-17 16:26:09 | 显示全部楼层
睡眠是一门艺术——谁也无法阻挡我追求艺术的脚步!

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

尚未签到

发表于 2013-5-20 04:27:11 | 显示全部楼层
修养的艺术,其实就是说谎的艺术。

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

尚未签到

发表于 2013-5-22 14:32:46 | 显示全部楼层
男人靠的住,母猪能上树!

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

尚未签到

发表于 2013-5-27 10:04:18 | 显示全部楼层
啥时硬件也可以COPY就好了!

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

尚未签到

发表于 2013-5-31 12:13:36 | 显示全部楼层
与时俱进,你我共赴高潮!

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表