-
-
Save coder4web/5762999 to your computer and use it in GitHub Desktop.
BTW yum has last Redis too, remi repository at least. | |
$ sudo -i | |
$ yum list redis | |
$ redis.x86_64 2.6.13-1.el6.remi remi | |
But today we want compile redis from source (see http://redis.io/download) | |
$ yum install make gcc tcl | |
$ cd /usr/local/src | |
$ wget http://redis.googlecode.com/files/redis-2.6.13.tar.gz | |
$ tar xzf redis-2.6.13.tar.gz | |
$ cd redis-2.6.13 | |
$ make | |
$ make test | |
$ make install | |
$ which redis-server | |
/usr/bin/which: no redis-server in (/usr/local/sbin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin) | |
Now we add /usr/local/bin to PATH, thanks to http://serverfault.com/questions/102932/adding-a-directory-to-path-in-centos :) | |
$ echo 'pathmunge /usr/local/bin' > /etc/profile.d/custom_path.sh | |
$ chmod +x /etc/profile.d/custom_path.sh | |
Add sane configuration into redis, thanks to https://gist.github.com/paulrosania/257849 and http://www.ebrueggeman.com/blog/install-redis-centos-56 :) | |
$ mkdir /etc/redis /var/lib/redis | |
$ sed -e "s/^daemonize no$/daemonize yes/" -e "s/^dir \.\//dir \/var\/lib\/redis\//" -e "s/^loglevel debug$/loglevel notice/" -e "s/^logfile stdout$/logfile \/var\/log\/redis.log/" redis.conf > /etc/redis/redis.conf | |
$ wget https://raw.github.com/gist/257849/9f1e627e0b7dbe68882fa2b7bdb1b2b263522004/redis-server | |
$ sed -i "s/usr\/local\/sbin\/redis/usr\/local\/bin\/redis/" redis-server | |
$ chmod u+x redis-server | |
$ mv redis-server /etc/init.d | |
$ /sbin/chkconfig --add redis-server | |
$ /sbin/chkconfig --level 345 redis-server on | |
$ /sbin/service redis-server start | |
Starting redis-server: [ OK ] | |
$ service redis-server status | |
redis-server (pid NNNN) is running... | |
Let's test it: | |
$ redis-cli | |
OR | |
$ telnet 127.0.0.1 6379 | |
$ set attitude:today "happy" | |
$ get attitude:today | |
And happy day to you too ;) | |
great one. btw this link works https://gist.github.com/paulrosania/257849/raw/9f1e627e0b7dbe68882fa2b7bdb1b2b263522004/redis-server
This link also works.
https://raw.github.com/clsung/install-redis-amazon-linux-centos/master/redis-server
Nice stuff, all works as expected!
The line "sed -e "s/^daemonize no$/daemonize yes/" -e "s/^dir .//dir /var/lib/redis//" -e "s/^loglevel debug$/loglevel notice/" -e "s/^logfile stdout$/logfile /var/log/redis.log/" redis.conf > /etc/redis/redis.conf" doesn't seem to be working for me... after running the redis.conf is still empty...
cslagel - you have to run the sed command from within the folder where redis was extracted from the *.tar.gz from the redis.io download site. This folder should have a redis.conf file already, just with default values that we need to change. The sed command will update the necessary values and save those changes to a new redis.conf file under /etc/redis
Also, it looks like for 2.8.7, the sed command should be something similar to (as logfile has default value "" instead of stdout):
sed -e "s/^daemonize no$/daemonize yes/" -e "s/^dir .//dir /var/lib/redis//" -e "s/^loglevel debug$/loglevel notice/" -e "s/^logfile ""$/logfile /var/log/redis.log/" redis.conf > /etc/redis/redis.conf
At least that seems to work for me at first glance.
I noticed in the beginning we're installing to '/usr/local/src':
$ yum install make gcc tcl
$ cd /usr/local/src
$ wget http://redis.googlecode.com/files/redis-2.6.13.tar.gz
$ tar xzf redis-2.6.13.tar.gz
$ cd redis-2.6.13
$ make
$ make test
$ make install
which results in:
[root@LUredis1 src]# locate redis-server
/usr/local/src/redis-2.8.9/src/redis-server
and for the rest of the tutorial we're referencing '/usr/local/bin' as the location for redis-server?
I changed all the references in the init.d script to reflect, but the tutorial should be updated to have the correct paths or instruct moving the redis location.
Don't you think that it is too complex to install redis that way? When I use pip install redis I get the version of 2.10.0, but I I find the stable version is 2.8.13 using this way.
just fyi: https://raw.github.com/gist/257849/9f1e627e0b7dbe68882fa2b7bdb1b2b263522004/redis-server is a dead link