Linux:Redis7.2.4的源码包部署(2)

本章使用的是centos****9进行部署


1.获取rpm安装包

Index of /releases/ (redis.io)https://download.redis.io/releases/这个网站有历史的版本,我这里使用的是最新版7.2.4进行安装

点击即可进行下载

方进Linux中,如果你的Linux中可以直接使用wget去下载


2.安装

放进来以后先去安装所需环境

复制代码
yum -y install gcc* chkconfig

再去解redis的包

复制代码
tar xfvz redis-7.2.4.tar.gz -C /usr/local/

前往redis解压包的位置进行编译安装

复制代码
cd /usr/local/redis-7.2.4/

编译安装

复制代码
make

make install

进去utils/目录编辑一下安装脚本

复制代码
cd utils/

编辑脚本

复制代码
vim install_server.sh


将下面这些前面加上注释#

#bail if this system is managed by systemd
_pid_1_exe="$(readlink -f /proc/1/exe)"
if [ "${_pid_1_exe##*/}" = systemd ]
then
        echo "This systems seems to use systemd."
        echo "Please take a look at the provided example service unit files in this directory, and adapt and install them. Sorry!"
        exit 1
fi


改为

#bail if this system is managed by systemd
#_pid_1_exe="$(readlink -f /proc/1/exe)"
#if [ "${_pid_1_exe##*/}" = systemd ]
#then
#       echo "This systems seems to use systemd."
#       echo "Please take a look at the provided example service unit files in this directory, and adapt and install them. Sorry!"
#       exit 1
#fi

改完以后:wq保存退出

再去执行一下脚本就可以进行安装了

复制代码
./install_server.sh

这里都使用默认的,如果你自己有需要变动的根据他的提示变化就行


3.修改配置文件

复制代码
vim /etc/redis/6379.conf

# 第88行
bind 127.0.0.1 -::1
# 改为
bind 0.0.0.0
# 允许任何地址连接



# 第112行
protected-mode yes
# 改为
protected-mode no
#安全性降低

这样修改完以后就可以开启服务了

先关闭一下,让他重新加载一下配置

复制代码
/etc/init.d/redis_6379 stop

开启服务

复制代码
/etc/init.d/redis_6379 start

查看一下端口号

复制代码
netstat -anpt | grep 6379

只要可以看到6379就行


4.登录测试

输入red然后按键盘上的"tab"键两下

有关于redis的命令提示

再去测试登录

复制代码
redis-cli

这样就行

或者另外一种

redis-cli -h redis服务器ip -p 6379

复制代码
redis-cli -h 192.168.6.22 -p 6379

这样就可以了

如果想了解更多你可以去官方文档寻找

Redis - The Real-time Data Platformhttps://redis.io/

相关推荐
是店小二呀6 分钟前
鸿蒙PC_Dart-Sass-ohos适配全记录
linux·运维·windows
智能运维指南6 小时前
代码管理软件如何融入 DevOps 工具链?全链路联通的 5 个关键点
运维·devops·信创适配·嘉为蓝鲸
充电zcx7 小时前
Linux:4:开发工具详解
linux·运维·服务器
gongfeng300010 小时前
福州企业级AI自动化获客解决方案品牌梳理与适用场景分析
运维·人工智能·自动化·g-claw ai员工
码农客栈11 小时前
linux 交叉编译tslib
linux
鱼月半11 小时前
两台电脑直连网络不通怎么办?
linux·网络协议
光电笑映12 小时前
网络通信基础:从协议分层到 Socket 编程预备
linux·运维·服务器·网络
酸菜。12 小时前
dw_apb_gpio总结
linux
wunaiqiezixin12 小时前
MIT 6.S081 file system 实验篇(lab9):Large files (moderate)
linux·unix·os·xv6·mit6.s081
GeW13 小时前
RHCE 考试通过率提升:核心考点、实验环境与排错技巧
linux