惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

量子位
L
LINUX DO - 最新话题
TaoSecurity Blog
TaoSecurity Blog
S
Security Affairs
H
Hacker News: Front Page
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Hacker News: Ask HN
Hacker News: Ask HN
T
The Exploit Database - CXSecurity.com
P
Proofpoint News Feed
Google DeepMind News
Google DeepMind News
Schneier on Security
Schneier on Security
云风的 BLOG
云风的 BLOG
I
InfoQ
The Register - Security
The Register - Security
T
Tor Project blog
T
Threat Research - Cisco Blogs
Spread Privacy
Spread Privacy
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
The GitHub Blog
The GitHub Blog
MongoDB | Blog
MongoDB | Blog
Webroot Blog
Webroot Blog
Recent Announcements
Recent Announcements
Vercel News
Vercel News
F
Fortinet All Blogs
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
SecWiki News
SecWiki News
G
Google Developers Blog
N
Netflix TechBlog - Medium
U
Unit 42
Martin Fowler
Martin Fowler
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
O
OpenAI News
博客园 - 叶小钗
T
Tailwind CSS Blog
爱范儿
爱范儿
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Help Net Security
Help Net Security
A
About on SuperTechFans
Recorded Future
Recorded Future
Last Week in AI
Last Week in AI
Hugging Face - Blog
Hugging Face - Blog
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
D
DataBreaches.Net
D
Darknet – Hacking Tools, Hacker News & Cyber Security
T
The Blog of Author Tim Ferriss
PCI Perspectives
PCI Perspectives
F
Full Disclosure
美团技术团队
L
Lohrmann on Cybersecurity
H
Hackread – Cybersecurity News, Data Breaches, AI and More

博客园 - chan_炽烽

J4125 - OPNsense 配置 MGMT(管理口) J4125 - OPNsense 系统配置备份及恢复 J4125 - OPNsense 简单使用 J4125 安装 OPNsense 【VMware Workstation】Debian 13 安装 sing-box(Claaash配置转换sing-box配置) Radxa E20C 安装 飞牛 fnOS Radxa E20C 升级 LEDE(含编译过程) Radxa E20C 安装 LEDE(含编译过程) 【VMware Workstation】Debian 13 桌面版安装 docker-compose + macvlan + Elasticsearch - 9.1.4 + Kibana - 9.1.4 安装 elasticsearch-9.1.4的 IK分词器 安装 elasticsearch-9.1.4 - 集群 和 kibana-9.1.4 Radxa E20C 安装 OpenWrt 【VMware Workstation】Rocky Linux 10 桌面版安装 iStoreOS + 旁路由 + openClash - chan_炽烽 iStoreOS + 旁路由 【推荐 - 源码安装】nginx - 安装 fastDFS - 单机部署 + nginx MySQL - 安装时的安全配置 【推荐 - glibc安装】MySQL - 安装 【推荐 - rpm安装】MySQL - 安装 修复PG.conf文件出现的问题 [七月挑选]树莓派Raspberrypi上配置Git [七月挑选]IntelliJ IDEA常用设置
【推荐 - 源码安装】Redis - 安装
chan_炽烽 · 2024-10-15 · via 博客园 - chan_炽烽

准备

  1. 查看操作系统位数
[root@lab10 ~]# getconf LONG_BIT
64
  1. 查看gcc编译环境
[root@lab10 ~]# gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../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
Thread model: posix
gcc version 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC)

下载 Redis

访问页面:Index of /releases/

选择 redis-7.4.1.tar.gz 下载

下载链接如下:https://download.redis.io/releases/redis-7.4.1.tar.gz
文件全称:redis-7.4.1.tar.gz
文件md5:360809807C15DA120AFFB356E55C6388

创建 Redis 的源码目录

mkdir -p /opt/redis

上传 Redis

使用工具上传 Redis

或者

https://download.redis.io/releases/redis-7.4.1.tar.gz

进入 Redis 源码目录

cd /opt/redis

解压

tar -zxvf redis-7.4.1.tar.gz

进入目录并编译安装

  • 进入目录
cd /opt/redis/redis-7.4.1/
  • 编译安装
make && make install

查看默认的安装路径

[root@lab10 redis-7.4.1]# ll /usr/local/bin/
total 30080
-rwxr-xr-x. 1 root root  6819616 Oct 13 23:08 redis-benchmark
lrwxrwxrwx. 1 root root       12 Oct 13 23:08 redis-check-aof -> redis-server
lrwxrwxrwx. 1 root root       12 Oct 13 23:08 redis-check-rdb -> redis-server
-rwxr-xr-x. 1 root root  7801192 Oct 13 23:08 redis-cli
lrwxrwxrwx. 1 root root       12 Oct 13 23:08 redis-sentinel -> redis-server
-rwxr-xr-x. 1 root root 16176680 Oct 13 23:08 redis-server

创建 Redis 工作目录

mkdir -p /opt/core-redis-6379

拷贝并配置 redis.conf 配置文件

  • 拷贝配置文件
cp -a /opt/redis/redis-7.4.1/redis.conf /opt/core-redis-6379/
  • 配置 redis.conf 配置文件
vim /opt/core-redis-6379/redis.conf
  • 编写内容如下
# 在310行,将默认 daemonize no 改为 daemonize yes
daemonize yes
# 在112行,将默认 protected-mode yes 改为 protected-mode no
protected-mode no
# 在88行,将默认bind 127.0.0.1 -::1 注释
# bind 127.0.0.1 -::1
# 在1050行,将默认 requirepass foobared 改为 requirepass chanchifeng
requirepass chanchifeng

编写Redis systemd 服务脚本

vim /usr/lib/systemd/system/redis.service

内容如下

[Unit]
# 服务描述
Description=Redis Server Manager
# 服务类别
After=network.target

[Service]
# 后台运行的形式
Type=forking
# 服务命令
ExecStart=/bin/bash -c '/usr/local/bin/redis-server /opt/core-redis-6379/redis.conf'
ExecStop=/bin/bash -c '/usr/local/bin/redis-cli -a chanchifeng -p 6379 --no-auth-warning shutdown'
Restart=always
# 给服务分配独立的临时空间
PrivateTmp=true

[Install]
# 设置为多用户、系统运行级别为3
WantedBy=multi-user.target

重新加载 systemd 系统

systemctl daemon-reload

启动 Redis 并开机自动启动

systemctl enable --now redis

查看是否启动成功

[root@lab10 core-redis-6379]# ps -ef | grep redis | grep -v grep
root      23349      1  0 23:25 ?        00:00:00 /usr/local/bin/redis-server *:6379

查看 Redis 版本

[root@lab10 core-redis-6379]# /usr/local/bin/redis-server --version
Redis server v=7.4.1 sha=00000000:1 malloc=jemalloc-5.3.0 bits=64 build=f6b281bb15d5350c

参考链接:

Redis 源码安装
使用systemd配置redis服务开机启动