I can use Yum. But, I am going to install from source in order to get the latest builds.
Memcached requires libevent. So, get and install libevent first.
tar zxpfv libevent*
sudo make install
Next, install memcached.
tar zxpfv memcached*
Errors . . . there is always at least one
You may get this error:
error while loading shared libraries: libevent-*: cannot open shared object file: No such file or directory
You need to create a symbolic link. For me, this is the command I needed to run. Yours may differ depending on the release you downloaded.
sudo ln -s /usr/local/lib/libevent-1.4.so.2 /usr/lib
memcached -d -m 64 -p 11211
"-d" runs memcached in daemon mode.
"-m" is the amount of memory memcached will use in MB's.
"-p" is the port # for memcached.
Connect to it from Rails 2.1
Rails 2.1 is awesome because of its new caching features. It can support memcached as a cache server. In order to get this to work, add/edit the following line in your config/environment.rb file. Or, you can add/edit your specific environments file, such as config/environments.development.rb file.
config.cache_store = :mem_cache_store, 'IP_ADDRESS_OF_MEMCACHED_SERVER:11211'