#安装依赖包
[root@centos7 ~]#yum -y install gcc jemalloc-devel make
下载redis包
[root@centos7 ~]#wget http://download.redis.io/releases/redis-6.2.4.tar.gz
解压redis
[root@centos7 ~]#tar xf redis-6.2.4.tar.gz
切换到redis目录
[root@centos7 ~]#cd redis-6.2.4/
指定redis安装目录
[root@centos7 ~]#make PREFIX=/apps/redis install
设置变量
[root@centos7 ~]#echo ‘PATH=/apps/redis/bin:$PATH’ > /etc/profile.d/redis.sh
[root@centos7 ~]#. /etc/profile.d/redis.sh
准备相关的目录和配置文件
[root@centos7 ~]#mkdir /apps/redis/{etc,log,data,run}
[root@Centos7 redis-6.2.4]# cp redis.conf /apps/redis/etc/
前台启动 redis
[root@centos7 ~]#redis-server /apps/redis/etc/redis.conf
创建redis用户
[root@centos7 ~]#useradd -r -s /sbin/nologin redis
设置目录权限
[root@centos7 ~]#chown -R redis.redis /apps/redis/
编辑 redis 服务启动文件
[Unit]
Description=Redis persiste
编译安装redis
最新推荐文章于 2024-07-24 23:58:15 发布