reprint please from the source : http://www.cnblogs.com/hd3013779515/
1.Redis Installation
The latest version used is 3.2.9, download and install:
wget http://download.redis.io/releases/redis-3. 2.9.TAR.GZTAR-XZVF REDIS-3.2.9.TAR.GZCD Redis-3.2.9make
Error after executing make
The reason for this error is the lack of GCC and the implementation of Yum install GCC. Then execute make again, or error.
After you execute make Distclean, the compiled Redis service program Redis-server will appear in the redis-3.2.9 directory after successful finish.
There is also a client program for testing REDIS-CLI, two programs located in the installation directory SRC directory:
Start the Redis service below.
./src/redis-server
Note this way of starting Redis is using the default configuration. You can also tell Redis to start with the following command using the specified configuration file through the startup parameters.
./src/redis-server redis.conf
Redis.conf is a default configuration file. We can use our own configuration files as needed.
Once the Redis service process is started, you can use the test client program REDIS-CLI to interact with the Redis service. Like what:
./src/redis-cli
2.Redis Configuration for System services
(1) Copy
redis_init_script
File
Copy the files to the utils/redis_init_script
/etc/rc.d/init.d/
directory and rename them as redis
:
CP Utils/redis_init_script/etc/rc.d/init.d/redis
(2) Edit
redis
File
To edit a /etc/rc.d/init.d/redis
file:
In the second line of the file, add:
# chkconfig:2345 80 90
And will take the following line ( start
under node):
$EXEC $CONF
Modified to:
$EXEC $CONF &
Note: The &
Service will be run in the background, not add this symbol redis
will be displayed in the foreground, and affect the start of other services.
Confirm the installation directory
The following two lines in the file are the Redis
default directories for the installation. If the actual installation directory does not match the next two lines, modify it to the actual installation directory.
Exec=/home/redis-3.2.9/src/redis-server CLIEXEC=/HOME/REDIS-3.2.9/SRC/REDIS-CLI
Copying conf
files
The file has the following line:
conf= "/etc/redis/${redisport}.conf"
The row represents the Redis
location of the configuration file redis.conf
and is ${REDISPORT}
.conf
named for the Redis
run port.
At this point you need to create and /etc/redis
Copy the configuration file to this directory. Execute the following two commands, respectively:
Mkdir/etc/redis CP redis.conf/etc/redis/6379.conf
(3) Registration system Services
Register the system service using the chkconfig
command. The Registration redis
Service command is as follows:
Chkconfig--add Redis
Start the redis
service:
Service Redis Start
The configuration is complete and the service can now be service
managed by command redis
.
1.Redis installation (Linux environment)