First, the installation of GCC
1, Redis installation on Linux first must first install GCC, this is used to compile Redis source files. First you need to switch to the root user
2. Then start installing GCC:
Yum Install gcc-c++
Second, the installation of Redis
1, First officer network Download Redis compressed package, Address: http://redis.io/download
2. Through the remote management tool, copy the compressed package to the Linux server and perform the decompression operation:
Tar zxvf redis-4.0.8.tar.gz
3. Go to Redis Unzip directory and compile:
CD redis-4.0.8
Make
4, enter the SRC directory, test whether the installation is successful
CD src
Make Test
Prompt to install Tcl:
5, install Tcl:
Download: http://downloads.sourceforge.net/tcl/tcl8.6.1-src.tar.gz
Upload to Linux, unzip: Tar zxvf tcl8.6.1-src.tar.gz
Installing TCL:
CD tcl8.6.1
CD unix/
./configure
Make #编译软件包
Make install #安装软件包
6. Test again if Redis is installed successfully:
Cd/opt/redis-4.0.8/src
Make Test
7. Install to the installation path:
Make Prefix=/usr/local/redis Install
8. Go to the Bin directory to view:
Cd/usr/local/redis
CD bin
9. Copy the redis.conf file under the extracted Redis path below the installation path
cd/opt/redis-4.0.8
CP Redis.conf/usr/local/redis
Cd/usr/local/redis
Ls
10. Start Redis
1) The first method : Enter the bin under the installation path to start
Cd/usr/local/redis/bin
./redis-server
#但是这属于前端启动, after starting Redis, our console will not be able to do anything. Only CTRL + C stops booting.
2) second way: Back end start
Cd/usr/local/redis
VI redis.conf
Find Daemonize No to change it to Yes:
ESC exits insert mode input: Wq save changes
Start again:
Cd/usr/local/redis
./bin/redis-server./redis.conf
So Redis starts up.
11. See if Redis starts:
PS -ef | grep redis
12. Turn off Redis
Cd/usr/local/redis
./BIN/REDIS-CLI shutdown
13. View Redis default port number 6379 occupancy:
NETSTAT-TUNPL |grep 6379
Redis Simple to use:
1//First link Client2[[email protected] redis]#./bin/redis-cli3//Check if the network can4127.0.0.1:6379>Ping5 PONG6//set a key-value pair7127.0.0.1:6379>Set name Cheny8 OK9//gets the key value pair that was just setTen127.0.0.1:6379>Get name One "Cheny" A//See all the keys -127.0.0.1:6379> keys * -1)"name" the//Delete Name this key -127.0.0.1:6379>delname -(integer) 1 -127.0.0.1:6379> keys * +(Empty listorset) -127.0.0.1:6379>
Redis configuration on Linux