Note : The previous installation articles have already explained the system environment and resource details, so I will not go into details here. The download resources are as follows:
Link: https://pan.baidu.com/s/1rWYvUQEUqVlxR4g_jryfvg Extraction code: f8ji
You can also download it from the official website:
Redis installation package download: https://download.redis.io/releases/redis-6.2.5.tar.gz
1. Start installation
--上传文件到指定文件夹之后,解压:
# tar xzf redis-6.2.5.tar.gz
--进入到解压文件的文件执行make命令
# cd redis-6.2.5
# make
# make install
2. Move files to the specified folder
-- 在 /usr/local 文件夹下创建 redis-6.2.5文件夹
# mkdir redis-6.2.5
-- 在 redis-6.2.5 文件下创建 bin 和 etc 两个目录
# mkdir bin
# mkdir etc
-- 从redis的原文件夹下移动文件
# mv redis.conf /usr/local/redis/etc/
# mv mkreleasehdr.sh redis-benchmark redis-check-aof redis-check-rdb redis-cli redis-server /usr/local/redis/bin/
3. Configure the redis.conf file
-- 常用配置:
# bind 127.0.0.1 -::1 【IP配置,可默认、根据需要来】
# protected-mode no 【默认为yes、设置为no、外网可直接访问】
# daemonize yes 【yes设置为后台启动】
# logfile "/usr/local/redis-6.2.5/logger” 【日志的打印位置】
4. Start the redis.server service
-- 在/usr/local/redis-6.2.5/bin 目录下:
# ./redis-server ../etc/redis.conf
5. Start the redis-cil client
[root@VM-16-15-centos /]# cd /usr/local/redis-6.2.5/bin/
[root@VM-16-15-centos bin]# ls
dump.rdb mkreleasehdr.sh redis-benchmark redis-check-aof redis-check-rdb redis-cli redis-server
[root@VM-16-15-centos bin]# ./redis-cli
127.0.0.1:6379> set testName zhangSan
(error) NOAUTH Authentication required.
--【这个错误的因为,是因为配置文件中设置了密码,输入设置的密码】
127.0.0.1:6379> auth “myPassword"
OK
127.0.0.1:6379> set testName zhangSan
OK
127.0.0.1:6379> get testName
"zhangSan"
127.0.0.1:6379>