menu Chancel's blog
rss_feed
Chancel's blog
我就是这样的人

Cent7OS安装Redis

作者:Chancel, 时间:2021 Nov 18, 阅读:70

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

  • 官网下载地址:https://redis.io/download

安装步骤如下

  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

评论列表([[messageResponse.total]])

还没有可以显示的留言...
[[messageItem.m_author]] [[messageItem.m_author]]
[[messageItem.create_time]]
[[getEnviron(messageItem.m_environ)]]
[[subMessage.m_author]] [[subMessage.m_author]] @ [[subMessage.parent_message.m_author]] [[subMessage.parent_message.m_author]]
[[subMessage.create_time]]
[[getEnviron(messageItem.m_environ)]]