Download Redis
Http://download.redis.io/releases/redis-2.8.13.tar.gz
Using the root user to install Redis
[[Email protected] ~]# iduid=0 (Root) gid=0 (root) groups=0 (root) [[email protected ] ~]# ls -l redis-2.8.13.tar.gz-rw-r--r-- 1 oracle oinstall 1227538 oct 23 14:53redis-2.8.13.tar.gz Decompression [[email protected] ~]# tar xzf redis-2.8.13.tar.gz[[email protected] ~]# ls -ld redis-2.8.13drwxrwxr-x 6 root root 4096 jul 14 2014 redis-2.8.13[[email protected] ~]# cd redis-2.8.13[[email protected] redis-2.8.13]# ls00-releasenotes contributing deps Makefile README Runtest sentinel.conf testsbugs COPYING install &nbSp manifesto redis.conf runtest-sentinel src utils recommended here is make && make test && make The install output is too much, and it is not fully posted. [[Email protected] redis-2.8.13]# makecd src && make allmake[1]: Entering directory '/root/redis-2.8.13/src ' ....hint: to run ' make test ' is a good idea ;) make[1]: leaving directory '/root/redis-2.8.13/src ' [ [email protected] redis-2.8.13]# make testcd src && make testmake[1]: entering directory '/root/redis-2.8.13/src ' you need tcl 8.5 or newer in order to run the redis testmake[1]: *** [test] Error 1make[1]: Leaving directory '/root/redis-2.8.13/src ' make: *** [test] &nbsP error 2[[email protected] redis-2.8.13]# make installcd src && make installmake[1]: Entering directory '/root/redis-2.8.13/src ' hint: to run ' make test ' is a good idea ;) Install install install install install install install install install installmake[1]: leaving directory '/ROOT/REDIS-2.8.13/SRC '
Initialize a service
Copy executable files to/USR/LOCAL/[[EMAIL PROTECTED] REDIS-2.8.13]# CP UTILS /USR/LOCAL/ -RF directly in Run the install_server.sh script in/root/redis-2.8.13/utils and initialize a service with a port number of 6379 [[email protected] utils]# ./ Install_server.shwelcome to the redis service installerthis script will help you easily set up a running redisserver please select the redis port for this instance: [6379] #选择端口号Selecting default: 6379please select the redis config file name[/etc/redis/ 6379.conf] #选择配置文件Selected default - /etc/redis/6379.confPlease select the redis log file name[/var/log/redis_6379.log] # Select Log File selected default - /var/log/redis_6379.logplease select the data directory for this instance[/var/lib/redis/6379] #选择数据文件目录Selected default - /var/lib/redis/6379 Please select the redis executable path[/usr/local/bin/redis-server] #选择redis-server Execution Path selected config:port : 6379Config file :/etc/redis/6379.confLog file :/var/log/redis_6379.logData dir :/var/lib/redis/6379Executable :/usr/local/bin/redis-serverCli Executable : /usr/local/bin/redis-cliis this ok? then press enter to go on or ctrl-c to abort. Copied /tmp/6379.conf => /etc/init.d/redis_6379installing service ... successfully added to chkconfig! successfully added to runlevels 345! StArting redis server ... installation successful! In addition reconfigure a 6378, choose similar to just like [[Email protected] utils]# ./install_ Server.shwelcome to the redis service installerthis script will help you easily set up a running redisserver please select the redis port for this instance: [6379] 6378 # Just need to change this position please select the redis config file name[/etc/redis/6378.conf]selected default - /etc/redis/6378.confPlease select the redis log file name[/var/log/redis_6378.log]selected default - /var/log/redis_6378.logplease select the data directory for this instance[/var/lib/redis/6378]selected default - /var/lib/redis/6378please select the redis executable path[/usr/local/bin/redis-server]selected config:port : 6378config file :/etc/redis/6378.conflog file :/var/log/redis_6378.logdata dir :/var/lib/redis/ 6378executable :/usr/local/bin/redis-servercli executable : /usr/ local/bin/redis-cliis this ok? then press enter to go on or Ctrl-c to abort. Copied /tmp/6378.conf => /etc/init.d/redis_6378installing service ... successfully added to chkconfig! successfully added to runlevels 345! Starting redis server ... installation successful!
Verify that the installation is successful
[[email protected] utils]#/etc/init.d/redis_6378 status #查看redis状态Redis is running (9487) [[email protected] utils]# /etc/init.d/redis_6378 stop #关闭redisStopping  , ..... redis stopped[[email protected] utils]# /etc/init.d/redis_6378 start #启动redisStarting redis server ... Add Boot service [[email protected] utils]# chkconfig redis_6378 on 2345[[email Protected] utils]# chkconfig --list redis_6378redis_6378 0:o ff 1:off 2:on 3:on 4:on 5:on 6:off use REDIS-CLI to set values and get values [[email protected] utils]# /usr/local /bin/redis-cli #默认调用6379端口127.0.0.1:6379> set k1&nbSp;1ok127.0.0.1:6379> exit[[email protected] utils]# /usr/local/bin/redis-cli -p 6378 #-p parameters can specify port access 127.0.0.1:6378> set ke1 aok127.0.0.1:6378> get ke1 "A" #这里可以通过get方式获取值, it means the installation was successful 127.0.0.1:6378> quit[ [Email protected] utils]# /usr/local/bin/redis-cli -p 6379127.0.0.1:6379> get k1 "1" 127.0.0.1:6379> access to remote Redis, directly through the-h parameter can specify the IP address for remote access [[email protected] utils]# /usr/local/bin/redis-cli -h 192.168.10.140 -p 6379192.168.10.140:6379> get k1 "1" 192.168.10.140:6379> get ka (nil) 192.168.10.140:6379> get ke1 (nil )
This article is from the "long name will be good to remember" blog, please be sure to keep this source http://xiaoyiyi.blog.51cto.com/1351449/1705708
(i) using the source package method to install redis-2.8.13