1. Preparation
A, tar package, such as: redis-3.2.8.tar.gz
B, Dependency packages
Yum install gcc tcl yum install gcc gcc-c++ autoconf autmake libtool make
2. Installation
Unzip and rename to Redis
[Email protected] tar]# TAR-ZXVF redis-3.2.8.tar.gz-c/opt [[email protected] opt]# MV Redis-3.2.8/redis
New Installation directory
[Email protected] opt]# Mkdir/usr/local/redis
Specifying the installation directory using PREFIX
[Email protected] opt]# cd/opt/redis/[[email protected] redis]# make Prefix=/usr/local/redis Install
After the installation is complete, you can see a bin directory under the/usr/local/redis directory, which is the Redis command script in the bin directory:
650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M01/8F/A4/wKiom1jnS_Wz2qGJAAAyowz5ke4666.jpg "title=" 111. JPG "alt=" wkiom1jns_wz2qgjaaayowz5ke4666.jpg "/>
3, configured as a service self-initiated
Copy the startup script to the/etc/init.d/directory and rename it to Redis
[Email protected] bin]# Cp/opt/redis/utils/redis_init_script/etc/init.d/redis
Edit/etc/init.d/redis
(1) Add a line after the first line of the script as follows:
#chkconfig: 2345 80 90
(If you do not add the above, you will be prompted when registering the service: Service Redis does not support Chkconfig)
(2) The Redisport port remains 6379 unchanged; (Note that the port name is related to the following profile name)
(3) Exec=/usr/local/bin/redis-server changed to Exec=/usr/local/redis/bin/redis-server
(4) CLIEXEC=/USR/LOCAL/BIN/REDIS-CLI changed to CLIEXEC=/USR/LOCAL/REDIS/BIN/REDIS-CLI
(5) configuration file settings:
Create a Redis profile directory
[Email protected] ~]# mkdir/usr/local/redis/conf
Copy the Redis profile/opt/redis/redis.conf to the/usr/local/redis/conf directory and rename it to 6379.conf by port number
[Email protected] ~]# cp/opt/redis/redis.conf/usr/local/redis/6379.conf
The following adjustments are made to the Conf attribute in/etc/init.d/redis:
conf= "/usr/local/redis/${redisport}.conf"
Change the commands that Redis opens in a way that runs in the background: $EXEC $CONF & # "&" function is to move the service back to run
start) if [ -f $PIDFILE ] then echo "$PIDFILE exists, process is already Running or crashed " else echo "Starting redis server ..." $EXEC $CONF & fi ;;
(6) Modify 6379.conf
[Email protected] bin]# vi/usr/local/redis/6379.conf #修改如下配置 #daemonize no change to daemonize Yes Daemoniz E Yes #pidfile/var/run/redis.pid change to > Pidfile/var/run/redis_6379.pid pidfile/var/run/redis_6379.pid
(7) Registering Redis as a service and booting from the boot
Chkconfig--add Redis chkconfig Redis on
(8) If you want to use Redis commands like REDIS-CLI directly, configure environment variables
Export JAVA_HOME=/HOME/JDK export Redis_home=/usr/local/redis export path=.: $JAVA _home/bin: $REDIS _home/bin:$ PATH
Refresh configuration: [[email protected] ~]# Source/etc/profile
Client Operation:
650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M02/8F/A6/wKiom1jnWf7BBS2JAAASlZQ0E2o585.png "title=" 111. PNG "alt=" Wkiom1jnwf7bbs2jaaaslzq0e2o585.png "/>
Attention:
By default, Redis turns on secure authentication, and you can specify a verification password through/usr/local/redis/conf/6379.conf's requirepass.
This article is from "I Love Big gold" blog, please be sure to keep this source http://1754966750.blog.51cto.com/7455444/1913924
Linux Learning: Installing Redis