zoukankan      html  css  js  c++  java
  • RHEL6.5安装redis

    上一篇讲到了mysql的安装,接下来我们再装一个redis吧

    https://www.cnblogs.com/lch1990/p/10313116.html 

    官网

    https://redis.io/download

    [root@localhost redis]# cd /download/

    [root@localhost download]# yum -y install wget
    [root@localhost download]# wget http://download.redis.io/releases/redis-5.0.3.tar.gz

    [root@localhost download]# ls
    mysql-8.0.14-1.el6.x86_64.rpm-bundle.tar redis-5.0.3.tar.gz
    [root@localhost download]# tar -zxf redis-5.0.3.tar.gz
    [root@localhost download]# ls
    mysql-8.0.14-1.el6.x86_64.rpm-bundle.tar redis-5.0.3 redis-5.0.3.tar.gz
    [root@localhost download]# cd redis-5.0.3
    [root@localhost redis-5.0.3]# ls
    00-RELEASENOTES BUGS CONTRIBUTING COPYING deps INSTALL Makefile MANIFESTO README.md redis.conf runtest runtest-cluster runtest-sentinel sentinel.conf src tests utils
    [root@localhost redis-5.0.3]# make
    cd src && make all
    make[1]: Entering directory `/download/redis-5.0.3/src'
    CC Makefile.dep
    make[1]: Leaving directory `/download/redis-5.0.3/src'
    make[1]: Entering directory `/download/redis-5.0.3/src'
    rm -rf redis-server redis-sentinel redis-cli redis-benchmark redis-check-rdb redis-check-aof *.o *.gcda *.gcno *.gcov redis.info lcov-html Makefile.dep dict-benchmark
    (cd ../deps && make distclean)
    make[2]: Entering directory `/download/redis-5.0.3/deps'
    (cd hiredis && make clean) > /dev/null || true
    (cd linenoise && make clean) > /dev/null || true
    (cd lua && make clean) > /dev/null || true
    (cd jemalloc && [ -f Makefile ] && make distclean) > /dev/null || true
    (rm -f .make-*)
    make[2]: Leaving directory `/download/redis-5.0.3/deps'
    (rm -f .make-*)
    echo STD=-std=c99 -pedantic -DREDIS_STATIC='' >> .make-settings
    echo WARN=-Wall -W -Wno-missing-field-initializers >> .make-settings
    echo OPT=-O2 >> .make-settings
    echo MALLOC=jemalloc >> .make-settings
    echo CFLAGS= >> .make-settings
    echo LDFLAGS= >> .make-settings
    echo REDIS_CFLAGS= >> .make-settings
    echo REDIS_LDFLAGS= >> .make-settings
    echo PREV_FINAL_CFLAGS=-std=c99 -pedantic -DREDIS_STATIC='' -Wall -W -Wno-missing-field-initializers -O2 -g -ggdb -I../deps/hiredis -I../deps/linenoise -I../deps/lua/src -DUSE_JEMALLOC -I../deps/jemalloc/include >> .make-settings
    echo PREV_FINAL_LDFLAGS= -g -ggdb -rdynamic >> .make-settings
    (cd ../deps && make hiredis linenoise lua jemalloc)
    make[2]: Entering directory `/download/redis-5.0.3/deps'
    (cd hiredis && make clean) > /dev/null || true
    (cd linenoise && make clean) > /dev/null || true
    (cd lua && make clean) > /dev/null || true
    (cd jemalloc && [ -f Makefile ] && make distclean) > /dev/null || true
    (rm -f .make-*)
    (echo "" > .make-ldflags)
    (echo "" > .make-cflags)
    MAKE hiredis
    cd hiredis && make static
    make[3]: Entering directory `/download/redis-5.0.3/deps/hiredis'
    gcc -std=c99 -pedantic -c -O3 -fPIC -Wall -W -Wstrict-prototypes -Wwrite-strings -g -ggdb net.c
    make[3]: gcc: Command not found
    make[3]: *** [net.o] Error 127
    make[3]: Leaving directory `/download/redis-5.0.3/deps/hiredis'
    make[2]: *** [hiredis] Error 2
    make[2]: Leaving directory `/download/redis-5.0.3/deps'
    make[1]: [persist-settings] Error 2 (ignored)
    CC adlist.o
    /bin/sh: cc: command not found
    make[1]: *** [adlist.o] Error 127
    make[1]: Leaving directory `/download/redis-5.0.3/src'
    make: *** [all] Error 2
    [root@localhost redis-5.0.3]#

    哎呀报错了!依赖包忘装了!装一下吧!

    [root@localhost redis-5.0.3]# yum -y install gcc gcc-c++ libstdc++-devel

    再来

    [root@localhost redis-5.0.3]# make
    cd src && make all
    make[1]: Entering directory `/download/redis-5.0.3/src'
    CC Makefile.dep
    make[1]: Leaving directory `/download/redis-5.0.3/src'
    make[1]: Entering directory `/download/redis-5.0.3/src'
    CC adlist.o
    In file included from adlist.c:34:
    zmalloc.h:50:31: error: jemalloc/jemalloc.h: No such file or directory
    zmalloc.h:55:2: error: #error "Newer version of jemalloc required"
    make[1]: *** [adlist.o] Error 1
    make[1]: Leaving directory `/download/redis-5.0.3/src'
    make: *** [all] Error 2
    [root@localhost redis-5.0.3]#

    好吧这回真不知道为啥了,于是看见别人是这样做的我也试一下!

    [root@localhost redis-5.0.3]# make CFLAGS="-march=x86-64"

    过程略过。。。

    INSTALL redis-check-rdb
    INSTALL redis-check-aof

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

    make[1]: Leaving directory `/download/redis-5.0.3/src'
    [root@localhost redis-5.0.3]#

    好像成功了!!

    [root@localhost redis-5.0.3]# make install
    cd src && make install
    make[1]: Entering directory `/download/redis-5.0.3/src'
    CC Makefile.dep
    make[1]: Leaving directory `/download/redis-5.0.3/src'
    make[1]: Entering directory `/download/redis-5.0.3/src'

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

    INSTALL install
    INSTALL install
    INSTALL install
    INSTALL install
    INSTALL install
    make[1]: Leaving directory `/download/redis-5.0.3/src'
    [root@localhost redis-5.0.3]#

    没报错,试一下能启动不!!

    [root@localhost redis-5.0.3]# cd src/
    [root@localhost src]# redis-server

    OK启动成功了接下来就尽情的玩耍吧!!

    [root@localhost src]# mkdir /usr/bin/redis

    [root@localhost src]# cp redis-server redis-cli /usr/bin/redis/

    [root@localhost redis-5.0.3]# cp redis.conf /usr/bin/redis/

    [root@localhost redis-5.0.3]# cd !$
    cd /usr/bin/redis/
    [root@localhost redis]# ls
    redis-cli redis.conf redis-server
    [root@localhost redis]#

    编辑redis.conf文件
    daemonize yes(表示将redis设置成后台启动)

    [root@localhost redis]# vi redis.conf
    [root@localhost redis]# redis-server redis.conf (以配置文件形式启动redis)
    7150:C 25 Jan 2019 18:36:07.347 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
    7150:C 25 Jan 2019 18:36:07.348 # Redis version=5.0.3, bits=64, commit=00000000, modified=0, pid=7150, just started
    7150:C 25 Jan 2019 18:36:07.348 # Configuration loaded

    [root@localhost redis]# redis-cli
    127.0.0.1:6379> SET test 999
    OK
    127.0.0.1:6379> GET test
    "999"
    127.0.0.1:6379>

    没毛病可以玩耍了!!如果想在任何位置都可以使用redis-cli其实有多种方法,感觉最简单的就是创建软连接吧

    [root@localhost redis]# ln -s /usr/bin/redis/redis-cli /usr/bin/redis-cli

    [root@localhost ~]# cd
    [root@localhost ~]# redis-cli
    127.0.0.1:6379> get test
    "999"
    127.0.0.1:6379>

    好了搞完收工!!!希望对你有帮助!

    懒汉请往这里看https://pan.baidu.com/s/19dwRmjTwQW1liEJtuSEL6w

  • 相关阅读:
    九大经典算法之插入排序、希尔排序
    1072 开学寄语 (20 分)
    1070 结绳 (25 分
    查找字符串中的所有数字
    通过类继承计算梯形面积
    将命令的输出生成一个Web页面
    从Internet下载一个文件
    使用Excel管理命令输出
    将一个命令的输出保存到CSV文件
    使用属性存储用户编号和姓名
  • 原文地址:https://www.cnblogs.com/lch1990/p/10320054.html
Copyright © 2011-2022 走看看