Installing Linux environment Redis and complete the test (Verified)

Ready to work:

I test environment: Win7

xshell remote login Linux

Linux: ubuntu 

Package: redis-3..2.6.tar.gz (under Linux redis installation package) 

==================================================================================================================================================================

start installation:

The first step: enter the installation directory home / data

Step two: wget to download redis version

 wget http://download.redis.io/releases/redis-3.2.6.tar.gz  

The third step: unpack compile
tar -zxvf redis-3.2.6.tar.gz
into the redis-3.2.6 then make

# make CFLAGS=”-march=i686”;

 

#####################################################################

Description: make the back of a string of codes: CFLAGS = "- march = i686" to prevent the software version of Linux is not adapted to the hardware.

Linux i386 and i686 have this distinction; use the make command to compile redis directly in the case of software and hardware does not fit, it will report this error:

NOTE: If you add CFLAGS = but later make "- march = i686" This code will solve the problem, compile successfully

If you make an immediate success, not an error, do not add CFLAGS this string of code

If during installation gcc not given, the prompts to install gcc
yum the install -Y-gcc gcc C ++ ++ G

 

Step 4: After compiling successfully entered redis-2.6.14 / src directory

4. Copy redis-cli, redis-server to the / usr / local / redis / directory (directory create redis usr / local / in)

# cd /usr/local/soft/redis-2.6.14/src

# ll

You will see that there are several executable files:

Here we only need to use two files on it: redis-server and redis-cli

Step Five: copy redis-conf to the / usr / local / redis directory

I created a directory redis under / usr / local / directory

# cd /usr/local/

# mkdir redis

Then copy redis-server and server-cli src directory to the directory redis

[root@localhost src]# cp redis-cli redis-server /usr/local/redis/

 

Then back to redis-2.6.14 source directory to copy the files to redis redis.conf directory

[root@localhost redis-2.6.14]# cp redis.conf /usr/local/redis/

 

The end result is that with lower redis directory three files as shown below:

Here, even if completed.

============================================================================================================================================================

Then run redis service:

[root@localhost redis]# ./redis-server

Following screen appears, it means you can normally use redis

 

Now there is a question: redis running in the foreground, I can not do other things how to do? How redis in the background?

: Modify redis.conf file, daemonize no change daemonize yes

[root@localhost redis]# vi redis.conf

Will no modification is yes; save and exit

 

Kill rdis process, and then open again redis service

[root@localhost redis]# killall redis-server

[root@localhost redis]# ./redis-server redis.conf

The following interface description successful run in the background so that redis

 

If you want to see the process, there are no redis service, you can use pstree command to see the process:

[root@localhost redis]# pstree

==============================================================================================================================================================

After a successful run in the background, connecting with redis redis-cli client:

[Root @ localhost redis] # ./redis-cli (here connected to the machine, if the machine is connected to the network: ./ redis-cli IP port number)

Code above IP address and port number can not write, do not write, the machine default connection redis

 

View redis there are no data

Command: keys *

 

No data

Add data to a bar!

Command: get mykey "tom"

 

Read a piece of data:

Command: get mykey

 

 At this point, redis installation and testing on finished, the contents of proven correct.

Released eight original articles · won praise 13 · views 60000 +

Guess you like

Origin blog.csdn.net/qq_37655695/article/details/95991539