redis安装从3.0的版本到现在4.0的版本,现在装一个4.0的版本供大家学习使用。

先yum安装gcc

 yum -y install gcc
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirror.bit.edu.cn
 * updates: mirrors.aliyun.com
正在解决依赖关系
--> 正在检查事务
---> 软件包 gcc.x86_64.0.4.8.5-16.el7_4.2 将被 安装
--> 解决依赖关系完成

依赖关系解决

==============================================================================================================
 Package             架构                   版本                                源                       大小
==============================================================================================================
正在安装:
 gcc                 x86_64                 4.8.5-16.el7_4.2                    updates                  16 M

事务概要
==============================================================================================================
安装  1 软件包

总下载量:16 M
安装大小:37 M
Downloading packages:
gcc-4.8.5-16.el7_4.2.x86_64.rpm                                                        |  16 MB  00:00:33
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在安装    : gcc-4.8.5-16.el7_4.2.x86_64                                                               1/1
  验证中      : gcc-4.8.5-16.el7_4.2.x86_64                                                               1/1 

已安装:
  gcc.x86_64 0:4.8.5-16.el7_4.2                                                                               

完毕!

下载redis最新4.0版本的tar包

wget http://download.redis.io/releases/redis-4.0.9.tar.gz
--2018-04-20 15:15:36--  http://download.redis.io/releases/redis-4.0.9.tar.gz
正在解析主机 download.redis.io (download.redis.io)... 109.74.203.151
正在连接 download.redis.io (download.redis.io)|109.74.203.151|:80... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:1737022 (1.7M) [application/x-gzip]
正在保存至: “redis-4.0.9.tar.gz”

100%[====================================================================>] 1,737,022   75.3KB/s 用时 43s    

2018-04-20 15:16:20 (39.2 KB/s) - 已保存 “redis-4.0.9.tar.gz” [1737022/1737022])

开始编译安装

tar -xvf redis-4.0.9.tar.gz
cd redis-4.0.9/
make MALLOC=libc

 继续中...............

[root@localhost redis-4.0.9]# cd src && make install
    CC Makefile.dep

Hint: It's a good idea to run 'make test' ;)

    INSTALL install
    INSTALL install
    INSTALL install
    INSTALL install
    INSTALL install

安装好了,启动试试。 

