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
New and quick way (for myVesta only) :
Code: Select all
v-update-myvesta
v-commander 'inst memcached'