欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

centos7安装redis

程序员文章站 2022-05-31 11:15:14
...

官方教程:https://redis.io/download

-

1. 整个安装过程如下:

1)下载程序并编译:

$ wget http://download.redis.io/releases/redis-5.0.2.tar.gz
$ tar xzf redis-5.0.2.tar.gz
$ cd redis-5.0.2
$ make

2)编译成功后,执行安装程序:

make PREFIX=/usr/local/redis install

这个目录/usr/local/redis 友安装程序自动创建 不用手动去创建 PREFIX必须大写

3)启动服务:

src/redis-server

4)测试是否安装成功:

src/redis-cli

redis> set foo bar

OK

redis> get foo

"bar"

-

终端过程,先cd到redis-5.0.2:

[[email protected] redis-5.0.2]# make PREFIX=/usr/local/redis install
cd src && make install
make[1]: Entering directory `/root/redis-5.0.2/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 `/root/redis-5.0.2/src'
[[email protected] redis-5.0.2]# redis-server
-bash: redis-server: 未找到命令
[[email protected] redis-5.0.2]# src/redis-server
6509:C 23 Nov 2018 11:24:57.022 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
6509:C 23 Nov 2018 11:24:57.023 # Redis version=5.0.2, bits=64, commit=00000000, modified=0, pid=6509, just started
6509:C 23 Nov 2018 11:24:57.023 # Warning: no config file specified, using the default config. In order to specify a config file use src/redis-server /path/to/redis.conf
6509:M 23 Nov 2018 11:24:57.025 # Creating Server TCP listening socket *:6379: bind: Address already in use
[[email protected] redis-5.0.2]# src/redis-server
6510:C 23 Nov 2018 11:25:14.127 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
6510:C 23 Nov 2018 11:25:14.127 # Redis version=5.0.2, bits=64, commit=00000000, modified=0, pid=6510, just started
6510:C 23 Nov 2018 11:25:14.127 # Warning: no config file specified, using the default config. In order to specify a config file use src/redis-server /path/to/redis.conf
6510:M 23 Nov 2018 11:25:14.127 # Creating Server TCP listening socket *:6379: bind: Address already in use
[[email protected] redis-5.0.2]# src/redis-cli
127.0.0.1:6379> set foo bar
OK
127.0.0.1:6379> get foo
"bar"
127.0.0.1:6379>

-

2. 配置redis参考:我的《laravel配置redis。ThinkPHP5配置redis。》https://blog.csdn.net/weixin_41827162/article/details/84335918