10分钟快速安装Redis

  • A+
所属分类:安全博客

获取redis资源

wget http://download.redis.io/releases/redis-4.0.8.tar.gz

解压

tar xzvf redis-4.0.8.tar.gz

编译安装

  cd redis-4.0.8   make(有Error报错请执行make distclean清除上次编译残留,可执行多次)   cd src   make install PREFIX=/usr/local/redis(报错执行make distclean)

移动到/usr/

  cd ../   mkdir /usr/local/redis/etc   mv redis.conf /usr/local/redis/etc     cp src/redis-cli /usr/local/bin/  

后台启动配置

  vi /usr/local/redis/etc/redis.conf //将daemonize no 改成daemonize yes     #为了让非本机能访问,将redis.conf中的ip都注释掉 

开机启动

 vi /etc/rc.local   ##在里面添加内容:  /usr/local/redis/bin/redis-server     /usr/local/redis/etc/redis.conf (意思就是开机调用这段开启redis的命令)

启动redis

    /usr/local/redis/bin/redis-server /usr/local/redis/etc/redis.conf 

常用命令

    redis-server /usr/local/redis/etc/redis.conf //启动redis     redis-cli shutdown -a password//停止   pkill redis  //停止redis      卸载redis:     rm -rf /usr/local/redis //删除安装目录     rm -rf /usr/bin/redis-* //删除所有redis相关命令脚本     rm -rf /root/download/redis-4.0.4 //删除redis解压文件夹

一些设置

    redis-cli ##进入redis客户端     config set requirepass 123456 # 设置密码登录

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: