Linux环境源码安装Redis过程记录

服务器环境

操作系统:CentOS 7 2009版本 最小化安装

1、环境准备

安装python3,编译redis需要!yum install python3 -y
安装gcc,gcc-c++,编译redis需要!yum install gcc gcc-c++ -y

# 安装gcc、gcc-c++
[root@jumpserver redis-stable]# yum install gcc gcc-c++ -y
# 查看gcc版本
[root@jumpserver redis-stable]# gcc -v
使用内建 specs。
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/lto-wrapper
目标:x86_64-redhat-linux
配置为:../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-plugin --enable-initfini-array --disable-libgcj --with-isl=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/isl-install --with-cloog=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/cloog-install --enable-gnu-indirect-function --with-tune=generic --with-arch_32=x86-64 --build=x86_64-redhat-linux
线程模型:posix
gcc 版本 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC)
[root@jumpserver redis-stable]#

2、源码安装redis

以源码方式安装
Install Redis from Source

# 下载源文件(source files)
[root@jumpserver opt]# wget https://download.redis.io/redis-stable.tar.gz
--2022-12-01 15:06:03--  https://download.redis.io/redis-stable.tar.gz
正在解析主机 download.redis.io (download.redis.io)... 45.60.125.1
正在连接 download.redis.io (download.redis.io)|45.60.125.1|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:3047785 (2.9M) [application/octet-stream]
正在保存至: “redis-stable.tar.gz”

100%[======================================>] 3,047,785   6.59MB/s 用时 0.4s

2022-12-01 15:06:03 (6.59 MB/s) - 已保存 “redis-stable.tar.gz” [3047785/3047785])

[root@jumpserver opt]# tar -xzf redis-stable.tar.gz
[root@jumpserver opt]# cd redis-stable.tar.gz
# 注意,直接使用make编译,会出现“致命错误:jemalloc/jemalloc.h:没有那个文件或目录”的提示
# 经过查找资料:https://blog.csdn.net/small_love/article/details/114441912
# 解决方案,make时指定分配器为libc
[root@jumpserver opt]# make MALLOC=libc
# 省略编译过程……

# To install these binaries in /usr/local/bin, run:
# 默认安装在/usr/local/bin目录下
[root@jumpserver redis-stable]# make install
# 省略安装过程……

[root@jumpserver redis-stable]# cd /opt
[root@jumpserver opt]# mkdir redis
[root@jumpserver opt]# cp redis-stable/redis.conf redis/
# 修改配置文件,支持默认后台启动
# 修改daemonize的值为yes
# 修改bind为0.0.0.0
# 修改protected-modeo的值为no
# 设置requirepass的值为yourredispassword
[root@jumpserver opt]# vim redis/redis.conf

# 启动redis服务端,指定配置文件启动
[root@jumpserver opt]# cd /usr/local/bin/
[root@jumpserver bin]# redis-server /opt/redis/redis.conf
[root@jumpserver bin]#

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值