东莞做企业网站,wordpress 打断点,网站做镜像的有什么用,电子商务论文3000字本文主要介绍如果在Centos7下安装Redis。
1.安装依赖
redis是由C语言开发#xff0c;因此安装之前必须要确保服务器已经安装了gcc#xff0c;可以通过如下命令查看机器是否安装#xff1a;
gcc -v如果没有安装则通过以下命令安装#xff1a;
yum install -y gcc2.下载r…本文主要介绍如果在Centos7下安装Redis。
1.安装依赖
redis是由C语言开发因此安装之前必须要确保服务器已经安装了gcc可以通过如下命令查看机器是否安装
gcc -v如果没有安装则通过以下命令安装
yum install -y gcc2.下载redis安装包并解压
# 下载我是在root下执行的下载所以我的下载目录为/root/redis-6.2.8这里按照自己的实际情况调整
curl -O https://download.redis.io/releases/redis-6.2.8.tar.gz# 解压
tar -zxvf redis-6.2.8.tar.gz3.进入解压目录并编译
1. 进入解压目录
# 进入解压目录
cd redis-6.2.82. 编译
# 编译
make报错
make[1]: Entering directory /opt/redis_cluster/redis-3.2.9/src CC adlist.o In file included from adlist.c:34:0: zmalloc.h:50:31: fatal error: jemalloc/jemalloc.h: No such file or directory #include jemalloc/jemalloc.h ^ compilation terminated. make[1]: *** [adlist.o] Error 1 make[1]: Leaving directory/opt/redis_cluster/redis-3.2.9/src’
make: *** [all] Error 2解决方法
试错一
以为是没安装完全gcc
yum install gcc gcc-c -y 但是再编译也还是一样的问题
试错二
make MALLOClibc原因分析
在README 有这个一段话。
Allocator
———Selecting a non-default memory allocator when building Redis is done by setting
the MALLOC environment variable. Redis is compiled and linked against libc
malloc by default, with the exception of jemalloc being the default on Linux
systems. This default was picked because jemalloc has proven to have fewer
fragmentation problems than libc malloc.To force compiling against libc malloc, use:% make MALLOClibcTo compile against jemalloc on Mac OS X systems, use:% make MALLOCjemalloc说关于分配器allocator 如果有MALLOC 这个 环境变量 会有用这个环境变量的 去建立Redis。
而且libc 并不是默认的 分配器 默认的是 jemalloc, 因为 jemalloc 被证明 有更少的 fragmentation problems 比libc。
但是如果你又没有jemalloc 而只有 libc 当然 make 出错。 所以加这么一个参数
3. 安装
make install4yuk
编译redis的时候出现zmalloc.h:50:31: fatal error: jemalloc/jemalloc.h: No such file or directory问题的解决办法
有谁看见我的剑了
redis编译报错zmalloc.h:50:31: fatal error: jemalloc/jemalloc.h: No such file or directory
Chopin
Centos7 安装Redis详细教程
扶摇知风意
Centos7安装Redis