官网下载地址:Redis
离线安装包:redis-4.0.11.tar.gz
链接:https://pan.baidu.com/s/14P3G-E1XzIs7Cv1zzirPtQ
提取码:ahjj
安装步骤:
1、将下载下来的安装包上传至linux服务器,执行解压操作
[root@bogon software]# ls
mysql redis-4.0.11.tar.gz
[root@bogon software]# tar -zxvf redis-4.0.11.tar.gz
2、进入解压文件目录使用make对解压的Redis文件进行编译
[root@bogon software]# cd redis-4.0.11/
[root@bogon redis-4.0.11]# ll
total 312
-rw-rw-r--. 1 root root 164219 Aug 4 2018 00-RELEASENOTES
-rw-rw-r--. 1 root root 53 Aug 4 2018 BUGS
-rw-rw-r--. 1 root root 1815 Aug 4 2018 CONTRIBUTING
-rw-rw-r--. 1 root root 1487 Aug 4 2018 COPYING
drwxrwxr-x. 6 root root 4096 Aug 4 2018 deps
-rw-rw-r--. 1 root root 11 Aug 4 2018 INSTALL
-rw-rw-r--. 1 root root 151 Aug 4 2018 Makefile
-rw-rw-r--. 1 root root 4223 Aug 4 2018 MANIFESTO
-rw-rw-r--. 1 root root 20543 Aug 4 2018 README.md
-rw-rw-r--. 1 root root 58766 Aug 4 2018 redis.conf
-rwxrwxr-x. 1 root root 271 Aug 4 2018 runtest
-rwxrwxr-x. 1 root root 280 Aug 4 2018 runtest-cluster
-rwxrwxr-x. 1 root root 281 Aug 4 2018 runtest-sentinel
-rw-rw-r--. 1 root root 7921 Aug 4 2018 sentinel.conf
drwxrwxr-x. 3 root root 4096 Aug 4 2018 src
drwxrwxr-x. 10 root root 4096 Aug 4 2018 tests
drwxrwxr-x. 8 root root 4096 Aug 4 2018 utils
[root@bogon redis-4.0.11]# make
cd src && make all
make[1]: Entering directory `/nfs/software/redis-4.0.11/src'
CC Makefile.dep
make[1]: Leaving directory `/nfs/software/redis-4.0.11/src'
............
......
3、编译成功后,进入src文件夹,执行make install进行Redis安装
[root@bogon redis-4.0.11]# make install
cd src && make install
make[1]: Entering directory `/nfs/software/redis-4.0.11/src'
CC Makefile.dep
make[1]: Leaving directory `/nfs/software/redis-4.0.11/src'
make[1]: Entering directory `/nfs/software/redis-4.0.11/src'
Hint: It's a good idea to run 'make test' ;)
INSTALL install
INSTALL install
INSTALL install
INSTALL install
INSTALL install
make[1]: Leaving directory `/nfs/software/redis-4.0.11/src'
[root@bogon redis-4.0.11]#
4、安装完成,开始部署,为了方便管理,将Redis文件中的conf配置文件和常用命令移动到统一文件中
[root@bogon redis-4.0.11]# mkdir etc
[root@bogon redis-4.0.11]# mkdir bin
[root@bogon redis-4.0.11]# mv redis.conf /nfs/software/redis-4.0.11/etc/
[root@bogon redis-4.0.11]# cd src/
[root@bogon src]# mv mkreleasehdr.sh redis-benchmark redis-check-aof redis-check-rdb redis-cli redis-server /nfs/software/redis-4.0.11/bin/
[root@bogon src]#
5、到bin目录下执行redis-server 启动redis
[root@bogon bin]# ./redis-server
27880:C 17 Dec 15:26:34.854 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
27880:C 17 Dec 15:26:34.854 # Redis version=4.0.11, bits=64, commit=00000000, modified=0, pid=27880, just started
27880:C 17 Dec 15:26:34.854 # Warning: no config file specified, using the default config. In order to specify a config file use ./redis-server /path/to/redis.conf
27880:M 17 Dec 15:26:34.855 * Increased maximum number of open files to 10032 (it was originally set to 1024).
_._
_.-``__ ''-._
_.-`` `. `_. ''-._ Redis 4.0.11 (00000000/0) 64 bit
.-`` .-```. ```\/ _.,_ ''-._
( ' , .-` | `, ) Running in standalone mode
|`-._`-...-` __...-.``-._|'` _.-'| Port: 6379
| `-._ `._ / _.-' | PID: 27880
`-._ `-._ `-./ _.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' | http://redis.io
`-._ `-._`-.__.-'_.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' |
`-._ `-._`-.__.-'_.-' _.-'
`-._ `-.__.-' _.-'
`-._ _.-'
`-.__.-'
27880:M 17 Dec 15:26:34.857 # Server initialized
27880:M 17 Dec 15:26:34.857 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
27880:M 17 Dec 15:26:34.857 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
27880:M 17 Dec 15:26:34.857 * Ready to accept connections
6、设置后台启动redis
编辑配置文件vim /nfs/software/redis-4.0.11/etc/redis.conf
最后再次启动redis服务,并指定启动服务配置文件
[root@bogon redis-4.0.11]# cd bin/
[root@bogon bin]# ./redis-server /nfs/software/redis-4.0.11/etc/redis.conf #启动
1750:C 17 Dec 15:55:33.711 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
1750:C 17 Dec 15:55:33.711 # Redis version=4.0.11, bits=64, commit=00000000, modified=0, pid=1750, just started
1750:C 17 Dec 15:55:33.711 # Configuration loaded
[root@bogon bin]# ./redis-cli #进入命令行
127.0.0.1:6379> config get requirepass #获取密码
(error) NOAUTH Authentication required.
127.0.0.1:6379> auth Aa123456 #验证密码
OK
127.0.0.1:6379> config get requirepass #获取密码
1) "requirepass"
2) "Aa123456"
127.0.0.1:6379> exit
[root@bogon bin]#
配置后台运行成功。