-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
53 lines (40 loc) · 1.37 KB
/
install.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
42
43
44
45
46
47
48
49
50
51
52
53
#! /bin/bash
# Use this at your own risk!
# Credit: http://www.codingsteps.com/install-redis-2-6-on-ubuntu/
basedir=`pwd`
version="redis-2.6.12"
redisdir="$basedir/$version"
ext=".tar.gz"
redistarname="$version$ext"
redistar="$basedir/$redistarname"
# Get redis
wget http://redis.googlecode.com/files/${redistarname}
cd $basedir && tar xzf $redistar
# Install
cd $redisdir && make
cd $redisdir && make install
cd $redisdir && make test
# Create configuration
sudo mkdir /etc/redis
sudo mv redis.conf /etc/redis/redis.conf
# Configure redis as a daemon
echo "daemonize yes" | sudo tee -a /etc/redis/redis.conf
echo "bind 127.0.0.1" | sudo tee -a /etc/redis/redis.conf
echo "dir /var/lib/redis" | sudo tee -a /etc/redis/redis.conf
# Copy binaries to init.d
cd $basedir && sudo cp redis-server $redisdir
cd $redisdir && sudo mv redis-server /etc/init.d/redis-server
sudo chmod +x /etc/init.d/redis-server
cd "$redisdir/src" && sudo cp redis-cli /usr/local/bin/redis-cli
cd "$redisdir/src" && sudo cp redis-server /usr/bin/
echo "DAEMON=/usr/local/bin/redis-server" | sudo tee -a /etc/init.d/redis-server
# Make log files
sudo useradd redis
sudo mkdir -p /var/lib/redis
sudo mkdir -p /var/log/redis
sudo chown redis.redis /var/lib/redis
sudo chown redis.redis /var/log/redis
# Auto-enable redis server
sudo update-rc.d redis-server defaults
# Start redis!
sudo /etc/init.d/redis-server start