服务器环境: Ubuntu 12.04.2

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/bin/bash
# name:install_memcached.sh
# description:
# author:lihuibin
# version: 0.0.1
# datetime: 2013-09-16 15:01:02
# usage:install_memcached.sh
cd  ` dirname  $0`
count=` ps  -ef | grep  'memcached'  | grep  11211 | grep  - v  grep  wc  -l`
if  [ $count - eq  1 ] ;  then
echo  "memcached installed,is running"
exit
fi
function  start_memc()
{
/usr/local/memcached/bin/memcached  -d -m 4096 -u root -p 11211 -c 10240  >  /dev/null  2>&1
}
if  [ -f  /usr/local/memcached/bin/memcached  ]; then
start_memc
if  [ $? - eq  0 ] ; then
echo  "memcached installed,start running"
exit
fi
fi
echo  "*******start down load memcached********"
wget http: //memcached .googlecode.com /files/memcached-1 .4.15. tar .gz
if  [ $? - eq  0 ] && [ -f memcached-1.4.15. tar .gz ] ;  then
echo  "memcached-1.4.15.tar.gz down load completed"
else
echo  "memcached-1.4.15.tar.gz down load failed"
exit
fi
wget https: //github .com /downloads/libevent/libevent/libevent-2 .0.21-stable. tar .gz
if  [ $? - eq  0 ] && [ -f libevent-2.0.21-stable. tar .gz ] ;  then
echo  "libevent-2.0.21-stable.tar.gz down load completed"
else
echo  "libevent-2.0.21-stable.tar.gz down load failed"
exit
fi
echo  "******* down load memcached completed********"
echo  "memcached start install"
tar  zxvf libevent-2.0.21-stable. tar .gz
cd  libevent-2.0.21-stable
  . /configure  --prefix= /usr/local/libevent
  make
  make  install
cd  ..
rm  -rf libevent-2.0.21-stable. tar .gz libevent-2.0.21-stable
tar  zxvf memcached-1.4.15. tar .gz
cd  memcached-1.4.15/
. /configure  --prefix= /usr/local/memcached  --with-libevent= /usr/local/libevent/
make
make  install
cd  ..
rm  -rf memcached-1.4.15. tar .gz memcached-1.4.15
start_memc
if  [ $? - eq  0 ] ;  then
echo  "memcached installed success , start running"
fi

本文转自birdinroom 51CTO博客,原文链接:http://blog.51cto.com/birdinroom/1343987,如需转载请自行联系原作者