Bravo List
Register
Go Back   > Bravo List > P2P > Forum > Tutorials
Reply
  #1  
Old 19-08-11, 13:52
Fynnon's Avatar
Fynnon Fynnon is offline
xxx
 
Join Date: Nov 2007
P2P
Posts: 963
Default Easy/Automated installation of memcached for Debian Etch/Lenny
This script will automatically install memcached on Debian, and set it to start at system boot.

1) Create install_memcached.sh

vi install_memcached.sh

2) Copy & paste the script into your editor:

PHP Code:
#!/bin/bash
#
# Download and install libevent and memcached from source on Debian Etch or 
# Debian Lenny.
#
# Assumptions
# - libevent and memcached have not been installed from apt repositories
# - memcached is not already running
# - it is ok to clobber scripts at
#   /etc/memcached.conf
#   /etc/init.d/memcached
#   /usr/share/memcached/scripts/start-memcached
#
# Author : Scott Barr
# Date   : 14 Dec 2009
#

sudo apt-get install sysv-rc-conf

cd 
/usr/local/src/

# See http://www.monkey.org/~provos/libevent/ for versions
LIBEVENT_VERSION="libevent-1.4.13-stable"

# See http://memcached.org/ for latest version.
# File is assumed to reside at http://memcached.googlecode.com/files/memcached-${MEMCACHED_VERSION}.tar.gz
MEMCACHED_VERSION="1.4.5"

# where libevent will be installed
LIBEVENT_PREFIX="/opt/${LIBEVENT_VERSION}"

# get the major version of libevent
LIBEVENT_MAJOR_VERSION=`echo $LIBEVENT_VERSION | cut -d\. -f 1,2 | cut -d\- -f 2`

# where memcached will be installed
MEMCACHED_PREFIX="/opt/memcached-${MEMCACHED_VERSION}"

# download, configure and install libevent
wget http://www.monkey.org/~provos/${LIBEVENT_VERSION}.tar.gz
tar -zxf ${LIBEVENT_VERSION}.tar.gz 
cd 
${LIBEVENT_VERSION}
sudo mkdir /opt/${LIBEVENT_VERSION}
./
configure --prefix=${LIBEVENT_PREFIX}
make
sudo make install
sudo ln 
-/opt/${LIBEVENT_VERSION}/lib/libevent-${LIBEVENT_MAJOR_VERSION}.so.2 /usr/lib/libevent-${LIBEVENT_MAJOR_VERSION}.so.2

cd 
..

# download configure and install memcached
wget http://memcached.googlecode.com/files/memcached-${MEMCACHED_VERSION}.tar.gz
tar -zxf memcached-${MEMCACHED_VERSION}.tar.gz 
cd memcached
-${MEMCACHED_VERSION}
./
configure --prefix=${MEMCACHED_PREFIX} --with-libevent=${LIBEVENT_PREFIX}
make
sudo make install
sudo ln 
-/opt/memcached-${MEMCACHED_VERSION}/bin/memcached  /usr/local/bin/memcached

cd 
..

# download and install memcached config files
wget http://github.com/havoc/memcached/raw/master/start-memcached --no-check-certificate
sudo mkdir -/usr/share/memcached/scripts
sudo mv start
-memcached /usr/share/memcached/scripts/
sudo chmod o+/usr/share/memcached/scripts/start-memcached

wget http
://github.com/havoc/memcached/raw/master/memcached --no-check-certificate
sudo mv memcached /etc/init.d/memcached
sudo chmod o
+/etc/init.d/memcached

wget http
://github.com/havoc/memcached/raw/master/memcached.conf --no-check-certificate
sudo mv memcached.conf /etc/memcached.conf

sudo 
/etc/init.d/memcached start
sudo sysv
-rc-conf --level 2345 memcached on 
3) Run the script!

chmod +x install_memcached.sh sudo ./install_memcached.sh

4) PROFIT!!! Memcached will automatically start at system boot. You can tweak the settings as needed in /etc/memcached.conf. By default memcached will use 512MB of memory, change as needed.

(I did not write this script, the original script found here: here. The only difference is the conf file the installer downloads.)
Reply With Quote
  #2  
Old 30-09-11, 17:35
Optix's Avatar
Optix Optix is offline
ZenTracker Developer
 
Join Date: Sep 2011
France
Posts: 145
Default
Personally, I prefer the apt-get version ^^

Code:
# apt-get install memcached php5-memcache
Reply With Quote
Reply

Tags
debian , easy or automated , etch or lenny , installation , memcached

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



All times are GMT +2. The time now is 03:16. vBulletin skin by ForumMonkeys. Powered by vBulletin® Version 3.8.11 Beta 3
Copyright ©2000 - 2018, vBulletin Solutions Inc.