1. Install compiled rely environment
# Install pcre development package: yum install -y PCRE- devel # ssl feature requires installing openssl library yum -y install openssl- devel tool # compiler source code needed to install and libraries yum install gcc gcc -c ++ ncurses-devel perl
2. Download and install
# Command line Download Source Package redis wget HTTP: // download.redis.io/releases/redis-2.8.17.tar.gz # extract to the current directory tar xzf redis- 2.8 . 17 . Tar .gz # switch to unzip directory cd redis - 2.8 . 17 # compile the source code files the make # redis create the installation directory mkdir / usr / local / redis # install redis to the new directory in the just after a successful installation # / usr / local / redis how directory a bin subdirectory, which will have #redis -benchmark-AOF of the Check-Redis Redis-CHECK- dump #redis the -cli redis- Server five executable files make --PREFIX=/usr/local/redis install
3. Modify the configuration file
vi redis.conf # modify the configuration # modify the program running mode (line 37 in the configuration file), the redis run as daemon, # NO means no running (will occupy a terminal) in a manner daemon, daemonize yes # password (in the configuration file of 348 lines), uncommented, requirepass <password> # save and exit # this configuration copy files to the system configuration files directory, easy to read random start # create a directory of configuration files contain redis mkdir / etc / Redis # copy and rename the configuration file " 6379 .conf", cp redis.conf / etc / Redis / 6379 .conf
4. Registration redis service
# Copy startup script redis_init_script to redis /etc/rc.d/init.d/ , and named redisd cp utils / redis_init_script /etc/rc.d/init.d/ redisd # modify the script file vi / etc / rc. d / init.d / redisd
Add the following line content (here with a # comment is meaningful) in the second row redisd file and save and exit
#chkconfig: 2345 80 90
# Registration services chkconfig - the Add redisd # might be prompted to use ' / sbin / chconfig ' , this time to create a soft link LN -s /etc/rc.d/init.d/redisd / sbin / redisd # then perform the following command, it should no longer be given the / sbin / chkconfig --add redisd
5. Set redis boot from Kai, start redis service
This is the beginning of the script starts /etc/init.d/redisd part shots
- Establish a link relationship redis executable file
# Just the " redis.conf " rename " 6379 .conf" The reason is that shell command # "CONF = " /etc/redis/${REDISPORT}.conf " " will execute the script to read the port number is named # of conf file, and here is the environment variable port REDISPORT 6379. #shell command 'EXEC = / usr / local / bin / redis- Server' and # 'CLIEXEC = / usr / local / bin / CLI-Redis' performs the / usr / local / bin / directory #redis -server, redis-cli two executable files, but I will redis custom install in / usr / local / redis / bin # directory, so you want to / usr / local / bin / soft link is established redis execute files directory LN -s / usr / local / Redis / bin / Redis-Server / usr / local / bin / redis- Server LN-s / usr / local / Redis / bin / Redis-cli / usr / local / bin / redis- cli time # Create a soft link, must write the full path, do not write the relative path, or in the executable file will prompt "too many link "
- Set boot from Kai
systemctl enable redisd
- Start redis
systemctl start redisd
- redis open firewall ports
# 6379 open ports for easy external remote login Redis Firewall -cmd --permanent --add-Port = 6379 / tcp # reload the firewall, the open ports in Firewall -cmd --reload