文档课题:rhel 7.9安装redis-6.2.6.
操作系统:rhel 7.9 64位
redis安装包:redis-6.2.6.tar.gz
1、redis依赖包
说明:redis是基于C语言编写的,因此首先需要安装redis的gcc等依赖包.
[root@leo-redis626-a ~]# mkdir /etc/yum.repos.d/bak
[root@leo-redis626-a ~]# mv /etc/yum.repos.d/*.repo /etc/yum.repos.d/bak
[root@leo-redis626-a ~]# mount /dev/sr0 /mnt
[root@leo-redis626-a ~]# cat <<EOF>>/etc/yum.repos.d/rhel7.repo
[rhel7]
name=rhel7
baseurl=file:///mnt
enable=1
gpgcheck=0
EOF
[root@leo-redis626-a yum.repos.d]# yum makecache
[root@leo-redis626-a yum.repos.d]# yum -y install gcc tcl
……
Installed:
gcc.x86_64 0:4.8.5-44.el7 tcl.x86_64 1:8.5.13-8.el7
Dependency Installed:
cpp.x86_64 0:4.8.5-44.el7 glibc-devel.x86_64 0:2.17-317.el7 glibc-headers.x86_64 0:2.17-317.el7 kernel-headers.x86_64 0:3.10.0-1160.el7
Complete!
2、安装包处理
--上传安装包.
将安装包redis-6.2.6.tar.gz上传到/usr/local/src目录.
sftp> cd /usr/local/src
sftp> lcd F:\installmedium\redis
sftp> put redis-6.2.6.tar.gz
--解压安装包.
[root@leo-redis626-a yum.repos.d]# cd /usr/local/src
[root@leo-redis626-a src]# tar -zxf redis-6.2.6.tar.gz
3、安装redis
--编译以及安装redis
[root@leo-redis626-a src]# cd redis-6.2.6
[root@leo-redis626-a redis-6.2.6]# make && make install
……
Hint: It's a good idea to run 'make test' ;)
make[1]: Leaving directory `/usr/local/src/redis-6.2.6/src'
cd src && make install
make[1]: Entering directory `/usr/local/src/redis-6.2.6/src'
CC Makefile.dep
make[1]: Leaving directory `/usr/local/src/redis-6.2.6/src'
make[1]: Entering directory `/usr/local/src/redis-6.2.6/src'
Hint: It's a good idea to run 'make test' ;)
INSTALL redis-server
INSTALL redis-benchmark
INSTALL redis-cli
make[1]: Leaving directory `/usr/local/src/redis-6.2.6/src'
说明:该目录默认配置到环境变量,因此可以在任意目录下运行如下命令:
Redis-cli:redis提供的命令客户端
Redis-server:redis的服务端启动脚本
Redis-sentinel:redis的哨兵启动脚本
4、测试验证
[root@leo-redis626-a redis-6.2.6]# redis-server
说明:出现如下结果表明redis安装成功.
56317:C 02 Apr 2023 23:13:12.679 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
56317:C 02 Apr 2023 23:13:12.679 # Redis version=6.2.6, bits=64, commit=00000000, modified=0, pid=56317, just started
56317:C 02 Apr 2023 23:13:12.679 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
56317:M 02 Apr 2023 23:13:12.681 * Increased maximum number of open files to 10032 (it was originally set to 1024).
56317:M 02 Apr 2023 23:13:12.681 * monotonic clock: POSIX clock_gettime
_._
_.-``__ ''-._
_.-`` `. `_. ''-._ Redis 6.2.6 (00000000/0) 64 bit
.-`` .-```. ```\/ _.,_ ''-._
( ' , .-` | `, ) Running in standalone mode
|`-._`-...-` __...-.``-._|'` _.-'| Port: 6379
| `-._ `._ / _.-' | PID: 56317
`-._ `-._ `-./ _.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' | https://redis.io
`-._ `-._`-.__.-'_.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' |
`-._ `-._`-.__.-'_.-' _.-'
`-._ `-.__.-' _.-'
`-._ _.-'
`-.__.-'
56317:M 02 Apr 2023 23:13:12.682 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
56317:M 02 Apr 2023 23:13:12.682 # Server initialized
56317:M 02 Apr 2023 23:13:12.682 # 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.
56317:M 02 Apr 2023 23:13:12.682 * Ready to accept connections
--查看redis进程.
[root@leo-redis626-a ~]# ps -ef|grep redis
avahi 870 1 0 20:18 ? 00:00:00 avahi-daemon: running [leo-redis626-a.local]
root 56340 2484 0 23:14 pts/1 00:00:00 redis-server *:6379
root 56385 56345 0 23:14 pts/0 00:00:00 grep --color=auto redis
[root@leo-redis626-a ~]# redis-cli
127.0.0.1:6379> set foo bar
OK
127.0.0.1:6379> get foo
"bar"
说明:如上所示,redis-6.2.6安装完毕.
参考网址:https://blog.csdn.net/abc123mma/article/details/127431458