Memcached安装

1.      源码安装libevent(下载地址:http://monkey.org/~provos/libevent/

2.      源码安装memcached(下载地址:http://memcached.org/

安装libevent:

tar xzf libevent-2.0.21-stable.tar.gz &&

cd libevent-2.0.21-stable&&

./configure -prefix=/usr/local/libevent&&

make && make install

检查是否安装胜利

ls -al/usr/local/libevent/lib | grep libevent

lrwxrwxrwx. 1 root root      21 5月 15 14:35 libevent-2.0.so.5 -> libevent-2.0.so.5.1.9

-rwxr-xr-x. 1 root root 968738  5月 15 14:35libevent-2.0.so.5.1.9

-rw-r--r--. 1 root root 1572018  5月 15 14:35 libevent.a

lrwxrwxrwx. 1 root root      26 5月 15 14:35 libevent_core-2.0.so.5 -> libevent_core-2.0.so.5.1.9

-rwxr-xr-x. 1 root root 585281  5月 15 14:35libevent_core-2.0.so.5.1.9

-rw-r--r--. 1 root root 978666  5月 15 14:35libevent_core.a

-rwxr-xr-x. 1 root root     985 5月 15 14:35 libevent_core.la

lrwxrwxrwx. 1 root root      26 5月 15 14:35 libevent_core.so -> libevent_core-2.0.so.5.1.9

lrwxrwxrwx. 1 root root     27  5月 15 14:35 libevent_extra-2.0.so.5 ->libevent_extra-2.0.so.5.1.9

-rwxr-xr-x. 1 root root 404860  5月 15 14:35libevent_extra-2.0.so.5.1.9

-rw-r--r--. 1 root root 593424  5月 15 14:35libevent_extra.a

-rwxr-xr-x. 1 root root     992 5月 15 14:35 libevent_extra.la

lrwxrwxrwx. 1 root root      27 5月 15 14:35 libevent_extra.so -> libevent_extra-2.0.so.5.1.9

-rwxr-xr-x. 1 root root     950 5月 15 14:35 libevent.la

lrwxrwxrwx. 1 root root      30 5月 15 14:35 libevent_pthreads-2.0.so.5 -> libevent_pthreads-2.0.so.5.1.9

-rwxr-xr-x. 1 root root  18438  5月 15 14:35libevent_pthreads-2.0.so.5.1.9

-rw-r--r--. 1 root root  18678  5月 15 14:35libevent_pthreads.a

-rwxr-xr-x. 1 root root   1013  5月 15 14:35libevent_pthreads.la

lrwxrwxrwx. 1 root root      30 5月 15 14:35 libevent_pthreads.so -> libevent_pthreads-2.0.so.5.1.9

lrwxrwxrwx. 1 root root      21 5月 15 14:35 libevent.so -> libevent-2.0.so.5.1.9

安装memcached,同时须要安装中指定libevent的安装位置:

tar xzf memcached-1.4.15.tar.gz&&

cd memcached-1.4.15&&

./configure --with-libevent=/usr/local/libevent&&

make &&make install

测试是否胜利安装memcached:

ls -al/usr/local/bin/mem*
-rwxr-xr-x. 1 root root 310847  5月 11 11:11 /usr/local/bin/memcached

编写 memcached 启动脚本

vi /etc/init.d/memcached

#! /bin/sh

#

# chkconfig: - 55 45

# description:  The memcached daemon is a network memorycache service.

# processname: memcached

# config: /etc/sysconfig/memcached

# Source function library.

. /etc/rc.d/init.d/functions

PORT=11211

USER=root

MAXCONN=1024

CACHESIZE=64

OPTIONS=""

if [ -f /etc/sysconfig/memcached];then

. /etc/sysconfig/memcached

fi

# Check that networking is up.

if [ "$NETWORKING" ="no" ]

then

exit 0

fi

RETVAL=0

start () {

echo "Starting memcached ..."

# insure that /var/run/memcached has proper permissions

chown $USER /usr/local/bin/memcached

/usr/local/bin/memcached -d -p $PORT -u $USER -m $CACHESIZE -c $MAXCONN-P /var/run/memcached.pid $OPTIONS

RETVAL=$?

echo

[ $RETVAL -eq 0 ] && touch /var/lock/subsys/memcached

}

stop () {

echo "Stopping memcached ..."

killproc memcached

RETVAL=$?

echo

if [ $RETVAL -eq 0 ] ; then

rm -f /var/lock/subsys/memcached

rm -f /var/run/memcached.pid

fi

}

restart () {

stop

start

}

# See how we were called.

case "$1" in

start)

start

;;

stop)

