How to install Redis in Centos7
This article mainly explains "how to install Redis in Centos7". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to install Redis in Centos7.
Download redis installation package
You can also download other versions. I download version 5.0.8 here.
1.2 upload installation package
Upload the downloaded installation package to the specified directory on the server, and then decompress it through tar-zxvf xxxx, such as:
The c environment is required to install redis, so offline installation requires downloading some dependent installation packages.
Download address: https://vault.centos.org/7.0.1406/os/x86_64/Packages/
Cpp-4.8.2-16.el7.x86_64.rpmgcc-4.8.2-16.el7.x86_64.rpmglibc-2.17-55.el7.x86_64.rpmglibc-common-2.17-55.el7.x86_64.rpmglibc-devel-2.17-55.el7.x86_64.rpmglibc-headers-2.17-55.el7.x86_64.rpmglibc-static-2.17-55.el7.x86_64.rpmglibc-utils-2.17-55. El7.x86_64.rpmkernel-headers-3.10.0-123.el7.x86_64.rpmlibmpc-1.0.1-3.el7.x86_64.rpmmpfr-3.1.1-4.el7.x86_64.rpm
Choose to download the above to meet the installation requirements.
2.2 download and upload to the server and install via rpm
Rpm-Uvh * .rpm-nodeps-force
-- nodeps does not check dependencies when installing the package. For example, if you install BPerine B depending on C, it cannot be installed, and you can install it successfully by using-- nodeps.
-- force forced installation
2.3 check to see if the installation is successful
Rpm-Q gcc
Cd redis-5.0.8 enters the decompressed directory
3.1Compiling redis
Make
3.2 install compiled files to install to finger directory
Make PREFIX=/usr/local/redis install
Note: PREFIX must uppercase and automatically create a redis directory for us and install the results
3.3 when the installation is complete, the following files will be generated under the / usr/local/bin/ folder
3.4 configure redis.conf
Cd go to the unzipped directory of the installation package and copy redis.conf to the installation redis directory
Cd redis-5.0.8mkdir / usr/local/redis/etccp redis.conf / usr/local/redis/etcvim redis.conf
Change daemonize no to daemonize yes
Change requirepass to redis123 (this is a redis add password)
Appendonly yes comments open
3.5 Open service port
# check whether port 6379 enables firewall-cmd-- query-port=6379/tcp# opens port 6379 firewall-cmd-- permanent-- add-port=6379/tcp
3.6 Redis start
/ usr/local/redis/bin/redis-server / usr/local/redis/etc/redis.conf
3.7 View process
Ps-ef | grep redis
3.8 client startup
# No password. / redis-cli # has a password. / redis-cli-a redis123
3.9 execute commands on the server
Redis-cli-h host-p port-a password format is redis-cli-h IP address-p port-a password
3.10 Redis shutdown
The first way
# query progress PID ps-ef | grep-I redis# closes kill-9 PID
The second way
. / bin/redis-cli shutdown
4.1 shut down the redis service first
4.2 delete the redis-related files in the / usr/local/redis/bin/ directory
Rm-rf / usr/local/redis/bin/redis* so far, I believe you have a deeper understanding of "how to install Redis in Centos7". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!