reids以make编译方式安装所遇到的问题及解决办法(Ubuntu环境下)

关于redis在ubuntu下的安装见http://www.redis.cn/download.html

在安装redis之前务必先执行以下命令

sudo apt-get update

在这期间可能会出现些问题:如果在编译的时候报错,则需要先安装make

sudo apt-get install make

 

如果出现以下的错误

cd src && make all
make[1]: Entering directory '/home/ubuntu/redis-4.0.11/src'
    CC adlist.o
/bin/sh: 1: cc: not found
Makefile:228: recipe for target 'adlist.o' failed
make[1]: *** [adlist.o] Error 127
make[1]: Leaving directory '/home/ubuntu/redis-4.0.11/src'
Makefile:6: recipe for target 'all' failed
make: *** [all] Error 2

则可以安装 gcc

sudo apt-get install gcc

如果报错如下所示

cd src && make all
make[1]: Entering directory '/home/ubuntu/redis-4.0.11/src'
    CC adlist.o
In file included from adlist.c:34:0:
zmalloc.h:50:10: fatal error: jemalloc/jemalloc.h: No such file or directory
 #include <jemalloc/jemalloc.h>
          ^~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Makefile:228: recipe for target 'adlist.o' failed
make[1]: *** [adlist.o] Error 1
make[1]: Leaving directory '/home/ubuntu/redis-4.0.11/src'

则可以通过

make MALLOC=libc

来替代make命令,即可编译成功

详情见https://blog.csdn.net/libraryhu/article/details/64920124

  • 0
    点赞
  • 28
    收藏
    觉得还不错? 一键收藏
  • 5
    评论
Ubuntu 16.04上安装Redis有两种方式:apt和编译方式。 第一种方式是使用apt安装Redis。首先,打开终端并更新软件包列表,运行命令“sudo apt update”。然后,安装Redis,运行命令“sudo apt install redis-server”。 在安装完成后,Redis将自动启动,并且将在系统启动时自动运行。可以使用“sudo systemctl status redis-server”命令来检查Redis的运行状态。此外,可以使用“sudo systemctl stop redis-server”和“sudo systemctl start redis-server”命令来停止和启动Redis。 第二种方式是通过编译方式安装Redis。首先,从Redis官方网站下载最新的稳定版本压缩包(例如redis-stable.tar.gz)。然后在终端中切换到下载的目录并解压文件,运行命令“tar xzf redis-stable.tar.gz”。 接下来,进入解压后的Redis目录,运行命令“cd redis-stable”。然后,使用“make”命令来编译Redis编译完成后,运行命令“make test”来进行测试以确保Redis正常工作。 最后,可以使用“sudo make install”命令来安装Redis安装完成后,可以使用“redis-server”命令启动Redis服务器,并使用“redis-cli”命令连接到Redis并执行各种操作。 无论使用apt还是编译方式安装Redis,都可以通过在终端中运行“redis-cli ping”命令来测试Redis是否正常运行。如果返回“PONG”则表示Redis已成功安装和启动。 总之,这两种方式都可以在Ubuntu 16.04上成功安装Redis,选择哪种方式取决于个人偏好和具体需求。
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值