Installing Redis under Linux

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.