Redis is installed offline

Release notes

  1. Redis: 5.0.7
  2. GCC: 4.520150623 (Red Hat 4.8.5-16) (GCC)

The related resources

Link: https://pan.baidu.com/s/1MiCAS9HDZHmzzpvtPLJskQ password: irug

steps

  1. Upload the resource and decompress it
    unzip reids_package.zip
    Copy the code
  2. Installing the GCC Environment
    cd gcc
    rpm -Uvh *.rpm --nodeps --force
    cd gcc-c++
    rpm -Uvh *.rpm --nodeps --force
    Copy the code
  3. Unpack the reidsThe tar - ZXVF redis - 5.0.7. Tar. Gz
  4. Compile Redis and install it to the specified directory
    Make PREFIX=/usr/local/redis installCopy the code
  5. Copying configuration Files
    mkdir -p /usr/local/redis/config
    cp -r redis.conf /usr/local/redis/config/
    Copy the code
  6. Modifying a Configuration File
    Vi/usr/local/redis/config/redis. Conf # modify content as follows: # allows the background daemonize yes # redis the default password for custom password requirepass XXX XXXXCopy the code
  7. Add Redis to the daemon and set it to boot
    Vim. # create redis service file/etc/systemd/system/redis. Service # add the following content:  [Unit] Description=Redis After=network.target [Service] Type=forking ExecStart=/usr/local/redis/bin/redis-server /usr/local/redis/config/redis.conf ExecStop=/usr/local/redis/bin/redis-server -s stop PrivateTmp=true User=root Group=root [Install] WantedBy=multi-user.targetCopy the code

Common commands are as follows:

  • Start redis: systemctl start redis
  • Disable redis: systemctl stop redis
  • To set automatic startup, run the systemctl enable redis command
  • Disable automatic startup: systemctl disable redis
  • Check the running status: systemctl status redis
  1. Configure the Redis environment variable
    # # editor vim configuration file/etc/profile in the configuration file then add this sentence export PATH = $PATH: / usr/local/redis/bin # gives effect to the environment variable source/etc/profileCopy the code