stop

;;

status)

status memcached

;;

restart|reload)

restart

;;

condrestart)

[ -f /var/lock/subsys/memcached ] && restart || :

;;

*)

echo $"Usage: $0{start|stop|status|restart|reload|condrestart}"

exit 1

esac

exit $RETVAL

保存退出

加入自启动

cd /etc/init.d &&

chmod +x memcached &&

chkconfig --addmemcached &&

chkconfig memcachedon

赋给可执行权限

chmod -R 755 /etc/init.d/memcached

启动服务

service memcachedstart

查看端口是否启动胜利

netstat -anp | grep 11211

Nginx安装:

安装nginx之前须要安装pcre包和zlib以支撑重写,正则以及网页压缩等等

下载地址:http://nginx.org/en/download.html

(1)安装pcre:

tar xzfpcre-8.32.tar.gz &&

cd pcre-8.32&&

./configure--prefix=/usr/local/pcre &&

make&& make install

(2)安装zilb

tar xzf zlib-1.2.8.tar.gz&&

cd zlib-1.2.8&&

./configure --prefix=/usr/local/zlib&&

make && make install

(3)安装nginx:

tar xzf nginx-1.4.1.tar.gz &&

cdnginx-1.4.1

./configure \

--prefix=/usr/local/nginx \

--sbin-path=/usr/local/nginx/nginx \

--conf-path=/usr/local/nginx/nginx.conf \

--pid-path=/usr/local/nginx/nginx.pid \

--with-pcre=/usr/local/installPack/pcre-8.32\

--with-zlib=/usr/local/installPack/zlib-1.2.8&&

make&& make install

编写nginx启动脚本

vi /etc/init.d/nginx

内容:

#!/bin/bash

#

# nginx Startup script for the Nginx HTTPServer

# this script create it by jackbillow at2007.10.15.

# it is v.0.0.2version.

# if you find any errors on thisscripts,please contact jackbillow.

# and send mail to jackbillow at gmail dotcom.

#

# chkconfig: - 85 15

# description: Nginx is a high-performanceweb and proxy server.

#              It has a lot of features, butit's not for everyone.

# processname: nginx

# pidfile: /usr/local/nginx/logs/nginx.pid

# config: /usr/local/nginx/conf/nginx.conf

nginxd=/usr/local/nginx/nginx

nginx_config=/usr/local/nginx/nginx.conf

nginx_pid=/usr/local/nginx/nginx.pid

RETVAL=0

prog="nginx"

# Source function library.

. /etc/rc.d/init.d/functions

# Source networking configuration.

. /etc/sysconfig/network

# Check that networking is up.

[ ${NETWORKING} = "no" ]&& exit 0

[ -x $nginxd ] || exit 0

# Start nginx daemons functions.

start() {

if [ -e $nginx_pid ];then

echo "nginx already running...."

exit 1

fi

echo -n $"Starting $prog: "

daemon $nginxd -c ${nginx_config}

RETVAL=$?

echo

[ $RETVAL = 0 ] && touch/var/lock/subsys/nginx

return $RETVAL

}

# Stop nginx daemons functions.

stop() {

echo -n $"Stopping $prog: "

killproc $nginxd

RETVAL=$?

echo

[ $RETVAL = 0 ] && rm -f /var/lock/subsys/nginx/usr/local/nginx/logs/nginx.pid

}

