Because there are many Linux distributions. Redis provides source code developed in C. It needs to be compiled to run, and a c compilation environment is required before compilation. (Recommended learning: Redis video tutorial)
Requires a gcc compilation environment in Linux. The way to install gcc is also very simple. First install the gcc compilation environment. If the server contains a compilation environment, please skip the first step.
Enter the redis installation directory cd /usr/local/redis/bin
Execute the ./redis-server startup command
If you see such an interface, it means that the startup is successful. The default port is 6379
This mode is the front-end startup mode, which will occupy a terminal. We generally use backend startup.
How to connect to redis
1 Enter cd /usr/local/redis/bin/
2 Execute ./redis-cli
If you see the following page, it means the connection is successful. The default connection is the local machine. If you want to connect to other addresses, you can use ./redis-cli -h 192.168.XX.XX -p 6379 to connect.
-h represents ip -p represents port. The default is 6379
For more Redis related technical articles, please visit Redis Getting Started Tutorial Column for learning!
The above is the detailed content of How to connect redis in linux. For more information, please follow other related articles on the PHP Chinese website!