redis installation package: the original code in the form provided in the form
.c file
will be compiled to .o .c files need: gcc
the compiled files to install on the Linux system
First, the installation environment
redis is a C language development, you need to first install redis official website to download the original code compiler, gcc compiler-dependent environment. If there is no gcc environment, you need to install gcc:
the case of Linux in network links
[root@localhost ~]# yum install gcc-c++
If you are prompted to download, enter y
if you are prompted to install, enter y
installation is complete
Second, install Redis
Step 1, redis to download Windows
Redis official website: https://redis.io/download
Step 2, to upload the compressed file to download Windows Linux, upload through WinSCP, as follows
Upload to / root / can
WinSCP official download: https://winscp.net/eng/download.php
Step 3, decompression
Inside the decompression redis-5.0.7.tar.gz Linux
positioned to the root directory
[root@localhost ~]# cd /root/
[root@localhost ~]# tar -zxvf redis-5.0.7.tar.gz
Unzip the file after the success of
Step 4, the original code compiler translates the .o files
Enter extract the folder.
[root@localhost ~]# cd redis-5.0.7
Enter redis-5.0.7 to perform
[root@localhost redis-5.0.7]# make
Compile successfully (must be installed before compiling gcc, otherwise it will fail to compile)
Step 5, is mounted to the redis / usr / local / redis
a) redis start requires a configuration file, you can modify the port number and other information
to create a folder
[root@localhost ~]# mkdir /usr/local/redis
b) switching to redis-5.0.7 directory
[root@localhost ~]# cd /root/redis-5.0.7
c) mounting the / usr / local / redis /
[root@localhost redis-5.0.7]# make PREFIX=/usr/local/redis/ install
d) the installation is successful
after e) the installation is complete, there are several executable files in / usr / local / redis / bin
Step 6, copy the file
redis start requires a configuration file, you can modify the port number, etc.
[root@localhost redis-5.0.7]# cp /root/redis-5.0.7/redis.conf /usr/local/redis/
Three, Redis start
1, distal Enabler
Direct Run / bin / redis-server will start mode distal end, the distal end mode is started is a disadvantage after startup is completed, other operations can not be performed, if you must use the Ctrl + C , while redis-server program exits, not recommended this method
[root@localhost ~]# /usr/local/redis/bin/redis-server
Run successfully
ctrl + c end of the run
2, the back-end models start
a) modifying redis.conf profile mode is started after the end daemonize yes
[root@localhost ~]# vim /usr/local/redis/redis.conf
Switching the cursor to the desired position by the insertion into the i mode no yes to
press Esc wq proceeds to save and exit line mode
when b) a promoter, the configuration file specifies
the first change directory
[root@localhost ~]# cd /usr/local/redis/
Start redis-server and specify start to redis.conf
[root@localhost redis]# ./bin/redis-server ./redis.conf
Open port 6379
[root@localhost redis]# /sbin/iptables -I INPUT -p tcp --dport 6379 -j ACCEPT
Save rule
[root@localhost redis]# /etc/rc.d/init.d/iptables save
Port number is turned on and the corresponding rule has been saved
to view the corresponding service
[root@localhost redis]# ps -ef|grep -i redis
Proof of service is running
c) connected by redis client
[root@localhost redis]# ./bin/redis-cli
Test Redis commands
d) exit the client
127.0.0.1:6379> quit
Four, Redis stops
1, if it is used apt-get or yum install redis installed, stop / start / restart command directly following redis
[root@localhost redis]# /etc/init.d/redis-server stop
[root@localhost redis]# /etc/init.d/redis-server start
[root@localhost redis]# /etc/init.d/redis-server restart
2, by mounting the redis source, can be restarted by redis redis client application shutdown command redis-cli
[root@localhost redis]# redis-cli -h 127.0.0.1 -p 6379 shutdown
3. If the above methods are not successful stop redis, you can use
[root@localhost redis]# kill -9