先到官网https://redis.io/download下安装包,现在最新是5.0.5版本,可惜点击下载后被windows禁了,那就下4版本的,往下看Other versions的Old(4.0),点4版本最新4.0.14:

  redis的优点之一就是安装包特别小,很快就能下好,点个赞。接下来进入linux的wlf用户,通过rz上传至soft目录,开始执行安装操作:

$ tar xzvf soft/redis-4.0..tar.gz
$ cd redis-4.0.
$ make

  make构建结束后,也就安装结束了:

    LINK redis-server
INSTALL redis-sentinel
CC redis-cli.o
LINK redis-cli
CC redis-benchmark.o
LINK redis-benchmark
INSTALL redis-check-rdb
INSTALL redis-check-aof Hint: It's a good idea to run 'make test' ;) make[]: Leaving directory `/home/wlf/redis-4.0./src'

  启动redis前我们用vi改下配置文件redis.conf:

# By default, if no "bind" configuration directive is specified, Redis listens
# for connections from all the network interfaces available on the server.
# It is possible to listen to just one or multiple selected interfaces using
# the "bind" configuration directive, followed by one or more IP addresses.
#
# Examples:
#
# bind 192.168.1.100 10.0.0.1
# bind 127.0.0.1 ::
#
# ~~~ WARNING ~~~ If the computer running Redis is directly exposed to the
# internet, binding to all the interfaces is dangerous and will expose the
# instance to everybody on the internet. So by default we uncomment the
# following bind directive, that will force Redis to listen only into
# the IPv4 lookback interface address (this means Redis will be able to
# accept connections only from clients running into the same computer it
# is running).
#
# IF YOU ARE SURE YOU WANT YOUR INSTANCE TO LISTEN TO ALL THE INTERFACES
# JUST COMMENT THE FOLLOWING LINE.
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bind 127.0.0.1 # Protected mode is a layer of security protection, in order to avoid that
# Redis instances left open on the internet are accessed and exploited.
#
# When protected mode is on and if:
#
# ) The server is not binding explicitly to a set of addresses using the
# "bind" directive.
# ) No password is configured.
#
# The server only accepts connections from clients connecting from the
# IPv4 and IPv6 loopback addresses 127.0.0.1 and ::, and from Unix domain
# sockets.
#
# By default protected mode is enabled. You should disable it only if
# you are sure you want clients from other hosts to connect to Redis
# even if no authentication is configured, nor a specific set of interfaces
# are explicitly listed using the "bind" directive.
protected-mode yes

  在bind 127.0.0.1前加#注掉,将protected-mode yes改为protected-mode no去掉保护策略,这样就能支持远程连接了。

# By default Redis does not run as a daemon. Use 'yes' if you need it.
# Note that Redis will write a pid file in /var/run/redis.pid when daemonized.
daemonize no # If a pid file is specified, Redis writes it where specified at startup
# and removes it at exit.
#
# When the server runs non daemonized, no pid file is created if none is
# specified in the configuration. When the server is daemonized, the pid file
# is used even if not specified, defaulting to "/var/run/redis.pid".
#
# Creating a pid file is best effort: if Redis is not able to create it
# nothing bad happens, the server will start and run normally.
pidfile /var/run/redis_6379.pid

  默认redis不是在后台运行的,将daemonize no改为daemonize yes,另外当后台运行时默认生成的pid文件是在/var/run目录下,我们可以指定为自己的目录,如改为/home/wlf/redis-4.0.14/run/redis_6379.pid

  保存好后启动redis:

$ src/redis-server redis.conf
:C Sep ::56.153 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
:C Sep ::56.153 # Redis version=4.0., bits=, commit=, modified=, pid=, just started
:C Sep ::56.153 # Configuration loaded

  看下进程,已经起来了:

$ netstat -nlp | grep
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
tcp 0.0.0.0: 0.0.0.0:* LISTEN /src/redis-ser
tcp6 ::: :::* LISTEN /src/redis-ser

  我们克隆会话打开另一个窗口,进入wlf用户开启客户端:

$ cd redis-4.0./
$ src/redis-cli
127.0.0.1:> set wlf wumanshu
OK
127.0.0.1:> get wlf
"wumanshu"

  如果我们想从客户端远程连接服务端,只需指定服务端ip即可,假如redis服务端ip是10.110.1.11,那么我在客户端机器使用命令需要加参数h(默认端口也是6379):

$ src/redis-cli -h 10.110.1.11

  关闭客户端,同时也将关闭服务端:

$ src/redis-cli shutdown
$ netstat -nlp | grep
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)

  或者使用telnet也可以从远程机器连接到redis。不过因为以上设置,redis本身的安全机制已经荡然无存,此时很容被入侵,具体方法和安全防护措施参见redis支持远程接入的安全防护问题

