1.下载安装包到opt(附加软件包)目录下
wget http://download.redis.io/releases/redis-4.0.8.tar.gz
2.解压
tar -zxvf edis-4.0.8.tar.gz
3.编译文件
cd /opt/redis-4.0.8
make
如果报错:zmalloc.h:50:31: 致命错误:jemalloc/jemalloc.h
执行
make MALLOC=libc
4.安装
cd /opt/redis-4.0.8/src
make install
5.启动
redis-server
要想后台启动,修改redis.conf文件
vim redis.conf
# 默认为no
daemonize yes
redis-server /opt/redis-4.0.8/redis.conf
6.测试连接
telnet 192.168.8.128 9092
访问失败
原因端口未对外开放
7.开启对外访问端口
firewall-cmd --zone=public --add-port=9092/tcp --permanent
提示 FirewallD is not running
检查防火墙状态
systemctl status firewalld
firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
Active: inactive (dead) since 三 2020-04-22 15:50:46 CST; 3min 29s ago
Docs: man:firewalld(1)
Process: 808 ExecStart=/usr/sbin/firewalld --nofork --nopid $FIREWALLD_ARGS (code=exited, status=0/SUCCESS)
Main PID: 808 (code=exited, status=0/SUCCESS)
开启防火墙
systemctl start firewalld
再次开启
[root@bogon ~]# firewall-cmd --zone=public --add-port=9092/tcp --permanent
success
[root@bogon ~]# firewall-cmd --reload
success
[root@bogon ~]# firewall-cmd --query-port=9092/tcp
yes
8.访问成功