Centos 7.4 source installation redis-5.0.4

Keywords: Programming Redis Nginx Database vim

  1. Preparation

    click Official website Download the installation package

  2. Use tar -zxvf to extract the installation package to / usr/local directory, and name it redis. The steps are omitted. The results are as follows

     [root@iZ2xxxxxuf9Z local]# pwd
     /usr/local
     [root@iZ2xxxxxuf9Z local]# ls
     aegis  etc    include  lib    libexec  nginx         redis  share
     bin    games  java     lib64  mysql    nginx-1.14.1  sbin   src
    
  3. Compilation and installation

    Note to execute in the redis directory

     [root@iZ2xxxxxuf9Z local]# cd redis/
     [root@iZ2xxxxxuf9Z redis]# make
     #A lot of installation log output
         LINK redis-benchmark
         INSTALL redis-check-rdb
         INSTALL redis-check-aof
    
     Hint: It's a good idea to run 'make test' ;)
    
     make[1]: Leaving directory `/usr/local/redis/src'
     [root@iZ2xxxxxuf9Z redis]# make install
     cd src && make install
     make[1]: Entering directory `/usr/local/redis/src'
         CC Makefile.dep
     make[1]: Leaving directory `/usr/local/redis/src'
     make[1]: Entering directory `/usr/local/redis/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 `/usr/local/redis/src'
     [root@iZ2xxxxxuf9Z redis]# 
    
  4. Register for redis service

     #Copy the redis init script under utils to / etc/rc.d/init.d/ and name it redis
     [root@iZ2xxxxxuf9Z redis]# cp utils/redis_init_script /etc/rc.d/init.d/redis
     #Modify the script file to add the following two lines below line 1
     # chkconfig: 2345 80 90 
     # description:  Redis is a persistent key-value database
     [root@iZ2xxxxxuf9Z redis]# vim 
    
     #!/bin/sh
     # chkconfig: 2345 80 90
     # description:  Redis is a persistent key-value database
     # Simple Redis init.d script conceived to work on Linux systems
     # as it does use of the /proc filesystem.
    
     ### BEGIN INIT INFO
     # Provides:     redis_6379
     # Default-Start:        2 3 4 5
     # Default-Stop:         0 1 6
     # Short-Description:    Redis data structure server
     # Description:          Redis data structure server. See https://redis.io
     ### END INIT INFO
    
     REDISPORT=6379
     EXEC=/usr/local/bin/redis-server
     CLIEXEC=/usr/local/bin/redis-cli
    
     PIDFILE=/var/run/redis_${REDISPORT}.pid
     CONF="/etc/redis/${REDISPORT}.conf"
    
  5. Preliminary profile modification

    From the / etc/rc.d/init.d/redis file in the previous step, we can see that conf = "/ etc/redis / ${report}. Conf". If you do not modify the direction of this line of configuration file, you need to put the configuration file in the / etc/redis directory with the port number. Conf

     [root@iZ2xxxxxuf9Z redis-5.0.0]# mkdir -p /etc/redis
     #Copy the configuration file to / etc/redis /, and name it 6379.conf
     [root@iZ2xxxxxuf9Z redis]# cp redis.conf /etc/redis/6379.conf
     [root@iZ2xxxxxuf9Z redis]# vim /etc/redis/6379.conf
     #Note bind 127.0.0.1 (for remote connections), change "daemonize no" to "daemonize yes"
     #bind 127.0.0.1
     daemonize yes
    
  6. Startup and startup

     #Start redis
     [root@iZ2xxxxxuf9Z redis]# systemctl start redis 
     #Set startup
     [root@iZ2xxxxxuf9Z redis]# systemctl enable redis
    

Reference documents: wliet - centos7 source installation redis-5.0.0

Posted by ChrisML123 on Fri, 29 Nov 2019 22:12:14 -0800