menu Chancel's Blog
rss_feed lightbulb_outline

Cent7OS安装Redis

类型:Software
创建时间:2021-11-18 11:04:52
更新时间:2021-11-18 11:09:12
类型:Software
更新时间:2021-11-18 11:09:12

Cent7OS仓库中不包含Redis,我们需要从官网下载并编译安装

安装步骤如下

  1. 选择下载stable版本到/tmp/redis目录下
  2. 解压至/tmp/redis目录下编译执行
  3. 安装到/usr/local/redis目录下
  4. 复制/tmp/redis/redis6.2.6/redis.conf文件至安装目录/usr/local/redis/bin/下
  5. 修改/usr/local/redis/redis.conf文件,让redis以守护进程(后台进程)运行
  6. 运行redis即可

目录结构

  • 下载目录:/tmp/redis
  • 解压后redis源文件:/tmp/redis/redis6.2.6
  • 安装目录:/usr/local/redis

下面是安装过程

编译安装如下

sudo yum install gcc 
mkdir /tmp/redis
cd /tmp/redis
wget https://download.redis.io/releases/redis-6.2.6.tar.gz
tar -zxvf redis-6.2.6.tar.gz
cd /tmp/redis/redis-6.2.6
make MALLOC=libc 
make install PREFIX=/usr/local/redis

复制conf文件

cp /tmp/redis-6.2.6/redis.conf /usr/local/redis/bin/

编辑conf文件并修改 daemonizerequirepass两个参数(后台运行和连接密码)

vim /usr/local/redis/bin/redis.conf
# Redis configuration file example.
#
# Note that in order to read the configuration file, Redis must be
# started with the file path as first argument:
...
daemonize yes
...
requirepass your_passwd

直接运行即可

/usr/local/redis/bin/redis-server /usr/local/redis/bin/redis.conf

[[replyMessage== null?"发表评论":"@" + replyMessage.m_author]]

account_circle
email
web_asset
textsms

评论列表([[messageList.data.items.length]])

[[messageItem.m_author]] [[messageItem.m_author]]
[[messageItem.create_time]]
[[messageItem.m_environ.browser]] [[messageItem.m_environ.os]] [[messageItem.m_environ.device]]
[[subMessage.m_author]] [[subMessage.m_author]] @ [[subMessage.parent_message.m_author]] [[subMessage.parent_message.m_author]]
[[subMessage.create_time]]
[[subMessage.m_environ.browser]] [[subMessage.m_environ.os]] [[subMessage.m_environ.device]]