1. Download and install
The code is as follows |
Copy Code |
wget http://download.redis.io/redis-stable.tar.gz Tar xvzf redis-stable.tar.gz CD redis-stable Make Make Test Make install (Administrator privileges, add sudo)
Redis-server and REDIS-CLI will automatically be placed in the/usr/local/bin/directory.
|
2, the better installation configuration mode
1) Create Redis folder
sudo mkdir/etc/redis
The code is as follows |
Copy Code |
sudo mkdir/var/redis
|
2 Copy the startup script to the/ETC/INIT.D directory
The code is as follows |
Copy Code |
sudo cp utils/redis_init_script/etc/init.d/redis_6379
|
3) Modify the startup script
Make sure that the Redis_port is the port you need to open, and that the subsequent PID files and configuration files will depend on it
The code is as follows |
Copy Code |
sudo vim/etc/init.d/redis_6379
|
4 Create a Redis working directory
The code is as follows |
Copy Code |
sudo mkdir/var/redis/6379
|
5 Copy the Redis configuration file to the/etc/redis directory and modify or confirm the parameters
The code is as follows |
Copy Code |
sudo cp redis.conf/etc/redis/6379.conf #设置daemonize为true #设置pidfile为/var/run/redis_6379.pid #设置loglevel #设置logfile为/var/log/redis_6379.log #设置dir为/var/redis/6379
|
6 Use the following command to set up a new init script
The code is as follows |
Copy Code |
sudo update-rc.d redis_6379 defaults
|
Sudo:update-rc.d:command not found error may occur under CentOS, and you need to use Chkconfig instead
7) Start Redis
The code is as follows |
Copy Code |
sudo/etc/init.d/redis_6379 start
|
8) Confirm whether OK
Use the REDIS-CLI Save command to dump the data into a file to see if there are any Dump.rdb files under/var/redis/6379/and log log redis_6379.log generated under/var/log.