# reload nginx service functions.

reload() {

echo -n $"Reloading $prog: "

#kill -HUP `cat ${nginx_pid}`

killproc $nginxd -HUP

RETVAL=$?

echo

}

# See how we were called.

case "$1" in

start)

    每日一道理 
自己把自己说服了,是一种理智的胜利;自己被自己感动了,是一种心灵的升华;自己把自己征服了,是一种人生的胜利。

start

;;

stop)

stop

;;

reload)

reload

;;

restart)

stop

start

;;

status)

status $prog

RETVAL=$?

;;

*)

echo $"Usage: $prog {start|stop|restart|reload|status|help}"

exit 1

esac

exit $RETVAL

给nginx加入服务自启动脚本

cd /etc/init.d &&

chmod 755 nginx &&

chkconfig--add nginx &&

chkconfig nginx on

启动服务

service nginx start

Php安装

下载php安装包:http://cn2.php.net/distributions/php-5.4.15.tar.gz

(下面这些库都是以前安装好的!如果换新环境须要自己装)

tar xzf php-5.4.15.tar.gz&&

cd php-5.4.15

1、安装libxml2库

./configure --prefix=/app/apache/lib/libxml2&&

make && make install

2、安装libmcrypt库

./configure --prefix=/app/apache/lib/libmcrypt &&

make&& make install

3、安装libpng库(libpng-1.2.31.tar.gz)

./configure --prefix=/app/apache/lib/libpng&&

make && make install

如果涌现:configure: error: zlib not installed

执行如下命令,使之前安装的zlib库立即生效:

exportLDFLAGS="-L/app/apache/lib/zlib/lib"

exportCPPFLAGS="-I/app/apache/lib/zlib/include"

4、安装jpeg9库

./configure --prefix=/app/apache/lib/jpeg9 \

--enable-shared\

--enable-static&&

make &&make install

5、安装freetype库

./configure --prefix=/app/apache/lib/freetype&&

make && make install

6、安装autoconf库

./configure&&  make && make install (直接安装到系统库,不用指定安装目录)

7、安装gd库

./configure--prefix=/app/apache/lib/gd2 \

--with-zlib=/app/apache/lib/zlib/ \

--with-jpeg=/app/apache/lib/jpeg9/ \

--with-png=/app/apache/lib/libpng/ \

--with-freetype=/app/apache/lib/freetype/&&

make && make install

在64位系统中会涌现以下错误:

make[2]: ***[gdparttopng] Error 1

make[2]: Leavingdirectory `/app/src/gd-2.0.35'

make[1]: ***[all-recursive] Error 1

make[1]: Leavingdirectory `/app/src/gd-2.0.35'

make: *** [all]Error 2

安装以下rpm包可解决:

rpm –ivh zlib-devel-1.2.3-27.el6.x86_64.rpm(先安装这个,后面的依附这个)

rpm –ivh libjpeg-devel-6b-46.el6.x86_64.rpm

rpm –ivh freetype-devel-2.3.11-6.el6_1.7.x86_64.rpm

rpm –ivh libpng-devel-1.2.46-1.el6_1.x86_64.rpm

8、安装php

./configure --prefix=/usr/local/php &&

./configure --with-mysql=/app/mysql5.6 &&

./configure --with-mysqli=/app/mysql5.6/bin/mysql_config &&

./configure --with-libxml-dir=/app/apache/lib/libxml2 &&

./configure --with-png-dir=/app/apache/lib/libpng &&

./configure --with-jpeg-dir=/app/apache/lib/jpeg9 &&

./configure --with-freetype-dir=/app/apache/lib/freetype &&

./configure --with-gd=/app/apache/lib/gd2 &&

./configure --with-zlib-dir=/usr/local/zlib &&

./configure --with-mcrypt=/app/apache/lib/libmcrypt &&

./configure --enable-soap &&

./configure --enable-mbstring=all &&

./configure --enable-sockets &&

./configure --enable-fastcgi &&

./configure --enable-fpm &&

make && make install

Nginx整合php

nginx.conf 中注释失落的php代码段注释取消

#pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000

location ~ \.php$ {

root           html;

fastcgi_pass   127.0.0.1:9000;

fastcgi_index  index.php;

fastcgi_param SCRIPT_FILENAME /usr/local/nginx/html$fastcgi_script_name;

include        fastcgi_params;

}

复制php.ini配置文件

cp /usr/local/installPack/php-5.4.15/php.ini-production /usr/local/etc/php.ini

复制php-fpm配置文件

cp /usr/local/etc/php-fpm.conf.default  /usr/local/etc/php-fpm.conf

创立

php-fpm服务

vi /etc/init.d/php-fpm

输入:

#!/bin/bash

#

# Startup script for the PHP-FPM server.

#

# chkconfig: 345 85 15

# description: PHP is an HTML-embeddedscripting language

# processname: php-fpm

# config: /usr/local/php/etc/php.ini

# Source function library.

. /etc/rc.d/init.d/functions

PHP_PATH=/usr/local

DESC="php-fpm daemon"

NAME=php-fpm

DAEMON=$PHP_PATH/sbin/$NAME

CONFIGFILE=$PHP_PATH/etc/php-fpm.conf

PIDFILE=$PHP_PATH/var/run/$NAME.pid

SCRIPTNAME=/etc/init.d/$NAME

# Gracefully exit if the package has beenremoved.

test -x $DAEMON || exit 0

rh_start() {

$DAEMON -y $CONFIGFILE || echo -n " already running"

}

rh_stop() {

kill -QUIT `cat $PIDFILE` || echo -n " not running"

}

rh_reload() {

kill -HUP `cat $PIDFILE` || echo -n " can't reload"

}

case "$1" in

start)

echo -n "Starting $DESC: $NAME"

rh_start

echo "."

;;

stop)

echo -n "Stopping $DESC: $NAME"

rh_stop

echo "."

;;

reload)

echo -n "Reloading $DESC configuration..."

rh_reload

echo "reloaded."

;;

restart)

echo -n "Restarting $DESC: $NAME"

rh_stop

sleep 1

rh_start

echo "."

;;

*)

echo "Usage: $SCRIPTNAME {start|stop|restart|reload}">&2

exit 3

;;

esac

exit 0

保存退出

然后修改php-fpm.conf

vi/usr/local/etc/php-fpm.conf

取消失落pid = run/php-fpm.pid此行后面的;号指定pid生成的目录给下面脚本使用

给php-fpm加入服务自启动脚本

cd /etc/init.d &&

chmod 755 php-fpm &&

chkconfig --add php-fpm &&

chkconfig php-fpm on

启动:

service php-fpm start

安装服务Memcached+Nginx+Php linux下安装的更多相关文章

  1. Nginx 在 Linux 下安装与搭建集群

    搭建集群图例 集群搭建图如下,为了简单一点,使用一个Nginx服务器+两个Tomcat服务器,省略数据库部分: 环境说明 Linux 为 CentOS 7.2 发行版 + Java jdk 1.8 + ...

  2. nginx在linux下安装(源码编译)

    下载 http://nginx.org/en/download.html 安装 安装依赖 yum -y install gcc gcc-c++ zlib zlib-devel pcre-devel o ...

  3. nginx在linux下安装

    安装前先确认是否已经安装编译包和一些依赖包如果没有安装: yum install pcre* yum install openssl* yum install zlib yum install zli ...

  4. Nginx在linux下安装及简单命令

    安装环境:Centos7 创建目录及切换至目录 # mkdir /usr/local/nginx # cd /usr/local/nginx/ 下载nginx包,访问http://nginx.org下 ...

  5. Linux下安装python,mysql,redis

    linux 安装Python3 1.python下载 请在终端输入如下命令: cd /home wget http://cdn.npm.taobao.org/dist/python/3.6.5/Pyt ...

  6. Nginx入门篇-基础知识与linux下安装操作

    我们要深刻理解学习NG的原理与安装方法,要切合实际结合业务需求,应用场景进行灵活使用. 一.Nginx知识简述Nginx是一个高性能的HTTP服务器和反向代理服务器,也是一个 IMAP/POP3/SM ...

  7. Linux下安装与配置Nginx

    一.准备 Nginx版本:nginx-1.7.7.tar.gz   请自行到官网下载对应的版本. 二.步骤 ♦在Linux新建一个queenLove用户 [root@localhost /]# use ...

  8. linux下安装nginx及初步认识

    linux下安装配置nginx nginx:是一个高性能的反向代理服务器正向代理代理的是客户端,反向代理代理的是服务端. 这里以nginx-1.12.2版本为例子 1.首先去官网下载nginx-1.1 ...

  9. Linux下安装配置Node及memcached

    这篇主要是记录Linux下安装Node及memcached遇到的问题及安装配置过程,方便日后查阅 Node安装及配置 [root@hostname ~]tar zxvf node-v0.12.4.ta ...

随机推荐

  1. tomcat 解析(二)-消息处理过程

    接下来我们应该去了解一下 tomcat 是如何处理jsp和servlet请求的. 1.  我们以一个具体的例子,来跟踪TOMCAT, 看看它是如何把Request一层一层地递交给下一个容器, 并最后交 ...

  2. oracle RAC--归档日志的开启方法

    oracle RAC--归档日志的开启方法 2011-10-07 15:53:04 分类: Oracle oracle RAC--归档日志的开启方法   ======================= ...

  3. 配置sql server2012属性 ms-help://MS.SQLCC.v10/MS.SQLSVR.v10.zh-CHS/s10de_5techref/html/6df812ad-4d80-4503-8a23-47719ce85624.htm

    服务与服务器是两个不同的概念,服务器是提供服务的计算机,配置服务器主要是对内存.处理器.安全性等几个方面配置.由于SQL Server 2005服务器的设置参数比较多,这里选一些比较常用的介绍. 配置 ...

  4. hdu 3661 Assignments(水题的解法)

    题目 //最早看了有点云里雾里,看了解析才知道可以很简单的排序过 #include<stdio.h> #include<string.h> #include<algori ...

  5. 【POJ3358】

    题目描述: 题意: 就是给定一个a/b,求a/b的结果变成二进制之后的小数.这个小数后面会有一段循环节,只要求输出循环节开始循环的位置和循环长度. 分析: 这题我是这么想的,比如说样例中的1/5,我们 ...

  6. mysql怎样建表及mysql优化

    1.符合数据库三范式 2.字段选择合适的数据类型 3.注意表之间的联系,一对多,多对多,一对一 4.拆分表,把不常用的字段单独成表. 5.建立索引,哪些字段建立索引?建立索引的原则?最左前缀原则,wh ...

  7. iOS开发--网络下载

    这里使用的是NSURLConnection的代理请求下载,并且是具有进度,UI能实时刷新,至于NSURLConnection如何请求.并且有几种请求方法请看NSURLConnection请求简介,在这 ...

  8. 创业草堂之六:CEO的财务自修课

    创业团队中一个最普遍的缺陷,是团队--尤其是团队的核心人物CEO,缺乏基本的财务知识和技能.一个不懂财务知识的CEO,即使业务能力再强,在投资人的眼里,他/她依然是一个笨拙的CEO.粗糙的CEO.鲁莽 ...

  9. arcengine C# 读写lyr(转)

    写lyr { IFeatureLayer LineLayer = axMapControl1.get_Layer(0) as IFeatureLayer;            ILayerFile ...

  10. vss的ss.ini丢失或损坏导致的vss无法登录错误

    vss的ss.ini丢失或损坏导致的vss无法登录错误 Written in 2007-07-03 18:17 在vss使用过程中,不知道什么原因,会导至vss目录中的ss.ini文件损坏,此文件位于 ...