-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstall
More file actions
46 lines (37 loc) · 1.13 KB
/
install
File metadata and controls
46 lines (37 loc) · 1.13 KB
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
#!/bin/bash
export DEBIAN_FRONTEND=noninteractive
# 1. Install Redis server
apt-get update
apt-get install -y redis-server
# 2. Stop and disable the default global Redis instance.
systemctl stop redis-server
systemctl disable redis-server
# 3. Create the systemd template file for per-user Redis services.
cat > /etc/systemd/system/redis-user@.service << EOL
[Unit]
Description=Redis for user %i
After=network.target
[Service]
User=%i
Group=%i
Type=simple
ExecStart=/usr/bin/redis-server /home/%i/redis/redis.conf --supervised systemd
ExecStop=/usr/bin/redis-cli -s /home/%i/redis/redis.sock shutdown
Restart=always
PrivateTmp=true
ProtectSystem=full
NoNewPrivileges=true
[Install]
WantedBy=multi-user.target
EOL
# 4. Reload systemd to recognize the new template.
systemctl daemon-reload
# 5. Create the directory for package-specific configurations.
mkdir -p /usr/local/hestia/plugins/redis/packages
# 6. Create a default configuration file.
cat > /usr/local/hestia/plugins/redis/packages/default.conf << EOL
# Redis configuration for the 'default' package
maxmemory 64mb
maxmemory-policy allkeys-lru
EOL
echo "hcpp-redis installation complete."