#安装wget命令,通过wget命令下载redis-3.0.4.tar.gz yum -y install wget wget http://download.redis.io/releases/redis-3.0.4.tar.gz #解压redis-3.0.4.tar.gz tar -xzvf redis-3.0.4.tar.gz
#安装tcl yum install tcl #编译安装Redis ll cd redis-3.0.4 make #安装 make install
#配置Redis,复制配置文件到/etc/目录 cp redis.conf /etc/ #daemonize配置该为yes vi /etc/redis.conf #切换到/usr/local/bin目录,启动Redis cd /usr/local/bin ./redis-server /etc/redis.conf #检查redis启动情况 ps -ef | grep redis #启动命令写入开机启动项 echo "/usr/local/bin/redis-server /etc/redis.conf" >>/etc/rc.local
修改redis.conf如图
#修改配置密码,去注释 find / -name redis.conf vi /etc/redis.conf #修改为(根据个人需求修改密码,此为实验测试环境) requirepass 111111
#尝试用密码登录并执行具体命令 redis-cli -h 127.0.0.1 -p 6379 -a 111111 127.0.0.1:6379> keys * (empty list or set) 127.0.0.1:6379> select 1 OK 127.0.0.1:6379[1]> config get requirepass 1) "requirepass" 2) "" 127.0.0.1:6379[1]> find / -name redis.conf
#安装net-tools yum -y install net-tools
#查看所有6379端口使用情况 netstat -ntulp |grep 6379 netstat -ntulp |grep redis
#创建 redis 命令软链接 ln -s /usr/local/redis/bin/redis-cli /usr/bin/redis redis