Skip to content

Instantly share code, notes, and snippets.

@zot24
Forked from solar/install.sh
Created March 22, 2016 14:25
Show Gist options
  • Save zot24/d3698e7d582bd9a4a830 to your computer and use it in GitHub Desktop.
Save zot24/d3698e7d582bd9a4a830 to your computer and use it in GitHub Desktop.
install memcached from source with supervisord
#!/bin/sh
version="1.4.15"
priority="10415"
libevent="/usr/local/libevent/2.0.20-stable/"
supervisordir="/etc/supervisord.d"
# create user
sudo groupadd memcached
sudo useradd -r -g memcached -s /sbin/nologin -M -d /var/run/memcached memcached
# download and install
curl -sL http://memcached.googlecode.com/files/memcached-${version}.tar.gz | tar zx
cd memcached-${version}/
ll
./configure --prefix=/usr/local/memcached/${version} --enable-64bit --with-libevent=${libevent}
make
sudo make install
cd ../
sudo alternatives --install /usr/local/bin/memcached memcached /usr/local/memcached/${version}/bin/memcached ${priority}
sudo cp ./memcached.ini $supervisordir/memcached.ini
sudo supervisorctl reread
sudo supervisorctl add memcached
[program:memcached]
command=/usr/local/bin/memcached -p 11211 -u memcached -m 256 -c 1024 -t 4
autostart=true
autorestart=true
user=root
priority=100
redirect_stderr=true
stdout_logfile=/var/log/memcached/stdout.log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment