-
-
Save dfetterman/cf7bc4aa53c47fb546c6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# from here: http://www.codingsteps.com/install-redis-2-6-on-amazon-ec2-linux-ami-or-centos/ | |
# and here: https://raw.github.com/gist/257849/9f1e627e0b7dbe68882fa2b7bdb1b2b263522004/redis-server | |
############################################### | |
# To use: | |
# wget https://gist.githubusercontent.com/dfetterman/cf7bc4aa53c47fb546c6/raw/e11cd22f41e6cab71fe621b1f5a1377ff3af01ab/install-redis.sh | |
# chmod 777 install-redis.sh | |
# ./install-redis.sh | |
############################################### | |
echo "*****************************************" | |
echo " 1. Prerequisites: Install updates, set time zones, install GCC and make" | |
echo "*****************************************" | |
#sudo yum -y update | |
#sudo ln -sf /usr/share/zoneinfo/America/Los_Angeles \/etc/localtime | |
sudo yum -y install gcc gcc-c++ make | |
echo "*****************************************" | |
echo " 2. Download, Untar and Make Redis 2.6" | |
echo "*****************************************" | |
cd /usr/local/src | |
sudo wget http://download.redis.io/releases/redis-2.8.11.tar.gz | |
sudo tar xzf redis-2.8.11.tar.gz | |
sudo rm redis-2.8.11.tar.gz -f | |
cd redis-2.8.11 | |
sudo make | |
echo "*****************************************" | |
echo " 3. Create Directories and Copy Redis Files" | |
echo "*****************************************" | |
sudo mkdir /etc/redis /var/lib/redis | |
sudo cp src/redis-server src/redis-cli /usr/local/bin | |
echo "*****************************************" | |
echo " 4. Configure Redis.Conf" | |
echo "*****************************************" | |
echo " Edit redis.conf as follows:" | |
echo " 1: ... daemonize yes" | |
echo " 2: ... bind 127.0.0.1 (CURRENTLY COMMENTED OUT)" | |
echo " 3: ... dir /var/lib/redis" | |
echo " 4: ... loglevel notice" | |
echo " 5: ... logfile /var/log/redis.log" | |
echo "*****************************************" | |
cd /etc/redis/ | |
sudo wget https://gist.githubusercontent.com/dfetterman/7f859d8d65200754de6c/raw/b577a3d6db528f81c8f43d51b47edcf3c3fcaffe/redis.conf | |
sudo sed -i "s/^daemonize no$/daemonize yes/g" redis.conf | |
#sudo sed -i "s/^# bind 127.0.0.1$/bind 127.0.0.1/g" redis.conf | |
sudo sed -i "s/^dir \.\//dir \/var\/lib\/redis\//g" redis.conf | |
sudo sed -i "s/^loglevel verbose$/loglevel notice/g" redis.conf | |
sudo sed -i 's/^logfile ""/logfile \/var\/log\/redis.log/g' redis.conf | |
#sudo sed -e "s/^daemonize no$/daemonize yes/" -e "s/^# bind 127.0.0.1$/bind 127.0.0.1/" -e "s/^dir \.\//dir \/var\/lib\/redis\//" -e "s/^loglevel verbose$/loglevel notice/" -e "s/^logfile stdout$/logfile \/var\/log\/redis.log/" redis.conf > /etc/redis/redis.conf | |
echo "*****************************************" | |
echo " 5. Download init Script" | |
echo "*****************************************" | |
sudo wget https://gist.githubusercontent.com/dfetterman/b73118c05ea40a30e925/raw/7e800637d1a0c95dc0deb578437cc1d1e5026fe8/redis-server-for-init.d-startup | |
echo "*****************************************" | |
echo " 6. Move and Configure Redis-Server" | |
echo "*****************************************" | |
sudo mv redis-server-for-init.d-startup /etc/init.d/redis-server | |
sudo chmod 755 /etc/init.d/redis-server | |
echo "*****************************************" | |
echo " 7. Auto-Enable Redis-Server" | |
echo "*****************************************" | |
sudo chkconfig --add redis-server | |
sudo chkconfig --level 345 redis-server on | |
echo "*****************************************" | |
echo " 8. Start Redis Server" | |
echo "*****************************************" | |
sudo service redis-server start | |
echo "*****************************************" | |
echo " Complete!" | |
echo " You can test your redis installation using the redis console:" | |
echo " $ src/redis-cli" | |
echo " redis> set foo bar" | |
echo " OK" | |
echo " redis> get foo" | |
echo " bar" | |
echo "*****************************************" | |
read -p "Press [Enter] to continue..." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment