Redis is installed offline
Release notes
- Redis: 5.0.7
- GCC: 4.520150623 (Red Hat 4.8.5-16) (GCC)
The related resources
Link: https://pan.baidu.com/s/1MiCAS9HDZHmzzpvtPLJskQ password: irug
steps
- Upload the resource and decompress it
unzip reids_package.zip Copy the code
- Installing the GCC Environment
cd gcc rpm -Uvh *.rpm --nodeps --force cd gcc-c++ rpm -Uvh *.rpm --nodeps --force Copy the code
- Unpack the reids
The tar - ZXVF redis - 5.0.7. Tar. Gz
- Compile Redis and install it to the specified directory
Make PREFIX=/usr/local/redis installCopy the code
- Copying configuration Files
mkdir -p /usr/local/redis/config cp -r redis.conf /usr/local/redis/config/ Copy the code
- 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
- 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
- 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