赞
踩
生产环境或内网环境,无法联网的情况下安装redis
官网下载redis安装包
下载地址:redis离线安装包下载地址
使用工具 Xftp 上传文件到服务器 /root 目录
[root@localhost ~]# mkdir /usr/local/redis
[root@localhost ~]# tar zxvf /root/redis-6.2.7.tar.gz -C /usr/local/redis/
如下所示表示没有安装,需要安装gcc编译器
[root@localhost redis-6.2.7]# gcc -v
-bash: gcc: 未找到命令
安装教程:gcc编译器安装教程
输入下述命令,耐心等待编译完成…
会在 /usr/local/redis/redis-6.2.7/ 目录生成编译后的文件
[root@localhost gcc]# cd /usr/local/redis/redis-6.2.7/
[root@localhost redis-6.2.7]# make
cd src && make all
make[1]: 进入目录“/usr/local/redis/redis-6.2.7/src”
CC Makefile.dep
.........
CC redis-benchmark.o
LINK redis-benchmark
INSTALL redis-check-rdb
INSTALL redis-check-aof
Hint: It's a good idea to run 'make test' ;)
make[1]: 离开目录“/usr/local/redis/redis-6.2.7/src”
安装目录 /usr/local/redis/redis-6.2.7/
[root@localhost redis-6.2.7]# make install PREFIX=/usr/local/redis/redis-6.2.7/
cd src && make install
make[1]: 进入目录“/usr/local/redis/redis-6.2.7/src”
Hint: It's a good idea to run 'make test' ;)
INSTALL redis-server
INSTALL redis-benchmark
INSTALL redis-cli
make[1]: 离开目录“/usr/local/redis/redis-6.2.7/src”
修改 redis.conf 配置文件,以设置服务可以后台运行
[root@localhost redis-6.2.7]# vi /usr/local/redis/redis-6.2.7/redis.conf
将 daemonize no 修改为 daemonize yes
[root@localhost redis-6.2.7]# cd /usr/local/redis/redis-6.2.7/
[root@localhost redis-6.2.7]# ./bin/redis-server redis.conf
[root@localhost bin]# ps -ef|grep redis
root 6325 1 0 23:29 ? 00:00:00 ./redis-server 127.0.0.1:6379
root 6332 1794 0 23:29 pts/0 00:00:00 grep --color=auto redis
[root@localhost bin]# cd /usr/local/redis/redis-6.2.7/bin/
[root@localhost bin]# ./redis-cli -h 127.0.0.1 -p 6379
127.0.0.1:6379> set count 1
OK
127.0.0.1:6379> get count
"1"
127.0.0.1:6379> QUIT
至此,单节点安装操作已全部完成,谢谢!!!
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。