-
-
Save ivan-leschinsky/2c5ff6b01d21cf6b8dcbdb2c86a9fdd7 to your computer and use it in GitHub Desktop.
Install Redis 4.0.2 on EC2
This file contains hidden or 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
| # 1. Install Linux updates, set time zones, followed by GCC and Make | |
| # sudo yum -y update | |
| # sudo ln -sf /usr/share/zoneinfo/America/Indianapolis \ | |
| # /etc/localtime | |
| # sudo yum -y install gcc make | |
| # 2. Download, Untar and Make Redis 2.8 (check here http://redis.io/download) | |
| cd /tmp | |
| wget http://download.redis.io/releases/redis-4.0.2.tar.gz | |
| tar xzf redis-4.0.2.tar.gz | |
| cd redis-4.0.2 | |
| make | |
| # 3. Create Directories and Copy Redis Files | |
| sudo mkdir /etc/redis | |
| sudo mkdir /var/lib/redis | |
| sudo cp src/redis-server src/redis-cli /usr/local/bin/ | |
| sudo cp redis.conf /etc/redis/ | |
| # 4. Configure Redis.Conf | |
| sudo nano /etc/redis/redis.conf | |
| daemonize yes | |
| bind 127.0.0.1 | |
| dir /var/lib/redis | |
| # 5. Download init Script | |
| cd /tmp | |
| wget https://gist.githubusercontent.com/ivan-leschinsky/2c5ff6b01d21cf6b8dcbdb2c86a9fdd7/raw/redis-server | |
| # 6. Move and Configure Redis-Server | |
| # Note: The redis-server to be moved below is the one downloaded in 5 above. | |
| sudo mv redis-server /etc/init.d | |
| sudo chmod 755 /etc/init.d/redis-server | |
| # 7. Auto-Enable Redis-Server | |
| sudo chkconfig --add redis-server | |
| sudo chkconfig --level 345 redis-server on | |
| # 8. Start Redis Server | |
| sudo service redis-server start | |
| # Taken from http://codingsteps.com/install-redis-2-6-on-amazon-ec2-linux-ami-or-centos/ and updated. |
This file contains hidden or 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/sh | |
| # From - http://www.codingsteps.com/install-redis-2-6-on-amazon-ec2-linux-ami-or-centos/ | |
| # | |
| # redis - this script starts and stops the redis-server daemon | |
| # Originally from - https://raw.github.com/gist/257849/9f1e627e0b7dbe68882fa2b7bdb1b2b263522004/redis-server | |
| # | |
| # chkconfig: - 85 15 | |
| # description: Redis is a persistent key-value database | |
| # processname: redis-server | |
| # config: /etc/redis/redis.conf | |
| # config: /etc/sysconfig/redis | |
| # pidfile: /var/run/redis.pid | |
| # Source function library. | |
| . /etc/rc.d/init.d/functions | |
| # Source networking configuration. | |
| . /etc/sysconfig/network | |
| # Check that networking is up. | |
| [ "$NETWORKING" = "no" ] && exit 0 | |
| redis="/usr/local/bin/redis-server" | |
| prog=$(basename $redis) | |
| REDIS_CONF_FILE="/etc/redis/redis.conf" | |
| [ -f /etc/sysconfig/redis ] && . /etc/sysconfig/redis | |
| lockfile=/var/lock/subsys/redis | |
| start() { | |
| [ -x $redis ] || exit 5 | |
| [ -f $REDIS_CONF_FILE ] || exit 6 | |
| echo -n $"Starting $prog: " | |
| daemon $redis $REDIS_CONF_FILE | |
| retval=$? | |
| echo | |
| [ $retval -eq 0 ] && touch $lockfile | |
| return $retval | |
| } | |
| stop() { | |
| echo -n $"Stopping $prog: " | |
| killproc $prog -QUIT | |
| retval=$? | |
| echo | |
| [ $retval -eq 0 ] && rm -f $lockfile | |
| return $retval | |
| } | |
| restart() { | |
| stop | |
| start | |
| } | |
| reload() { | |
| echo -n $"Reloading $prog: " | |
| killproc $redis -HUP | |
| RETVAL=$? | |
| echo | |
| } | |
| force_reload() { | |
| restart | |
| } | |
| rh_status() { | |
| status $prog | |
| } | |
| rh_status_q() { | |
| rh_status >/dev/null 2>&1 | |
| } | |
| case "$1" in | |
| start) | |
| rh_status_q && exit 0 | |
| $1 | |
| ;; | |
| stop) | |
| rh_status_q || exit 0 | |
| $1 | |
| ;; | |
| restart|configtest) | |
| $1 | |
| ;; | |
| reload) | |
| rh_status_q || exit 7 | |
| $1 | |
| ;; | |
| force-reload) | |
| force_reload | |
| ;; | |
| status) | |
| rh_status | |
| ;; | |
| condrestart|try-restart) | |
| rh_status_q || exit 0 | |
| ;; | |
| *) | |
| echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}" | |
| exit 2 | |
| esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment