Redis is completely free open source, BSD agreement to comply with a high-performance key-value database.
2. Redis mounted on WSL
Next, this method is a little bit complicated, but you can choose any version of yourself you want, including Redis 5.0 RC.
2.1 Preparations
Use this method first need to install the Windows Subsystem for Linux on your computer, you can refer me to write another article article .
With WSL, we can begin. First you need to install gcc compiler in Linux:
sudo apt-get install gcc
- 1
2.2 Installation Redis
Then here select a desired version, enter the following command (I chose the version 4.0.11) in Linux:
wget http://download.redis.io/releases/redis-4.0.11.tar.gz
tar xzf redis-4.0.11.tar.gz
cd redis-4.0.11
make
make
After the terminal will prompt you to run make test
the test, if you want to test, you need to use sudo apt-get install tcl
the command to install tcl to be tested.
I have run make test, but the test is not passed, the error message is not closed when the process is a process, so interrupted test, but does not seem to affect the back.
`After make` continued:
sudo make install
And then install the service:
cd utils
sudo ./install_server.sh
When you select a port makes installation, configuration file name, log file name and directory and other data, you can use the default, all the way to Enter on the line.
2.3 Running Service
After the installation is complete, you can run Redis service (standalone mode) a.
redis-server
Here shows some warning, I did not get to the bottom of this.
Re-open a terminal, use the redis-cli
command you can test whether the installation was successful. Press Ctrl + C
can be taken out of service.
Redis can also start a non-independent mode, stop and restart:
sudo service redis_6379 start
sudo service redis_6379 stop
sudo service redis_6379 restart
There are some small episode when testing these commands, use start
after the terminal prompt service starts, view the log file also shows that a normal start, but by ps aux | grep redis
finding out the start of the service, /var/run/
under no path should appear in the redis_6379.pid
file, so the stop
command prompt pid does not exist, is not running, but using the redis-cli
command can still connect to the server, and can be operated, in which cause and effect being unknown.
Finally, use the following command to add Redis init script to all the default run level:
sudo update-rc.d redis_6379 defaults
At this point, Redis on Linux installation is over. After Windows 17046 version, WSL began to support a background task, that is to say after you run the service on a Linux terminal, even if close all windows Linux, the service does not end. If you have Redis GUI, you can try using the GUI connection Redis service after the window is closed.
2.4 set from the start
WSL is not yet supported by Linux startup task, if we restart Windows, Redis service will still be closed, to reopen WSL and enter the command to start the Redis, it automatically starts with the first method he sent some natural service.
Of course, there is a solution, that is, when you start a script to automatically run on the line.
I see another tutorial