In this tutorial we will learn to install Redis on CentOS server.
Redis is an open source (BSD licensed), in-memory data structure store, used as database, cache and message broker.
Note! By default Redis will run on port number 6379
So, lets get started with the installation process. Open terminal and login to your server as root user.
Its a best practice to first clean up and update yum and then perform installation.
Clean up yum by typing the following in terminal.
# sudo yum clean all
Now perform the update
# sudo yum -y update
Once the update is done we are ready to install redis.
Use the following command to install redis.
# yum install redis php-pecl-redis
Once redis is installed successfully you can check about it using the following command.
# redis-cli -v
Now that you have installed redis its time to start it. For this use the following command.
# sudo systemctl start redis.service
To check the redis status using the following command
# sudo systemctl status redis.service
● redis.service - Redis persistent key-value database
Loaded: loaded (/usr/lib/systemd/system/redis.service; disabled; vendor preset: disabled)
Active: active (running) since Sun 2016-02-14 10:55:14 UTC; 9s ago
Main PID: 17531 (redis-server)
└─17531 /usr/bin/redis-server 127.0.0.1:6379
To stop redis use the following command
# sudo systemctl stop redis.service
Once the redis server starts running you can check that it is configured correctly by using the ping command in redis client. For this you have to enter into redis client by typing redis-cli in the terminal then type in ping. If everything is working fine the redis server will respond back PONG.
To exit from redis-cli using the exit command.
Congratulation you have successfully installed redis. Have fun coding!
Have fun learning :-)
Copyright © 2014 - 2019 DYclassroom. All rights reserved.
rendered in 0.0148 sec