Redis(2) – Install the Redis tutorial on Linux and Windows
1. Install on Linux (recommended)
1. Download the installation package from github.com/redis/redis…
Web disk link: pan.baidu.com/s/1D5Bp25H-… Extraction code: R3FO
2. Use XFTP to transfer the installation package to the Linux server
3. Go to the opt directory
The mv redis - 6.0.12. Tar. Gz/optCopy the code
4. Decompress the installation package
The tar - ZXVF redis - 6.0.12. Tar. GzCopy the code
Extract the complete
5. Basic environment configuration
yum install gcc-c++ # install GCC
gcc -v Check the GCC version
Copy the code
6. Run the make command
After the make command is executed, the compiled Redis service program redis-server and the client program redis-cli are displayed in the SRC directory of redis-6.0.8
make
Copy the code
make install Verify the installation
Copy the code
If the following error occurs when the make command is executed:
Error cause: The GCC version is incorrect. Upgrade the GCC version
yum -y install centos-release-scl
yum -y install devtoolset-9-gcc devtoolset-9-gcc-c++ devtoolset-9-binutils
scl enable devtoolset-9 bash
# Note: the SCL command is only temporary, and will revert to the original GCC version with xshell or a reboot. There is also the execution of this command if it is to take effect for a long time
echo "source /opt/rh/devtoolset-9/enable" >>/etc/profile
# re-execute make
make
Copy the code
The default redis installation path is /usr/local/bin
8. Copy the Redis configuration file
Copy the redis configuration file redis.conf to the wconfig directory in /usr/local/bin:
Cp/opt/redis - 6.0.12 / redis. Conf wconfigCopy the code
9. Modify the configuration file
Configure Redis as the default background boot
vim redis.conf
Copy the code
Instead of yes
10. Start the Redis service
redis-server wconfig/redis.conf Start the Redis service from the configuration file
Copy the code
11. The client tests the connection
12. Close the Redis service
shutdown
exit
Copy the code
2. Install in Windows
Redis is a well-known NoSql database, which is officially only supported by Linux. Windows version Only the modified version can be used, but the Windows version supports the version of Redis is very low and has stopped updating, so it is not recommended to use it in the official environment.
1. Download the installation package at github.com/tporadowski…
2. Decompress the file to a local directory
3. Double-click Redis-server. exe to run Redis
Successful: The default port number of Redis is ==6379==
4. Use the client to connect to the Redis service
Exe, do not close the original redis-server.exe, or you will not be able to access the server.
Enter the ping command to test the connection: