Monday, 13 February 2012

memcached

Update: memcached has been added to amzn.repo, so 'yum install memcached' will do.
Here's a quick recipe for installing memcached on EC2 Amazon Linux AMI 1.0.
yum install gcc libevent libevent-devel
cd /usr/local/src
wget http://memcached.org/latest
tar -xf memcached-*.tar.gz
cd memcached-*
./configure
make && make install
Memcached will be installed to /usr/local/bin. Let's make sure everything went well by running memcached:
/usr/local/bin/memcached -u root -d
Then we'll make sure it's running
ps aux | grep memcached
And finally kill it.
pkill memcached

Going all out - building a memcached rpm

If you're installing memcached on multiple machines then having an RPM handy is preferred. Make sure to run this as the ec2-user and not root.
cd ~
sudo yum install gcc libevent libevent-devel rpm-build perl-Test-Base
echo "%_topdir /home/ec2-user/rpmbuild" >> ~/.rpmmacros
mkdir -p /home/ec2-user/rpmbuild/{SPECS,BUILD,SRPMS,RPMS,SOURCES}
wget http://memcached.org/latest
rpmbuild -ta memcached-*.tar.gz
The RPM will be created in ~/rpmbuild/RPMS/x86_64/ or ~/rpmbuild/RPMS/i386/ depending on whether you chose a 32 or 64 bit AMI. Copy the rpm to your home directory and run the command below to install memcached to /usr/bin/memcache
sudo yum localinstall memcached-*.rpm --nogpgcheck
The beauty of this approach is that you can now do the following to start or stop memcached
service memcached status
service memcached start
service memcached stop
And finally you can enable memcached at startup with this simple command:
chkconfig memcached on
 
 
 
 
http://www.developly.com/installing-memcached-on-amazon-linux-ami 

No comments:

Post a Comment