自动安装memcached服务端与PHP扩展Memcached
该脚本基于阿里云服务器安装脚本,并只能运用于centos / aliyun os,该脚本使用时,需要与阿里云安装脚本的install.sh放在同一目录下。有缘人切忌乱用:
#! /bin/bash
#by dxd in -
#only suit for centos/aliyun os, and based on aliyun install script PHP_EXT_SOURCE_PATH=""
PHP_BIN_PATH=/alidata/server/php/bin DOWNLOAD_LIBEVENT_URL=http://download.verymall.cn/libevent-1.4.14b.tar.gz
INSTALL_LIBEVENT_PATH=/alidata/lib/libevent
NEW_LIBEVENT="" DOWNLOAD_MEMCACHE_URL=http://download.verymall.cn/memcached-1.4.25.zip
INSTALL_MEMCACHE_PATH=/alidata/server/memcache
MEMCACHE_PORT=
MEMCACHE_PID_FILE=/tmp/memcached.pid CURR_PATH=$(pwd); DOWNLOAD_LIBMEMCACHED_URL=http://download.verymall.cn/libmemcached-1.0.18.zip
INSTALL_LIBMEMCACHED_PATH=/alidata/lib/libmemcached DOWNLOAD_PHP_MEMCACHED=http://download.verymall.cn/php_memcached-2.2.0.zip
PHP_INI_PATH=/alidata/server/php/etc/php.ini #check current path auth
if [ ! -w "$CURR_PATH" ]
then
echo "no write"
exit
fi #check user name
if [ "$(whoami)" != "root" ]
then
echo "please run as root"
exit
fi #check current path
if [ "$(ls | grep 'install.sh')" = "" ]
then
echo "please put this script where install.sh locates"
exit
fi #select php ext path
for dir in $(ls)
do
TMP_PATH=$CURR_PATH/$dir/ext
if [ -d $TMP_PATH ]
then
PHP_EXT_SOURCE_PATH=$TMP_PATH
break
fi
done
if [ -z "$PHP_EXT_SOURCE_PATH" ]
then
echo "could not find php install path"
exit
fi echo -n "php ext source path is $PHP_EXT_SOURCE_PATH , (Y/N): "
read USER_ANSWER
until [ "$USER_ANSWER" = "Y" ] || [ "$USER_ANSWER" = "y" ]
do
if [ "$USER_ANSWER" = "N" ] || [ "$USER_ANSWER" = "n" ]
then
echo "php ext source path is fault, then exit"
exit
fi echo -n "php ext source path is $PHP_EXT_SOURCE_PATH , (Y/N): "
read USER_ANSWER
done #maybe gcc is not installed,but it is rare, I'm not going to handle this situation
which gcc > /dev/null >&
if [ "$?" != "" ]
then
echo "please install gcc first"
exit
fi #check is port occupied
if [ -n "$(netstat -ano | grep $MEMCACHE_PORT)" ]
then
echo "PORT $MEMCACHE_PORT is occupied, please check"
if [ -f $MEMCACHE_PID_FILE ]
then
echo 'maybe by old memcache server'
echo "PID: $(cat $MEMCACHE_PID_FILE)"
fi
exit
fi #test zip if exist
unzip > /dev/null >&
if [ "$?" != "" ] #not tested yet!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
then
yum install unzip
fi #clear old memcache files
if [ -d $INSTALL_MEMCACHE_PATH ]
then
rm -rf $INSTALL_MEMCACHE_PATH > /dev/null >&
if "$?"=""
then
echo "$INSTALL_MEMCACHE_PATH could not be removed"
exit
fi
fi if [ -d $INSTALL_LIBMEMCACHED_PATH ]
then
rm -rf $INSTALL_LIBMEMCACHED_PATH > /dev/null >&
if "$?"=""
then
echo "$INSTALL_LIBMEMCACHED_PATH could not be removed"
exit
fi
fi #create lib path
mkdir /alidata/lib > /dev/null >& #install libevent
libevent=$(ldconfig -p | grep 'libevent')
if [ -z "$libevent" ] #not tested yet!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
then
rm -rf $INSTALL_LIBEVENT_PATH > /dev/null >&
mkdir $INSTALL_LIBEVENT_PATH
chmod -R $INSTALL_LIBEVENT_PATH rm -f $CURR_PATH/libevent-1.4.14b.tar.gz
rm -rf $CURR_PATH/libevent-1.4.14b
wget $DOWNLOAD_LIBEVENT_URL
tar -zxvf libevent-1.4.14b.tar.gz
chmod -R ./libevent-1.4.14b
cd ./libevent-1.4.14b
./configure --prefix=$INSTALL_LIBEVENT_PATH
make
make install NEW_LIBEVENT=""
fi cd $CURR_PATH #install memcache
rm -f $CURR_PATH/memcached-1.4..zip
rm -rf $CURR_PATH/memcached-1.4.
wget $DOWNLOAD_MEMCACHE_URL
unzip memcached-1.4..zip
chmod -R ./memcached-1.4.
cd ./memcached-1.4.
if [ $NEW_LIBEVENT="" ] #install libevent in this script
then
./configure --prefix=$INSTALL_MEMCACHE_PATH --with-libevent=$INSTALL_LIBEVENT_PATH
else
./configure --prefix=$INSTALL_MEMCACHE_PATH
fi
make
make install #start memcache
rm -f /tmp/memcached.pid
$INSTALL_MEMCACHE_PATH/bin/memcached -d -m -u root -p $MEMCACHE_PORT -c -P $MEMCACHE_PID_FILE cd $CURR_PATH #install libmemcached
rm -f $CURR_PATH/libmemcached-1.0..zip
rm -rf $CURR_PATH/libmemcached-1.0.
wget $DOWNLOAD_LIBMEMCACHED_URL
unzip libmemcached-1.0..zip
chmod -R ./libmemcached-1.0.
cd ./libmemcached-1.0.
mkdir $INSTALL_LIBMEMCACHED_PATH
chmod -R $INSTALL_LIBMEMCACHED_PATH
./configure --prefix=$INSTALL_LIBMEMCACHED_PATH --with-memcached
make
make install cd $CURR_PATH #install php extension Memcached
rm -f $CURR_PATH/php_memcached-2.2..zip
rm -rf $CURR_PATH/memcached-2.2.
rm -rf $PHP_EXT_SOURCE_PATH/memcached-2.2.
wget $DOWNLOAD_PHP_MEMCACHED
unzip php_memcached-2.2..zip
chmod -R ./memcached-2.2.
mv $CURR_PATH/memcached-2.2. $PHP_EXT_SOURCE_PATH/memcached-2.2.
cd $PHP_EXT_SOURCE_PATH/memcached-2.2.
$PHP_BIN_PATH/phpize
./configure --enable-memcached --with-php-config=$PHP_BIN_PATH/php-config --with-libmemcached-dir=$INSTALL_LIBMEMCACHED_PATH --disable-memcached-sasl
make
make install #write php.ini
memcached_exist=$(cat $PHP_INI_PATH | grep 'memcached.so')
if [ -z "$memcached_exist" ]
then
echo "extension=memcached.so" >> $PHP_INI_PATH
fi cd $CURR_PATH #restart php fpm
/etc/init.d/php-fpm restart echo "install successfully"
exit
自动安装memcached服务端与PHP扩展Memcached的更多相关文章
- 自动安装Redis服务端与PHP扩展Redis
该脚本基于阿里云服务器安装脚本,并只能运用于centos / aliyun os,该脚本使用时,需要与阿里云安装脚本的install.sh放在同一目录下.有缘人切忌乱用: #! /bin/bash # ...
- 编译安装rabbitmq服务端
有一种方式是:下载rabbitmq-server-generic-unix压缩包,是不用编译的.是已经编译好的源码了 下面介绍编译源码安装 总括: 需要以下步骤: 1.安装erlange.因为 ...
- Windows安装VNC服务端
下载VNC服务端 由于服务器在IDC机房,只能使用系统自带远程桌面连接到服务器进行安装VPC服务端 但在安装过程发现,如果是通过远程桌面连接到服务器进行安装,VNC Mirror Driver会报错无 ...
- 多个Linux发行版安装ss服务端
本文仅做技术探讨,请在遵守相应的法律法规的前提下使用. Centos 7一键安装脚本 简单快捷,随机生成密码,默认端口默认加密类型 bash <(curl -s http://morning.w ...
- Memcached服务端自动启动(转载)
Memcached服务端自动启动 原文链接:http://www.cnblogs.com/technet/archive/2011/09/11/2173485.html 经测试,要使得Memcach ...
- suse安装svn服务端和客户端的使用
suse安装svn服务端 一. 安装服务端 配置网络安装源(suse11sp1为例) 新建11.1.repo11.1为软件源名称,可自定义文件并添加如下内容后保存 linux-e0xg:/etc/zy ...
- centos 7安装vnc服务端&vnc客户端连接
前言 工作需求,需要用到vnc,介绍一下相关内容. 安装vnc服务端 在执行其他相关的之前,需要先安装一下vnc的服务端,命令如下: yum install tigervnc-server 配置vnc ...
- 安装oracle服务端之后再安装oracle客户端导致sqlplus命令无法使用??
首先小编自述一下所遇到的问题: 昨天在已经安装 oracle 服务端的 win7 X64 主机上安装 oracle client 之后,发现我的sqlplus命令无法用了??经过百度,都说我服务没有开 ...
- CentOS 7.4安装telnet服务端
CentOS 7.4安装telnet服务端 安装xinetd服务 # yum -y install xinetd 安装telnet-server # yum -y install telnet-ser ...
随机推荐
- Servlet的ClassLoader
摘自深入java web技术内幕修订版
- js区分汉字和字符,校验长度
遇到这么一个问题, 长度限制输入150个英文字符(小于等于150个英文字符长度),超出则直接禁止输入,并提醒:摘要输入必须小于等于75个中文字符长度! 长度校验倒是没问题,但是要区分汉字还是英文 ...
- 自己找到的一些比较实用比较好看的前端特效。很多是前面提供的jquery网站的
http://www.cnblogs.com/zhangzongle/p/6034394.html webservicehttp://blog.csdn.net/wowkk/article/detai ...
- 觉得VR头显太笨重?轻便的VR“神器”来了
一直以来需要搭配手机才能使用的VRBOX(VR眼镜盒子)都被大家诟病携带不便.比较笨重.不透气等等问题.大家也一直期待能够有轻便的搭配手机的VR设备出现,最好是可以随身携带的.另外一方面,作为手机最常 ...
- radio里面value值与其他字符进行比较
本题旨在创建一个具有及时反馈的选择题,当选完其中一个选项后,会有弹窗来提醒你选择的答案是正确还是错误的.<div id="text" style="display: ...
- JSTL标签库--核心标签库
->JSTL的使用和EL表达式是分不开的 ->JSTL标签库分为5类 1.核心标签库(这里只介绍该标签库) 2.I18N格式化标签库 3.SQL标签库 4.XML标签库 5.函数标签库 - ...
- Ubuntu14.04 bind9配置
apt-get install bind9 配置域名: cn.archive.ubuntu.com 对应IP: 10.60.233.244 vim /etc/bind/name.conf.defaul ...
- USACO 3.3 TEXT Eulerian Tour中的Cows on Parade一点理解
Cows on Parade Farmer John has two types of cows: black Angus and white Jerseys. While marching 19 o ...
- GL应用方面
1.图和表 2.计算机辅助设计CAD 3.虚拟现实环境 4.数据可视化 5.教学与培训(基于VR) 6.计算机艺术 7.娱乐 8.图像处理 9.用户界面
- 第一百一十七节,JavaScript,DOM元素尺寸和位置
学习要点: 1.获取元素CSS大小 2.获取元素实际大小 3.获取元素周边大小 本章,我们主要讨论一下页面中的某一个元素它的各种大小和各种位置的计算方式,以便更好的理解. 一.获取元素CSS大小 1. ...