How to install memcached on Debian

Post Reply
User avatar
myVesta
Site Admin
Posts: 934
Joined: Fri Jun 19, 2020 9:59 am
Has thanked: 8 times
Been thanked: 6 times

In order to install memcached service, in SSH, as root, run:

Code: Select all

memory=$(grep 'MemTotal' /proc/meminfo |tr ' ' '\n' |grep [0-9])
apt-get update
apt-get -y install memcached 
apt-get install $(systemctl --full --type service --all | grep "php...-fpm" | sed 's#●##g' | awk '{print $1}' | cut -c1-6 | xargs -n 1 printf "%s-memcache ")
apt-get install $(systemctl --full --type service --all | grep "php...-fpm" | sed 's#●##g' | awk '{print $1}' | cut -c1-6 | xargs -n 1 printf "%s-memcached ")
if [ $memory -lt 15000000 ]; then
    sed -i "s/-m 64/-m 256/" /etc/memcached.conf
else
    sed -i "s/-m 64/-m 1024/" /etc/memcached.conf
fi
systemctl restart memcached
OR

New and quick way (for myVesta only) :

Code: Select all

v-update-myvesta
v-commander 'inst memcached'
Post Reply