[root@localhost redis-4.0.9]# src/redis-server redis.conf
37399:C 20 Apr 16:08:57.437 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
37399:C 20 Apr 16:08:57.438 # Redis version=4.0.9, bits=64, commit=00000000, modified=0, pid=37399, just started
37399:C 20 Apr 16:08:57.438 # Warning: no config file specified, using the default config. In order to specify a config file use src/redis-server /path/to/redis.conf
37399:M 20 Apr 16:08:57.440 * Increased maximum number of open files to 10032 (it was originally set to 1024).
                _._
           _.-``__ ''-._
      _.-``    `.  `_.  ''-._           Redis 4.0.9 (00000000/0) 64 bit
  .-`` .-```.  ```\/    _.,_ ''-._
 (    '      ,       .-`  | `,    )     Running in standalone mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
 |    `-._   `._    /     _.-'    |     PID: 37399
  `-._    `-._  `-./  _.-'    _.-'
 |`-._`-._    `-.__.-'    _.-'_.-'|
 |    `-._`-._        _.-'_.-'    |           http://redis.io
  `-._    `-._`-.__.-'_.-'    _.-'
 |`-._`-._    `-.__.-'    _.-'_.-'|
 |    `-._`-._        _.-'_.-'    |
  `-._    `-._`-.__.-'_.-'    _.-'
      `-._    `-.__.-'    _.-'
          `-._        _.-'
              `-.__.-'                                               

37399:M 20 Apr 16:08:57.448 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
37399:M 20 Apr 16:08:57.448 # Server initialized
37399:M 20 Apr 16:08:57.448 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
37399:M 20 Apr 16:08:57.450 # 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.
37399:M 20 Apr 16:08:57.450 * Ready to accept connections

 这种方式退出就服务就停了,所以让它在后台运行可以这样做:

第一种:直接在启动服务后面加上 & 符号,让它在后台运行。

src/redis-server redis.conf &
[1] 36412
[root@localhost redis-4.0.9]# 36412:C 20 Apr 15:28:08.362 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
36412:C 20 Apr 15:28:08.362 # Redis version=4.0.9, bits=64, commit=00000000, modified=0, pid=36412, just started
36412:C 20 Apr 15:28:08.362 # Configuration loaded
36412:M 20 Apr 15:28:08.364 * Increased maximum number of open files to 10032 (it was originally set to 1024).
                _._
           _.-``__ ''-._
      _.-``    `.  `_.  ''-._           Redis 4.0.9 (00000000/0) 64 bit
  .-`` .-```.  ```\/    _.,_ ''-._
 (    '      ,       .-`  | `,    )     Running in standalone mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
 |    `-._   `._    /     _.-'    |     PID: 36412
  `-._    `-._  `-./  _.-'    _.-'
 |`-._`-._    `-.__.-'    _.-'_.-'|
 |    `-._`-._        _.-'_.-'    |           http://redis.io
  `-._    `-._`-.__.-'_.-'    _.-'
 |`-._`-._    `-.__.-'    _.-'_.-'|
 |    `-._`-._        _.-'_.-'    |
  `-._    `-._`-.__.-'_.-'    _.-'
      `-._    `-.__.-'    _.-'
          `-._        _.-'
              `-.__.-'                                               

36412:M 20 Apr 15:28:08.370 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
36412:M 20 Apr 15:28:08.370 # Server initialized
36412:M 20 Apr 15:28:08.371 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
36412:M 20 Apr 15:28:08.371 # 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.
36412:M 20 Apr 15:28:08.371 * DB loaded from disk: 0.000 seconds
36412:M 20 Apr 15:28:08.371 * Ready to accept connections

 第二种:修改redis.conf配置文件

#daemonize no
daemonize yes

启动服务

src/redis-server redis.conf 

36443:C 20 Apr 15:33:12.897 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo 36443:C 20 Apr 15:33:12.898 # Redis version=4.0.9, bits=64, commit=00000000, modified=0, pid=36443, just started 36443:C 20 Apr 15:33:12.898 # Configuration loaded

 查看服务是否启动

ps -ef |grep redis
root      36412   5190  0 15:28 pts/1    00:00:00 src/redis-server 127.0.0.1:6379
root      36417   5190  0 15:28 pts/1    00:00:00 grep --color=auto redis

 停止redis服务

kill -9 进程号

 设置redis登陆密码

vim redis.conf
修改成下面内容即可
# requirepass foobared
requirepass 123456

 此时重启redis,登陆时需要密码验证

[root@localhost redis-4.0.9]# src/redis-server redis.conf
36516:C 20 Apr 15:42:02.221 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
36516:C 20 Apr 15:42:02.221 # Redis version=4.0.9, bits=64, commit=00000000, modified=0, pid=36516, just started
36516:C 20 Apr 15:42:02.221 # Configuration loaded
[root@localhost redis-4.0.9]# src/redis-cli
127.0.0.1:6379> ping
(error) NOAUTH Authentication required.
127.0.0.1:6379> auth 123456
OK
127.0.0.1:6379> ping
PONG
127.0.0.1:6379>

  好了,这就是简单的redis部署环境了,生产环境其实一样,没什么复杂的,配置好了,然后就把ip和端口告诉开发,开发就会去连接redis,或者写到配置文件中,最后将整个的包发给我们运维,让我们去部署就行了,非常简单。

linux上安装redis4.0.9的更多相关文章

  1. 通过xshell在linux上安装redis3.0.0

    通过xshell在linux上安装redis3.0.0 0)首先要安装环境:yum install gcc-c++ 1)通过xftp6将redis安装包上传到linux:解压缩:tar -xvfz r ...

  2. Linux下安装redis-4.0.10

    1.下载redis-4.0.10 在redis官网(https://redis.io/download)下载redis-4.0.10 2.将安装包上传至Linux服务器 在Linux服务器根目录下创建 ...

  3. Linux下安装Redis4.0版本(简便方法)

    Redis介绍: Redis 是完全开源免费的,遵守BSD协议,是一个高性能的key-value数据库. Redis 与其他 key - value 缓存产品有以下三个特点: Redis支持数据的持久 ...

  4. 在Centos7上安装wxPython4.0.4

    在linux上安装wxPython4.0.4时需要gtk+2.0,在安装wxPython4.0.4遇到以下错误. linux上是用pip安装wxPython4.0.4的,执行命令如下: pip ins ...

  5. 通过xshell在linux上安装tomcat8

    通过xshell在linux上安装tomcat8 0)去官网下载linux版压缩包(点击去下载) 1)创建存放tomcat的文件夹 mkdir /usr/tomcat 2)通过xftp将其放置到指定文 ...

  6. 通过xshell在linux上安装JDK8

    通过xshell在linux上安装JDK8 0)新建连接,输入名称与主机IP地址 1)输入用户名与密码,创建连接 2)执行命令cd /usr/进入文件夹:再输入mkdir java创建java文件夹 ...

  7. redis3.0.5在linux上安装与配置

    redis3.0.5在linux上安装与配置 rhel6/ubuntu14 1 下载 # wget http://download.redis.io/releases/redis-3.0.5.tar. ...

  8. Linux上安装Hadoop集群(CentOS7+hadoop-2.8.0)--------hadoop环境的搭建

    Linux上安装Hadoop集群(CentOS7+hadoop-2.8.0)------https://blog.csdn.net/pucao_cug/article/details/71698903 ...

  9. linux上安装redis的踩坑过程

    redis用处很广泛,我不再啰嗦了,我按照网上教程想在linux上安装下,开始了踩坑过程,网上买了一个linux centos7.3,滴滴云的,巨坑无比啊,不建议大家用这家的! redis 为4.0, ...

