Centos7 Redis安装教程
-
查看是否安装wget工具,没有执行下面命令安装:
yum install wget
-
创建application文件夹,并使用wget下载redis源码包
cd ~ mkdir application cd application wget http://download.redis.io/releases/redis-5.0.5.tar.gz
-
解压redis源码包
tar xf redis-5.0.5.tar.gz
-
安装gcc
yum install gcc
-
编译&打包
make make install PREFIX=/opt/jackmouse/redis5 # 指定安装目录
-
常见错误:
-
致命错误:jemalloc/jemalloc.h:没有那个文件或目录。
make后加上MALLOC=libc
关于分配器allocator, 如果有MALLOC 这个环境变量,会有用这个环境变量的 去建立Redis。而且libc 并不是默认 的分配器,默认的是 jemalloc, 因为jemalloc被证明比libc有更少的fragmentation problems。但是如果你又没有jemalloc 而只有libc 当然 make 出错。 所以加这么一个参数。
make MALLOC=libc
-
-
-
配置全局变量
vi /etc/profile # 加入下面内容 export REDIS_HOME=/opt/jackmouse/redis5 export PATH=$PATH:$REDIS_HOME/bin # 刷新配置文件 source /etc/profile
-
测试
命令行输入redis-server,redis正常启动
-
install_server使用
cd ~/application/redis-5.0.5/utils/ ./install_server.sh Please select the redis port for this instance: [6379] #redis端口 Selecting default: 6379 Please select the redis config file name [/etc/redis/6379.conf] #redis配置文件 Selected default - /etc/redis/6379.conf Please select the redis log file name [/var/log/redis_6379.log] #redis日志文件 Selected default - /var/log/redis_6379.log Please select the data directory for this instance [/var/lib/redis/6379] #redis数据文件 Selected default - /var/lib/redis/6379 Please select the redis executable path [/opt/jackmouse/redis5/bin/redis-server] #redis可执行程序的路径
-
查看redis运行状态
ps -fe | grep redis