Step 1: Download reids
You can go to redis official website to download or use wget http://download.redis.io/releases/redis-4.0.9.tar.gz to download
Step 2: Unzip the compressed package
tar -zxvf redis-4.0.9.tar.gz
Step 3: Enter the redis directory:
cd redis-4.0.9
Step 4: Compile and install
make make install
After the compilation is complete, the src directory is as follows
in
redis-benchmark: stress test file
redis-check-aof, redis-check-rdb detection backup file script
redis-cli terminal operation script
redis-server starts the redis service script file
At the same time, the above files will be in the /usr/local/bin directory
Step 5: Switch to the /usr/local/bin directory to start redis
cd /usr/local/bin
./redis-server
Redis default startup port is 6379
We can also start redis using the background
To start reids in the background, modify the redis.conf configuration file and change daemonize to yes
Go to the installation directory of redis, there is a redis.conf file under the directory, modify daemonize
vi redis.conf
Start redis in the background
[root@localhost bin]# ./redis-server redis.conf
After the service is started, we can use redis-cli to operate redis
[root@localhost bin]# redis-cli
If you need to perform password authentication when logging in to the redis server, you can modify the corresponding requirepass value in the redis.conf configuration file;
After modification, restart the service. At this time, when you use the redis-cli command to log in to the redis service, you can log in but do not have permission to operate. As shown in the figure:
If you want to operate, you must bring your password when logging in