随机推荐

  1. 再一道区间DP -- P4170 [CQOI2007]涂色

    https://www.luogu.org/problemnew/show/P4170 一道简单的区间DP,注意读入 #include <bits/stdc++.h> #define up ...

  2. 860. Lemonade Change

    class Solution { public: bool lemonadeChange(vector<int>& bills) { , ten = ; for (int i : ...

  3. ios 懒加载详解

    iOS开发之懒加载 在iOS开发中几乎经常用到懒加载技术,比如我们存放网络数据的数组,控制器的view,控件的自定义,复杂的运算逻辑等等情况下都会用到懒加载技术,那么什么是懒加载呢?? 他又有什么样的 ...

  4. iOS知识基础篇 static

    static关键字的作用  一.隐藏 通过static修饰的函数或者变量,在该文件中,所有位于这条语句之后的函数都可以访问,而其他文件中的方法和函数则不行: 二.静态变量 类方法不可以访问实例变量(函 ...

  5. 2019.01.17 bzoj2753: [SCOI2012]滑雪与时间胶囊(最小生成树)

    传送门 最小生成树菜题. 题意:给出一些有向边,问有向的最小生成树. 思路:先dfsdfsdfs一把所有有用的边都存起来,然后按终点点权为第一关键字,边权为第二关键字给边排序保证最小生成树的合法性,排 ...

  6. 2018.11.02 洛谷P2661 信息传递(拓扑排序+搜索)

    传送门 按照题意模拟就行了. 先拓扑排序去掉不在环上面的点. 剩下的都是简单环了. 于是都dfsdfsdfs一遍求出最短的环就行. 代码: #include<bits/stdc++.h> ...

  7. 解决linux系统CentOS下调整home和根分区大小

    目标:将VolGroup-lv_home缩小到20G,并将剩余的空间添加给VolGroup-lv_root   1.首先查看磁盘使用情况 [root@localhost ~]# df -h 文件系统 ...

  8. UVa 10294 Arif in Dhaka (First Love Part 2) (Polya定理)

    题意:给定 n 和 m 表示要制作一个项链和手镯,项链和手镯的区别就是手镯旋转和翻转都是相同的,而项链旋转都是相同的,而翻转是不同的,问你使用 n 个珠子和 m 种颜色可以制作多少种项链和手镯. 析: ...

  9. 关于CSS的优先级,CSS优先级计算,多个class引用

    原则一: 继承不如指定 原则二: #id > .class > 标签选择符 原则三:越具体越强大 原则四:标签#id >#id ; 标签.class > .class CSS优 ...

  10. i2c设备驱动注册

      Linux I2C设备驱动编写(二) 原创 2014年03月16日 23:26:50   在(一)中简述了Linux I2C子系统的三个主要成员i2c_adapter.i2c_driver.i2c ...