linux安裝redis 完整步驟
安裝:linux
1.獲取redis資源redis
wget http://download.redis.io/releases/redis-4.0.8.tar.gz
ide
2.解壓code
tar xzvf redis-4.0.8.tar.gz
server
3.安裝資源
cd redis-4.0.8 make cd src make install PREFIX=/usr/local/redis
4.移動配置文件到安裝目錄下get
cd ../ mkdir /usr/local/redis/etc mv redis.conf /usr/local/redis/etc
5.配置redis爲後臺啓動it
vi /usr/local/redis/etc/redis.conf //將daemonize no 改爲daemonize yes
io
6.將redis加入到開機啓動class
vi /etc/rc.local //在裏面添加內容:/usr/local/redis/bin/redis-server /usr/local/redis /etc/redis.conf (意思就是開機調用這段開啓redis的命令)
7.開啓redis
/usr/local/redis/bin/redis-server /usr/local/redis/etc/redis.conf
8.創建軟鏈接redis命令
ln -s /usr/local/redis/bin/redis-server /usr/bin/ ln -s /usr/local/redis/bin/redis-cli /usr/bin/
經常使用命令
redis-server /usr/local/redis/etc/redis.conf //啓動redis pkill redis //中止redis
卸載redis:
rm -rf /usr/local/redis //刪除安裝目錄 rm -rf /usr/bin/redis-* //刪除全部redis相關命令腳本 rm -rf /root/download/redis-4.0.4 //刪除redis解壓文件夾