Install redis under linux

Download the latest stable version from the official website

  • Open the official website address

  • Right-click to copy the download address as follows:
    insert image description here

  • Linux common commands

    • Create directory mkdir software
    • Download the compressed package wget http://download.redis.io/releases/redis-5.0.3.tar.gz
    • delete directory rm -rf redis
    • -r is to recurse downwards, no matter how many levels of directories there are, delete them together
    • -f means to delete directly without any prompt
    • Delete folder instance: rm -rf /var/log/httpd/access
    • The /var/log/httpd/access directory and all files and folders under it will be deleted
    • Delete file usage example: rm -f /var/log/httpd/access.log
    • The file /var/log/httpd/access.log will be deleted forcibly
    • Decompress the compressed package tar zxvf redis-5.0.3.tar.gz
    • Compile the file ./config
  • Open linux and enter the following command:

    • mkdir software (create directory)
    • wget download address
    • Unzip the source code and enter the directory (zxvf redis-5.0.3.tar.gz )(cd redis-5.0.3 )
    • no config
    • Direct make (if it is a 32-bit machine make 32bit)
  • 注:易碰到的问题,时间错误.

    • Reason: The source code is officially configured, but when the official configure, the generated file has timestamp information,
    • Make can only happen after configure,
    • If the time of your virtual machine is wrong, for example, it is 2012
    • Solution: date -s 'yyyy-mm-dd hh:mm:ss' rewrite time, then clock -w write cmos
  • Optional step: make test to test compilation

    • (It may appear: need tcl >8.4, you need to enter the command yum install tcl)
  • make compile

  • make test test (if the above need tcl>8.4 occurs)

  • Switch to root (su root)

  • Then execute yum install tcl

  • Try it in make test to see if the system is satisfied and if there is any error in compiling

  • Install to a specified directory, such as /usr/local/redis

  • Specify directory installationmake PREFIX=/usr/local/redis install

  • 注: PREFIX要大写

  • After make install, the following files are obtained

  • redis-benchmark performance testing tool

  • redis-check-aof log file detection tool (for example, log damage caused by power failure, can be detected and repaired (tool for checking aof log)

  • redis-check-dump snapshot file detection tool, effect class (tool for checking rdb logs)

  • redis-cli client (client for connection)

  • redis-server server (redis service process)

  • ll bin (view all sub-files under the current bin directory)

  • Copy the configuration file (copy the redis.conf file in the source code to the current directory)

  • cp /home/zcx/Software/redis-5.0.3/redis.conf ./

After copying the configuration file, start redis (you need to call the server binary file because it is a service process)

  • To start the server binary file and find a way to specify this to let him use this conf file to let him start
  • The startup command is as follows:
  • ./bin/redis-server ./redis.conf

(Make this configuration file in the current directory as its startup condition)

  • The following appears to indicate successful execution
    insert image description here

  • If ctr C exits this process, it will be killed (in order to observe its changes, do not close it first, there will be a way to make it run in the background later)

client connection

  • Open another terminal

  • cd /usr/local/redis/

  • ./bin/redis-cli
    insert image description here

  • show success

Let redis run as a background process

  • Vim edits the conf configuration file and modifies the following content;\
  • daemonize yes
  • just restart
  • ps aux|grep redis (view redis process)
  • ./redis-cli shutdown (close the default port
    )
  • ps aux|grep redis (view redis process)
  • ./redis-cli shutdown (close the default port)

Guess you like

Origin blog.csdn.net/Fire_Sky_Ho/article/details/129619158