linux非root用户安装4.0.14版本redis的更多相关文章

  1. linux非root用户安装5.7.27版本mysql

    先下安装包,到mysql官网https://dev.mysql.com/downloads/mysql/选好安装包版本.操作系统类型(默认是最新版本,点击右边链接Looking for previou ...

  2. 【tf.keras】Linux 非 root 用户安装 CUDA 和 cuDNN

    TensorFlow 2.0 for Linux 使用时报错:(cuDNN 版本低了) E tensorflow/stream_executor/cuda/cuda_dnn.cc:319] Loade ...

  3. linux非root用户安装jdk1.8

    如题,先到 Oracle 官方网站 下载1.8版本的 JDK 压缩包(jdk-8u221-linux-x64.tar.gz)到本地(如D盘的soft目录),然后开始进入linux的非root用户(如w ...

  4. linux非root用户安装ncurses-devel依赖

    很明显,如果我们通过yum或rpm下载安装,始终无法绕开root用户,除非我们不用yum或rpm.嗯,我们直接用源码安装.下载源码包,到http://ftp.gnu.org/gnu/ncurses/我 ...

  5. Linux非root用户安装jdk和tomcat

    转载自:http://blog.csdn.net/wuyigong111/article/details/17410661,进行部分修改 创建一个用户 sgmm,并在其用户目录里面安装 jdk和tom ...

  6. linux非root用户安装nginx

    先到官网http://nginx.org/en/download.html下载最新稳定版源码包,目前是1.16.1: 下完后通过rz上传至wlf用户soft目录下,退回上一级目录解压: $ cd so ...

  7. linux非root用户安装rabbitmq

    因为rabbitmq是用erlang语言写的,所以装rabbitmq前第一步得先装erlang. 我们到erlang官网https://www.erlang.org/downloads下载安装包,最新 ...

  8. linux 非root用户安装nginx

    第一步:首先下载依赖包 下载地址 pcre(www.pcre.org),zlib(www.zlib.org),openssl(www.openssl.org) 第二步:上传那个nginx的安装包 下载 ...

  9. Linux 以非root用户安装zsh&配置on my zsh

    此文章参考以下三篇文章,如有侵权请联系 Linux非root用户安装zsh, 并用oh-my-zsh进行配置 在没有sudo权限的Linux服务器下安装oh-my-zsh 不使用root权限安装zsh ...

随机推荐

  1. 04 c++中的友元

    c++中的类具有封装性,类中的私有数据只有该类的成员函数可以访问,程序中访问类中的私有成员,必须通过对象来调用成员函数,但是频繁的调用会使运行效率降低. 为了解决上述问题,c++中加入友元机制,友元可 ...

  2. 结构型模式(五) 外观模式(Facade)

    一.动机(Motivate) 在软件系统开发的过程中,当组件的客户(即外部接口,或客户程序)和组件中各种复杂的子系统有了过多的耦合,随着外部客户程序和各子系统的演化,这种过多的耦合面临很多变化的挑战. ...

  3. 浅析 pagehelper 分页

    之前项目一直使用的是普元框架,最近公司项目搭建了新框架,主要是由公司的大佬搭建的,以springboot为基础.为了多学习点东西,我也模仿他搭了一套自己的框架,但是在完成分页功能的时候,确遇到了问题. ...

  4. lambda 函数的用法

    lambda函数又叫匿名函数, 匿名函数就是没有名字的函数,不使用def语句声明的函数.如果要声名,则需要使用lambda关键字进行声明. 一般用来定义简单的函数. 1.声明一个简单的加法匿名函数: ...

  5. Java - 框架之 SpringMVC

    一. 简单配置 (XML) 1. web.xml <?xml version="1.0" encoding="UTF-8"?> <web-ap ...

  6. POJ - 3252 - Round Numbers(数位DP)

    链接: https://vjudge.net/problem/POJ-3252 题意: The cows, as you know, have no fingers or thumbs and thu ...

  7. Hive节点及原理

    1.什么是Hive:hive是一种基于hadoop的数据仓库,能够将结构化的数据映射成一张表,并提供HQL进行查询.其数据是存储在hdfs上,本质是将sql命令转化成MapReduce来执行. 2.H ...

  8. Problem 4 dp

    $des$ 小 $Y$ 十分喜爱光学相关的问题, 一天他正在研究折射.他在平面上放置了 $n$ 个折射装置, 希望利用这些装置画出美丽的折线.折线将从某个装置出发, 并且在经过一处装置时可以转向, 若 ...

  9. Cogs 56. 质数取石子(博弈)

    质数取石子 ★★ 输入文件:stonegame.in 输出文件:stonegame.out 简单对比 时间限制:1 s 内存限制:128 MB 问题描述 DD 和 MM 正在玩取石子游戏.他们的游戏规 ...

  10. Python中多层List展平为一层

    小书匠python 使用Python脚本的过程中,偶尔需要使用list多层转一层,又总是忘记怎么写搜索关键词,所以总是找了很久,现在把各种方法记录下来,方便自己也方便大家. 方法很多,现在就简单写8种 ...