1.打開終端ctrl+alt+t
2.輸入命令sudo apt-get update
3.輸入命令sudo apt-get install redis-server
4.下載完成后,啟動redis,輸入redis-server
我們會發(fā)現出現許多警告,不要急,一個一個解決.
1)The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
2)WARNING overcommit_memory is set to 0! Background save may fail under low memory condition.
這兩個錯誤,可以同時解決
進入etc目錄,打開sysctl.conf文件
cd etc
sudo gedit sysctl.conf
進入文件,加入net.core.somaxconn= 1024 ?和 vm.overcommit_memory=1 保存
3)WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis.
第三個警告,在rc.local文件,在加一句echo never > /sys/kernel/mm/transparent_hugepage/enabled ? ?保存(命令:cd etc ? ? sudo gedit rc.local )
4)最后重啟(命令: reboot)
5.重啟之后,啟動redis(命令: redis-server)
先前的警告就消失.
6.連接一下redis服務器,并測試一下.