redis 安装与安装中遇到的错误
redis 安装
wget http://download.redis.io/releases/redis-4.0.11.tar.gz tar xzf redis-4.0.11.tar.gz cd redis-4.0.11 make
启动服务端
src/redis-server
客户端连接与测试
src/redis-cli redis> set foo bar OK redis> get foo "bar"
安装中遇到的错误
错误1 gcc 编译器没有安装
解决办法 : 安装gcc 编译器
yum install gcc -y
错误2 jemalloc/jemalloc.h: No such file or directory。
针对这个错误,我们可以在README.md 文件中看到解释。
--------- 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 MALLOC=libc To compile against jemalloc on Mac OS X systems, use: % make MALLOC=jemalloc Verbose build -------------
上文的意思就是如果在linux 系统下,那么我们需要使用 libc malloc 进行编译,如果我们是 Mac OS X 系统的话,那么我们需要使用 jemalloc malloc 进行编译。
所以解决这个问题的方法就是指定我们的编译寄存器。
centos
make MALLOC=libc
以上就是我在安装的时候遇到的问题,后续如果还有其他会继续补充。