case centos
일단centos 배포본에는 memcached가 없다 그래서 소스컴파일로 설치한다.(root로 가정)

yum install libevent libevent-devel
wget http://www.danga.com/memcached/dist/memcached-1.4.0.tar.gz
tar -xvzf memcached-1.4.0.tar.gz
cd memcached-1.4.0
./configure --with-libevent=/usr/lib/
make; make install

기본 설정 파일도 만들어주자.

vi /etc/memcached.conf
#Memory a usar
-m 16
# default port
-p 11211
# user to run daemon nobody/apache/www-data
-u nobody
# only listen locally
-l 127.0.0.1

init script 도 생성해준다. 참조 사이트

일단 만들어 놓은 스크립트가 있으니 다운받아 사용도록 하자

memcached init script downlod : memcached_script.tar.gz

wget http://yupmin.net/wp-content/uploads/2010/08/memcached_script.tar.gz
tar xvfz memcached_script.tar.gz
mv memcached /usr/local/bin/start-memcached
mv start-memcached /etc/init.d/memcached
chmod 755 /usr/local/bin/start-memcached
chmod 755 /etc/init.d/memcached

case ubuntu

유분투에는 쉽게 설치 패키지가 준비되어있다.(root로 가정)

apt-get install memcached
service memcached start

case centos

memcached php 관련 패키지는 centos에 있다.

yum install php-pecl-memcache

혹은  php버젼이 업데이트 되거나 몇가지 안되는 경우가 있다 이럴땐 직접 컴파일한다.

wget http://pecl.php.net/get/memcache-2.2.5.tgz
tar xvfz memcache-2.2.5.tgz
cd memcache-2.2.5
phpize
./configure --enable-memcache
make
cp modules/memcache.so /usr/lib/php/modules

php에 모듈을 셋팅해주자.

vi /etc/php.d/memache.ini
extension=memcache.so

memcached php test : http://dorkage.net/2009/02/memcached-test/

A quick way to get memcached status : http://www.mysqlperformanceblog.com/2008/11/26/a-quick-way-to-get-memcached-status/
mysql 컨퍼런스에서 한 외국인 강사가 발표했던 키노트 : http://download.tangent.org/talks/Memcached%20Study.pdf