安装Redis 6.2.0
wget http://download.redis.io/releases/redis-6.2.0.tar.gz
yum -y install gcc automake autoconf libtool make
tar -xzvf redis-6.2.0.tar.gz && redis-6.2.0.tar.gz
cd redis-6.2.0
make
cd src
make install PREFIX=/usr/local/redis
若出现zmalloc.h:50:31: 致命错误:jemalloc/jemalloc.h:没有那个文件或目录,则运行命令
make MALLOC=libc
cd ../
mkdir /etc/redis
mv redis.conf /etc/redis/
vim /etc/redis/redis.conf
//将daemonize no改成daemonize yes,输入行数+gg可以快捷跳行。例如跳到第138行,输入:138gg
//注释第70行bind
//第90行protected-mode改为no
//取消第502行注释并修改密码
将Redis加入到开机启动
cat >> /etc/rc.local <<EOF
/usr/local/redis/bin/redis-server /etc/redis.conf
EOF
开启Redis
/usr/local/redis/bin/redis-server /etc/redis/redis.conf
cat >> /etc/profile <<EOF
export PATH=/usr/local/redis/bin:$PATH
EOF
source /etc/profile
常用命令
redis-server /etc/redis.conf //启动Redis
pkill redis //停止Redis
重启Redis:
#首先查询到Redis的pid后,kill掉,然后重启
[root@localhost bin]# ps -elf | grep -v grep | grep redis
root 20940 1 0 12:12 ? 00:00:18 ./redis-server *:6379
[root@localhost bin]# kill 20940
[root@localhost bin]# redis-server redis.conf
采用Redis Desktop Manager远程连接Redis服务器
卸载Redis:
rm -rf /usr/local/redis //删除安装目录
rm -rf /usr/bin/redis-* //删除所有Redis相关命令脚本
rm -rf /root/download/redis-6.2.0 //删除Redis解压文件夹
以上就是怎么用CentOS 7.5源码包部署安装Redis 6.2.0的详细内容,更多请关注php中文网其它相关文章!