-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathinstall-redis.sh
executable file
·41 lines (32 loc) · 1015 Bytes
/
install-redis.sh
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
#!/bin/bash
# Install the Build and Test Dependencies
sudo apt-get update
sudo apt-get install -y curl build-essential tcl
# Download and Extract the Source Code
cd /tmp
curl -O http://download.redis.io/redis-stable.tar.gz
tar xzvf redis-stable.tar.gz
cd redis-stable
# Build and Install Redis
make
make test
sudo make install
# Configure Redis
sudo mkdir /etc/redis
sudo cp /tmp/redis-stable/redis.conf /etc/redis
sudo sed -i "s/^supervised no/supervised systemd/" /etc/redis/redis.conf
sudo sed -i "s/^dir \.\//dir \/var\/lib\/redis/" /etc/redis/redis.conf
# Create a Redis systemd Unit File
sudo cp redis.service /etc/systemd/system/redis.service
# Create the Redis User, Group and Directories
sudo adduser --system --group --no-create-home redis
sudo mkdir /var/lib/redis
sudo chown redis:redis /var/lib/redis
sudo chmod 770 /var/lib/redis
# Start Redis
sudo systemctl start redis
# Enable Redis to Start at Boot
sudo systemctl enable redis
# Clean
rm -rf /tmp/redis-stable
rm /tmp/redis-stable.tar.gz