forked from littlebizzy/slickstack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ss-install-redis.txt
62 lines (48 loc) · 2.92 KB
/
ss-install-redis.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/bin/bash
####################################################################################################
#### author: SlickStack ############################################################################
#### link: https://slickstack.io ###################################################################
#### mirror: http://mirrors.slickstack.io/ss-install-redis.txt #####################################
#### path: /var/www/ss-install-redis ###############################################################
#### destination: n/a (not a boilerplate) ##########################################################
#### purpose: Reinstalls the entire Redis server module for object caching (idempotent) ############
#### module version: Ubuntu 20.04 LTS + Redis 5.0.x ################################################
####################################################################################################
## SS-CONFIG MUST BE PROPERLY CONFIGURED (AND CURRENT BUILD) BEFORE RUNNING SS-INSTALL ##
## ENSURE SS-CONFIG OPTIONS REMAIN CURRENT BY RUNNING SS-UPDATE OCCASIONALLY ##
## include SlickStack configuration ##
source /var/www/ss-config
## include SlickStack functions ##
source /var/www/ss-functions
####################################################################################################
#### SS-Install-Redis: Install Redis Server + PHP-Redis Extension ##################################
####################################################################################################
## here we install redis-server (no client) for use in WordPress object caching (only) ##
## this Redis server package also includes the Redis CLI command line tools ##
## purge redis-server + php-redis ##
apt purge redis-server
apt purge php-redis
## install redis-server + php-redis ##
apt install redis-server
apt install php-redis
## configure redis-server for object caching (only) ##
sed -i '/maxmemory.*bytes.*/c\maxmemory 256mb' /etc/redis/redis.conf
sed -i '/maxmemory-policy noeviction/c\maxmemory-policy allkeys-lru' /etc/redis/redis.conf
sed -i '/always-show-logo yes/c\always-show-logo no' /etc/redis/redis.conf
# sed -i '/logfile/c\logfile /var/www/logs/redis.log' /etc/redis/redis.conf
# sed -i '/dir /c\dir /tmp' /etc/redis/redis.conf
## create log files if do not exist ##
# if [ ! -f "/var/www/logs/redis.log" ]; then touch "/var/www/logs/redis.log"; fi
# mkdir /var/run/redis
## reset permissions ##
chown redis:redis /var/www/logs/redis.log
chown redis:redis /etc/redis/redis.conf
chown redis:redis /var/run/redis
chmod 6775 /var/www/logs/redis.log
chmod 775 /etc/redis/redis.conf
chmod 775 /var/run/redis
####################################################################################################
#### SlickStack: External References Used To Improve This Script (Thanks, Interwebz) ###############
####################################################################################################
## Ref:
## SS_EOF