{"id":5908,"date":"2016-05-08T18:27:38","date_gmt":"2016-05-08T10:27:38","guid":{"rendered":"http:\/\/rmohan.com\/?p=5908"},"modified":"2016-05-08T18:28:15","modified_gmt":"2016-05-08T10:28:15","slug":"install-redis-on-a-centos-6-5-centos-7-0-server","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=5908","title":{"rendered":"install Redis on a Centos 6.5 &#038; Centos 7.0 Server"},"content":{"rendered":"<p>How to install Redis on a Centos 6.5 &#038; Centos 7.0 Server<\/p>\n<p>Redis is an open source, BSD licensed, advanced key-value store. It is often referred to as a data structure server since keys can contain strings, hashes, lists, sets and sorted sets.<\/p>\n<p>How To Install Redis on Centos 7<br \/>\n# wget -r \u2013no-parent -A \u2018epel-release-*.rpm\u2019 http:\/\/dl.fedoraproject.org\/pub\/epel\/7\/x86_64\/e\/<br \/>\n# rpm -Uvh dl.fedoraproject.org\/pub\/epel\/7\/x86_64\/e\/epel-release-*.rpm<\/p>\n<p>It will create two epel\u2019s repo file inside \/etc\/yum.repos.d<br \/>\nThese are \u2013<br \/>\n1. epel.repo<br \/>\n2.epel-testing.repo<br \/>\nInstall Redis with Yum<br \/>\n# yum install redis php-pecl-redis<\/p>\n<p>Enable Redis service to start on boot<br \/>\n# systemctl enable redis-server.service<\/p>\n<p>Disable Redis service from start on boot<br \/>\n# systemctl disable redis-server.service<\/p>\n<p>Start\/Stop\/Restart Redis<br \/>\n# systemctl start redis-server.service<br \/>\n# systemctl stop redis-server.service<br \/>\n# systemctl restart redis-server.service<\/p>\n<p>Check if Redis is Running<br \/>\n#systemctl is-active redis-server.service<\/p>\n<p>How To Install Redis on Centos 6.5<br \/>\n# wget http:\/\/dl.fedoraproject.org\/pub\/epel\/6\/x86_64\/epel-release-6-8.noarch.rpm<br \/>\n# wget http:\/\/rpms.famillecollet.com\/enterprise\/remi-release-6.rpm<br \/>\n# rpm -Uvh remi-release-6*.rpm epel-release-6*.rpm<br \/>\n# yum install redis php-pecl-redis<br \/>\n# service redis start<br \/>\n# chkconfig redis on<\/p>\n<p>Now verify its set to start at boot<br \/>\n# chkconfig \u2013list redis<br \/>\nredis 0:off 1:off 2:on 3:on 4:on 5:on 6:off<\/p>\n<p>Install EPEL repo<\/p>\n<p>First we will install the EPEL repo. For more detail on EPEL repo, we suggest you to read our this post.<\/p>\n<p>Because our system has x86_64 Operating System architecture, we will use only epel repo package for x86_64 . Search epel repo package as per your Operating System architecture(EPEL URL)<\/p>\n<p>wget -r &#8211;no-parent -A &#8216;epel-release-*.rpm&#8217; http:\/\/dl.fedoraproject.org\/pub\/epel\/7\/x86_64\/e\/<\/p>\n<p>rpm -Uvh dl.fedoraproject.org\/pub\/epel\/7\/x86_64\/e\/epel-release-*.rpm<br \/>\nIt will create two epel\u2019s repo file inside \/etc\/yum.repos.d<br \/>\nThese are \u2013<br \/>\n1. epel.repo<br \/>\n2.epel-testing.repo<\/p>\n<p>[root@localhost ~]# ls -l \/etc\/yum.repos.d\/<br \/>\ntotal 28<br \/>\n-rw-r&#8211;r&#8211;. 1 root root 1612 Jul  4 07:00 CentOS-Base.repo<br \/>\n-rw-r&#8211;r&#8211;. 1 root root  640 Jul  4 07:00 CentOS-Debuginfo.repo<br \/>\n-rw-r&#8211;r&#8211;. 1 root root 1331 Jul  4 07:00 CentOS-Sources.repo<br \/>\n-rw-r&#8211;r&#8211;. 1 root root  156 Jul  4 07:00 CentOS-Vault.repo<br \/>\n-rw-r&#8211;r&#8211;. 1 root root  957 Sep  2 12:14 epel.repo<br \/>\n-rw-r&#8211;r&#8211;. 1 root root 1056 Sep  2 12:14 epel-testing.repo<br \/>\n[root@localhost ~]#<br \/>\nInstall redis server<\/p>\n<p>Now use yum command to install redis server<\/p>\n<p>yum install redis<br \/>\nTwo important redis server configuration file\u2019s path<br \/>\n1. \/etc\/redis.conf<br \/>\n2. \/etc\/redis-sentinel.conf<\/p>\n<p>Now start the redis server after this.<\/p>\n<p>systemctl start redis.service<br \/>\nCheck the running status of redis server<\/p>\n<p>systemctl status redis.service<br \/>\nTo test the installation of Redis, use below given command<\/p>\n<p>redis-cli ping<br \/>\nIf the response output is PONG, it means installation is completed successfully.<\/p>\n<p>[root@localhost ~]# redis-cli ping<br \/>\nPONG<br \/>\n[root@localhost ~]#<br \/>\nStart\/Stop\/Restart\/Status and Enable redis server<\/p>\n<p>To start redis server<\/p>\n<p>systemctl start redis.service<br \/>\nTo stop redis server<\/p>\n<p>systemctl stop redis.service<br \/>\nTo restart redis server<\/p>\n<p>systemctl restart redis.service<br \/>\nTo get running status of redis server<\/p>\n<p>systemctl status redis.service<br \/>\nTo enable redis server at system\u2019s booting time.<\/p>\n<p>systemctl enable redis.service<br \/>\nTo disable redis server at system\u2019s booting time.<\/p>\n<p>systemctl disable redis.service<br \/>\nListening Port Of Redis Server<\/p>\n<p>Redis Server listens by default at port number 6379. Use below given ss command. (To learn more about ss command)<\/p>\n<p>[root@localhost ~]# ss -nlp|grep redis<br \/>\ntcp    LISTEN     0      128            127.0.0.1:6379                  *:*      users:((&#8220;redis-server&#8221;,19706,4))<br \/>\n[root@localhost ~]#<br \/>\nNote: On minimal installed CentOS 7\/ RHEL 7,you wont get netstat command. Instead of netstat command, use ss command which is by default available on system.<\/p>\n<p>[root@localhost ~]# redis-cli<br \/>\n127.0.0.1:6379><br \/>\n127.0.0.1:6379><br \/>\n127.0.0.1:6379> exit<br \/>\n[root@localhost ~]#<br \/>\nTo check help of redis-cli command.<\/p>\n<p>redis-cli &#8211;help<\/p>\n","protected":false},"excerpt":{"rendered":"<p>How to install Redis on a Centos 6.5 &#038; Centos 7.0 Server<\/p>\n<p>Redis is an open source, BSD licensed, advanced key-value store. It is often referred to as a data structure server since keys can contain strings, hashes, lists, sets and sorted sets.<\/p>\n<p>How To Install Redis on Centos 7 # wget -r \u2013no-parent -A [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/5908"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5908"}],"version-history":[{"count":2,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/5908\/revisions"}],"predecessor-version":[{"id":5910,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/5908\/revisions\/5910"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5908"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5908"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5908"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}