Linux 下 安装 Redis

 //redis 的下载地址
[root@localhost wengpengle]#  wget http://download.redis.io/releases/redis-2.8.7.tar.gz

 //解压下载好的 redis 压缩包
[root@localhost wengpengle]# tar -xzf redis-2.8.7.tar.gz

 //解压完毕 进入redis-2.8.7 目录
[root@localhost wengpengle]# cd redis-2.8.7

 //make一下
[root@localhost redis-2.8.7]# make

 //指定 redis 的安装目录
[root@localhost redis-2.8.7]# make PREFIX=/usr/local/redis install

 //将redis的配置文件复制一份 redis 的安装目录
[root@localhost redis-2.8.7]# cp redis.conf /usr/local/redis

 至此,编译安装完毕。 

 //进入 制定的安装目录 
[root@localhost ~]# cd /usr/local/redis/ 

 //修改配置文件,将其中的"daemonize no"行改为"daemonize yes",让其在后台运行。
[root@localhost redis]# vim redis.conf 

 //启动redis服务 
[root@localhost redis]# ./bin/redis-server redis.conf 

 //关闭服务: 
[root@localhost redis]# ./bin/redis-cli -p 6379 shutdown 

 //简单的 set 与 get 的操作、看看 redis 是否能用 
[root@localhost redis]# ./bin/redis-cli 
127.0.0.1:6379> set name 'wengpengle' 
OK 
127.0.0.1:6379> get name 
"wengpengle" 

 // 如果想进入其他IP 则需要加上 -h
[root@localhost redis]# ./bin/redis-cli -h 192.168.1.75 
192.168.1.75:6379> get name 
"wengpengle"





猜你喜欢

转载自blog.csdn.net/wplblog/article/details/52195565