Wsl installation redis5.0.5

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
 

 

 

makeAfter the terminal will prompt you to run make testthe test, if you want to test, you need to use sudo apt-get install tclthe 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

Write pictures described here
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.
Write pictures described here

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.
Write pictures described here
Re-open a terminal, use the redis-clicommand you can test whether the installation was successful. Press Ctrl + Ccan 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 startafter the terminal prompt service starts, view the log file also shows that a normal start, but by ps aux | grep redisfinding out the start of the service, /var/run/under no path should appear in the redis_6379.pidfile, so the stopcommand prompt pid does not exist, is not running, but using the redis-clicommand can still connect to the server, and can be operated, in which cause and effect being unknown.
Write pictures described here
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

 

Guess you like

Origin www.cnblogs.com/xyyhcn/p/11607057.html