Installation environment. Linux:centos7,redis:redis-4.0.1.tar.gz.
1, install GCC. Redis is written in C, and the installation package provided on the website must be compiled.
Yum-y Install GCC
2. Use the FTP tool to copy the redis-4.0.1.tar.gz to the Linux server.
3. Unpack the installation package
Tar-xzf redis-4.0.1.tar.gz
4. Compiling
CD Redis-4.0.1make
5, installation, make install will be installed to the default directory, prefix specify the installation directory
Make install Prefix=/usr/local/redis
6, start. Execute the command under the Redis/bin directory:./redis-server.
./redis-server
6. Start Redis in the background. Create a directory under the Redis installation directory etc, and then copy the redis.conf file from the unpacked package to the directory
Cd/usr/local/redismkdir ETCCD/VAR/FTP/PUB/REDIS-4.0.1CP redis.conf/usr/local/redis/etc
Modify the redis.conf file to configure Damonize to Yes
CD/USR/LOCAL/REDIS/ETCVI redis.conf
7. Restart Redis.
./redis-server/usr/local/redis/etc/redis.conf
8. Run./REDIS-CLI can start the client and run./REDIS-CLI quit to close the connection.
./REDIS-CLI./REDIS-CLI quit
9, modify the configuration file, and set the boot start.
Vi/etc/init.d/redis
Vi/usr/local/redis/etc/redis.conf
Change the Pidfile value of the above 2 files to the same one.
chmod +x/etc/init.d/redis
Configure the service.
10. Start and close services
Service Redis StartService Redis stop
11. Set Boot Start
Vi/etc/init.d/redischkconfig--add redischkconfig Redis on
Modify the Redis service file and increase chkconfig:2345 10 90 on the third line.
12, external connection Redis. Redis can only be accessed natively by default and must be modified externally to access the Redis service.
Unregister bind 127.0.0.1 and change Protected-mode to No.
13. Java Code Test
Installing Redis under Linux