赞
踩
本章使用的是centos9进行部署
Index of /releases/ (redis.io)https://download.redis.io/releases/这个网站有历史的版本,我这里使用的是最新版7.2.4进行安装
点击即可进行下载
方进Linux中,如果你的Linux中可以直接使用wget去下载
放进来以后先去安装所需环境
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
这里都使用默认的,如果你自己有需要变动的根据他的提示变化就行
- 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就行
输入red然后按键盘上的“tab”键两下
有关于redis的命令提示
再去测试登录
redis-cli
这样就行
或者另外一种
redis-cli -h redis服务器ip -p 6379
redis-cli -h 192.168.6.22 -p 6379
这样就可以了
如果想了解更多你可以去官方文档寻找
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。