How to install Memcached on openSUSE 12.1

Free & open source, high-performance, distributed memory object caching system, generic in nature, but intended for use in speeding up dynamic web applications by alleviating database load.Memcached is an in-memory key-value store for small chunks of arbitrary data (strings, objects) from results of database calls, API calls, or page rendering.

Memcached is simple yet powerful. Its simple design promotes quick deployment, ease of development, and solves many problems facing large data caches. Its APIis available for most popular languages.

Here is the simple steps to install Memcached on openSUSE 12.1

Open Terminal and then switch to root user.

raj@geeksite:~ $ su

Install Memcached:

Install Memcached using the following command.

root@geeksite:~ # zypper in memcached

Edit Memcached configuration file to change / enable the features.

root@geeksite:~ # vi /etc/sysconfig/memcached

There are some default settings available in the configuration file, change it (if necessary).

Default entry for 64 MB memcache and also it listens only on local host, you need to edit the following entry according to your requirement.

MEMCACHED_PARAMS="-d -l 127.0.0.1"

Required entry for supporting 1GB of memory caching and listening on local host ( To make listen on all ip addresses remove the – l 127.0.0.1 entry.

MEMCACHED_PARAMS=" -m 1024 -d -l 127.0.0.1"

Start Memcached.

root@geeksite:~ # /etc/init.d/memcached start

To auto-start Memcached on booting.

root@geeksite:~ # chkconfig memcached on

Confirm the Memcached running status.

root@geeksite:~ # memcached-tool 127.0.0.1:11211 stats
#127.0.0.1:11211   Field       Value
         accepting_conns           1
               auth_cmds           0
             auth_errors           0
                   bytes           0
              bytes_read          14
           bytes_written         786
              cas_badval           0
                cas_hits           0
              cas_misses           0
               cmd_flush           0
                 cmd_get           0
                 cmd_set           0
             conn_yields           0
   connection_structures           6
        curr_connections           5
              curr_items           0
               decr_hits           0
             decr_misses           0
             delete_hits           0
           delete_misses           0
               evictions           0
                get_hits           0
              get_misses           0
               incr_hits           0
             incr_misses           0
          limit_maxbytes  1073741824
     listen_disabled_num           0
                     pid       13442
            pointer_size          32
               reclaimed           0
           rusage_system    0.000000
             rusage_user    0.090986
                 threads           4
                    time  1331982874
       total_connections           7
             total_items           0
                  uptime        2052
                 version       1.4.5

Install PHP Module:

Install Memcached PHP module to work with PHP5, normally memcahe modules will not be available on standard repository; so add the following repository to get it installed.

root@geeksite:~ # zypper ar http://download.opensuse.org/repositories/server:/php:/extensions/server_php_openSUSE_12.1/ memcache-ext

Refresh the system repositories.

root@geeksite:~ # zypper ref

Install PHP5 module.

root@geeksite:~ # zypper in php5-pecl-memcache

Now restart the Memcached and Apache server to take effect.

root@geeksite:~ # /etc/init.d/memcached restart

root@geeksite:~ # /etc/init.d/apache2 restart

That’s all!

cacheextensionmemcachememcachedopensuse 12phpphp5
Comments (1)
Add Comment
  • Trevor

    Dude this is perfect. Thanks so much!