首页 > 代码库 > redis安装
redis安装
下载redis安装包,下载地址:http://redis.io/download 我这里下载3.0.7版本
将安装包拷贝到linux服务器中然后进行解压 [root@localhost ~]# tar zxvf redis-3.0.7.tar.gz
创建一个lamp的目录并将解压文件移动到此目录下面[root@localhost ~]# mkdir lamp [root@localhost ~]# mv redis-3.0.7 /lamp/[root@localhost ~]# cd /lamp/redis-3.0.7/ [root@localhost redis-3.0.7]# make
编译完成后,redi-3.0.7 目录下会有src conf等目录,进入src目录下 [root@localhost redis-3.0.7]# cd src/
[root@localhost src]# make install
为方便管理,将Redis文件中的conf配置文件和常用命令移动到统一文件中
[root@localhost ~]# mkdir -p /usr/local/redis/bin
[root@localhost ~]# mkdir -p /usr/local/redis/etc
[root@localhost ~]#mv /lamp/redis-3.0.7/redis.conf /usr/local/redis/etc
[root@localhost ~]#cd /lamp/redis-3.0.7/src
[root@localhost ~]#mv mkreleasdhdr.sh redis-benchmark redis-check-aof redis-check-dump redis-cli redis-server /usr/local/redis/bin后台启动服务
编辑conf文件,将daemonize属性改为yes
[root@localhost ~]#cd /usr/local/redis/etc
[root@localhost ~]#vi redis.conf #将daemonize属性no改为yes
[root@localhost ~]#redis-server /usr/local/redis/etc/redis.conf
查看服务
[root@localhost ~]# netstat -nltp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:6379 0.0.0.0:* LISTEN 5991/redis-server *
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 941/sshd
tcp 0 0 ::ffff:127.0.0.1:8005 :::* LISTEN 2659/java
tcp 0 0 :::8009 :::* LISTEN 2659/java
tcp 0 0 :::6379 :::* LISTEN 5991/redis-server *
tcp 0 0 :::8080 :::* LISTEN 2659/java
tcp 0 0 :::22 :::* LISTEN 941/sshd查看客户端端口号
[root@localhost ~]# redis-cli
127.0.0.1:6379>
127.0.0.1:6379>
127.0.0.1:6379> exit
[root@localhost ~]# netstat -nltp | grep 6379
tcp 0 0 0.0.0.0:6379 0.0.0.0:* LISTEN 5991/redis-server *
tcp 0 0 :::6379 :::* LISTEN 5991/redis-server *
redis安装