CentOS7下编译安装redis-5.0.9

本文地址http://yangjianyong.cn/?p=171转载无需经过作者本人授权

下载redis

  1. #code start
  2. wget https://download.redis.io/releases/redis-5.0.9.tar.gz
  3. #code end

解压

  1. #code start
  2. tar -zxvf redis-5.0.9.tar.gz
  3. #code end

安装

  1. #code start
  2. cd redis-5.0.9
  3. make && make install
  4. #code end

最后出现如下代码表示成功,路径根据自己的环境可能不同

  1. #code start
  2. Hint: It's a good idea to run 'make test' ;)
  3. make[1]: Leaving directory `/docker_share/redis-5.0.9/src'
  4. cd src && make install
  5. make[1]: Entering directory `/docker_share/redis-5.0.9/src'
  6. CC Makefile.dep
  7. make[1]: Leaving directory `/docker_share/redis-5.0.9/src'
  8. make[1]: Entering directory `/docker_share/redis-5.0.9/src'
  9. Hint: It's a good idea to run 'make test' ;)
  10. INSTALL install
  11. INSTALL install
  12. INSTALL install
  13. INSTALL install
  14. INSTALL install
  15. make[1]: Leaving directory `/docker_share/redis-5.0.9/src'
  16. #code end

配置

复制配置文件到/etc/下

  1. #code start
  2. cp redis.conf /etc/
  3. #code end

新建日志文件地址

  1. #code start
  2. cd /var/log
  3. mkdir redis
  4. cd redis
  5. touch redis.log
  6. #code end

复制redis执行文件到/usr/bin/下

  1. #code start
  2. cd src
  3. cp redis-cli redis-benchmark redis-server /usr/bin
  4. #code end

修改默认配置文件

  1. #code start
  2. vim /etc/redis.conf
  3. #修改默认客户端最长连接时间。修改为30分钟
  4. timeout 1800
  5. #修改以守护进程的方式启动。默认为no
  6. daemonize yes
  7. # 设置日志文件的地址,跟上面的设置地址一样
  8. logfile "/var/log/redis/redis.log"
  9. #允许其他机器上的客户端连接当前redis
  10. protected-mode no
  11. #修改redis密码
  12. requirepass redisPassword
  13. #code end

设置开机启动

  1. #code start
  2. vim /usr/lib/systemd/system/redis.service
  3. #启动代码
  4. [Unit]
  5. Description=Redis persistent key-value database
  6. After=network.target
  7. After=network-online.target
  8. Wants=network-online.target
  9. [Service]
  10. ExecStart=/usr/bin/redis-server /etc/redis.conf
  11. ExecStop=/usr/bin/redis-cli shutdown
  12. #Restart=always
  13. Type=forking
  14. #User=redis
  15. #Group=redis
  16. RuntimeDirectory=redis
  17. RuntimeDirectoryMode=0755
  18. [Install]
  19. WantedBy=multi-user.target
  20. #code end

设置开机启动并启动redis

  1. #code start
  2. #开机启动
  3. systemctl enable redis
  4. #启动redis
  5. systemctl start redis
  6. #code end

启动redis

  1. #code start
  2. systemctl start redis
  3. #code end

查看redis日志

  1. #code start
  2. cd /var/log/redis
  3. cat redis.log
  4. #code end

显示日志内容如下

  1. #code start
  2. 8118:C 03 Apr 2021 04:38:52.898 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
  3. 8118:C 03 Apr 2021 04:38:52.898 # Redis version=5.0.9, bits=64, commit=00000000, modified=0, pid=8118, just started
  4. 8118:C 03 Apr 2021 04:38:52.898 # Configuration loaded
  5. _._
  6. _.-``__ ''-._
  7. _.-`` `. `_. ''-._ Redis 5.0.9 (00000000/0) 64 bit
  8. .-`` .-```. ```\/ _.,_ ''-._
  9. ( ' , .-` | `, ) Running in standalone mode
  10. |`-._`-...-` __...-.``-._|'` _.-'| Port: 6379
  11. | `-._ `._ / _.-' | PID: 8119
  12. `-._ `-._ `-./ _.-' _.-'
  13. |`-._`-._ `-.__.-' _.-'_.-'|
  14. | `-._`-._ _.-'_.-' | http://redis.io
  15. `-._ `-._`-.__.-'_.-' _.-'
  16. |`-._`-._ `-.__.-' _.-'_.-'|
  17. | `-._`-._ _.-'_.-' |
  18. `-._ `-._`-.__.-'_.-' _.-'
  19. `-._ `-.__.-' _.-'
  20. `-._ _.-'
  21. `-.__.-'
  22. 8119:M 03 Apr 2021 04:38:52.901 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
  23. 8119:M 03 Apr 2021 04:38:52.902 # Server initialized
  24. 8119:M 03 Apr 2021 04:38:52.902 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
  25. 8119:M 03 Apr 2021 04:38:52.902 * Ready to accept connections
  26. #code end

欢迎来我的博客逛一逛 杨建勇的个人博客http://yangjianyong.cn

CentOS7下编译安装redis-5.0.9的更多相关文章

  1. centos7下编译安装nginx-1.16.0

    一.下载nginx源码 http://nginx.org/en/download.html 如:nginx-1.16.0.tar.gz 二.创建用户和组,并解压 groupadd www userad ...

  2. centos7下编译安装php-7.0.15(PHP-FPM)

    centos7下编译安装php-7.0.15(PHP-FPM) 一.下载php7源码包 http://php.net/downloads.php 如:php-7.0.15.tar.gz 二.安装所需依 ...

  3. 在CUDA8.0下编译安装OpenCV3.1.0来实现GPU加速(Compiling OpenCV3.1.0 with CUDA8.0 support)

    在CUDA8.0下编译安装OpenCV3.1.0 一.本人电脑配置:ubuntu 14.04, NVIDIA GTX1060. 二.编译OpenCV3.1.0前,读者需要成功安装CUDA8.0(网上有 ...

  4. Ubuntu16.04下编译安装OpenCV3.4.0(C++ & python)

    Ubuntu16.04下编译安装OpenCV3.4.0(C++ & python) 前提是已经安装了python2,python3 1)安装各种依赖库 sudo apt-get update ...

  5. centos7下编译安装redis5.05

    准备环境: 1.一台centos7机器,配置没有什么要求(能联网) 2.下载好redis压缩包 下载redis包: 1.登录redis官网: https://redis.io/download 2.选 ...

  6. CentOS7 下编译安装 Samba,什么是 SMB/CIFS 协议

    目录 一.关于 Samba 1. SMB 2. Samba 二.yum 安装 Samba 1. 安装 Samba 2. 查看版本 3. 查看配置文件 4. 启动服务 5. 本地客户端验证 6. Win ...

  7. 超详细 Linux 下编译安装Redis 以及php配套使用

    一.Linux 下安装Redis 下载地址:http://redis.io/download,下载最新文档版本. 把鼠标移到上图的绿色框上,就会显示下图提示:(直接右键复制链接就好) 本教程使用的旧版 ...

  8. Redhat5.8 环境下编译安装 Redis 并将其注册为系统服务

    系统环境: $ cat /etc/issueRed Hat Enterprise Linux Server release 5.8 (Tikanga)Kernel \r on an \m 1. 下载安 ...

  9. centos7下编译安装php7.3

    一.下载php7.3的源码 https://www.php.net/downloads.php 下载php-7.3.4.tar.gz 二.安装gcc,gcc-c++,kernel-devel yum ...

随机推荐

  1. 如何在 Matlab 中绘制带箭头的坐标系

    如何在 Matlab 中绘制带箭头的坐标系 如何在 Matlab 中绘制带箭头的坐标系 实现原理 演示效果 完整代码 实现原理 使用 matlab 的绘制函数时,默认设置为一个方框形的坐标系, 图1 ...

  2. WPF自定义控件三:消息提示框

    需求:实现全局消息提示框 一:创建全局Message public class Message { private static readonly Style infoStyle = (Style)A ...

  3. SpringBoot - 集成Auth0 JWT

    目录 前言 session认证与Token认证 session认证 Token认证 JWT简介 JWT定义 JWT数据结构 JWT的类库 具体实现 JWT配置 JWT工具类 测试接口 前言 说说JWT ...

  4. Node + Selenium 报错 UnhandledPromiseRejectionWarning: Error: ECONNREFUSED connect ECONNREFUSED 127.0.0.1:5319

    安装selenium-webdriver npm i selenium-webdriver 当前安装版本: "selenium-webdriver": "^4.0.0-a ...

  5. mysql删除大表更快的办法

    实现:巧用LINK(硬链接),原理:linux文件系统中硬链接相当于文件的入口,记录着ionde的信息.一个文件存在多个硬连接时,删除一个硬链接不会真正的删除ionde(存储文件的数据) # 创建硬链 ...

  6. ASP.NET Core Web API接收文件传输

    ASP.NET解析API参数的方式有很多种,包括[FromBody],[FromForm],[FromServices],[FromHeader][FromQuery]. 文件传输方式也分很多种,包括 ...

  7. Servlet、ServletContext与ServletConfig的详解及区别

    Servlet.ServletContext与ServletConfig的详解及区别 一.Servlet详解 Servlet是一个interface,全局限定名:javax.servlet.Servl ...

  8. 使用dom4j工具:读取xml标签(二)

    package dom4j_read; import java.io.File; import java.util.List; import org.dom4j.Document; import or ...

  9. 1 分钟快速使用 Docker 上手最新版 Sentry-CLI - 创建一个版本

    我们可以使用官方 sentry-cli 工具操作 Sentry API,从而来为你的项目管理一些数据.它主要用于管理 iOS.Android 的调试信息文件,以及其他平台的版本(release)和源代 ...

  10. Bing每日壁纸的RESTful接口实现

    0x00 存在意义 权且当作Docker打包的练习. 显然可以通过构造请求获得每天的壁纸,但是如果想要优雅地在其它地方使用这一网络资源,封装一个RESTful API将会保证整洁美观,在编写CSS等场 ...