How to install Redis 3.2 on CentOS 7
To install Redis 3.2 on CentOS 7
Redis is a flexible open-source, key value data store, used as a database, cache and message broker. Redis allows you to store a large amount of data without the limits of a relational database. In order to achieve its outstanding performance, Redis works with an in-memory dataset. Depending on your use case, you can persist it either by dumping the dataset to disk every once in a while, or by appending each command to a log. Persistence can be optionally disabled, if you just need a feature-rich, networked, in-memory cache. It is so simple to install Redis 3.2 on CentOS 7 and this article covers the ground on same process.
Installing Redis
It is very essential to install the dependency packages, before you proceed with the installation of Redis on CentOS.
[root@linuxhelp ~]# yum install wget make gcc
Loaded plugins: fastestmirror, langpacks
base | 3.6 kB 00:00
extras | 3.4 kB 00:00
updates | 3.4 kB 00:00
base/7/x86_64/primary_db | 5.7 MB 00:21
Determining fastest mirrors
* base: mirror.nbrc.ac.in
* extras: mirror.nbrc.ac.in
* updates: mirrors.nhanhoa.com
Resolving Dependencies
--> Running transaction check
---> Package gcc.x86_64 0:4.8.5-16.el7 will be installed
.
.
.
Updated:
make.x86_64 1:3.82-23.el7 wget.x86_64 0:1.14-15.el7_4.1
Dependency Updated:
glibc.x86_64 0:2.17-196.el7 glibc-common.x86_64 0:2.17-196.el7
libgcc.x86_64 0:4.8.5-16.el7 libgomp.x86_64 0:4.8.5-16.el7
Complete!
Once it is done, you shall download the Redis 3.2 installation source file by running the following command.
[root@linuxhelp ~]# wget http://download.redis.io/releases/redis-3.2.8.tar.gz
--2017-11-21 12:28:18-- http://download.redis.io/releases/redis-3.2.8.tar.gz
Resolving download.redis.io (download.redis.io)... 109.74.203.151
Connecting to download.redis.io (download.redis.io)|109.74.203.151|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1547237 (1.5M) [application/x-gzip]
Saving to: ‘ redis-3.2.8.tar.gz’
100%[======================================> ] 1,547,237 --.-K/s in 0.03s
2017-11-21 12:28:26 (42.4 MB/s) - ‘ redis-3.2.8.tar.gz’ saved [1547237/1547237]
You shall now extract the downloaded package as follows.
[root@linuxhelp ~]# tar -zxf redis-3.2.8.tar.gz
Once you are through with it, you need to move inside the extracted directory as follows.
[root@linuxhelp ~]# cd redis-3.2.8/
And also into the deps directory by using the following command.
[root@linuxhelp redis-3.2.8]# cd deps
Later you should compile your Redis
[root@linuxhelp deps]# make hiredis lua jemalloc linenoise
(cd hiredis & & make clean) > /dev/null || true
(cd linenoise & & make clean) > /dev/null || true
(cd lua & & make clean) > /dev/null || true
(cd geohash-int & & make clean) > /dev/null || true
(cd jemalloc & & [ -f Makefile ] & & make distclean) > /dev/null || true
(rm -f .make-*)
(echo " " > .make-cflags)
(echo " " > .make-ldflags)
MAKE hiredis
.
.
.
.
MAKE linenoise
cd linenoise & & make
make[1]: Entering directory `/root/redis-3.2.8/deps/linenoise'
cc -Wall -Os -g -c linenoise.c
make[1]: Leaving directory `/root/redis-3.2.8/deps/linenoise'
Also, run the following command to compile it further.
[root@linuxhelp deps]# make geohash-int
MAKE geohash-int
cd geohash-int & & make
make[1]: Entering directory `/root/redis-3.2.8/deps/geohash-int'
cc -Wall -O2 -g -c geohash.c
cc -Wall -O2 -g -c geohash_helper.c
make[1]: Leaving directory `/root/redis-3.2.8/deps/geohash-int'
Now is the time to run the make and make install command.
[root@linuxhelp redis-3.2.8]# make
cd src & & make all
make[1]: Entering directory `/root/redis-3.2.8/src'
rm -rf redis-server redis-sentinel redis-cli redis-benchmark redis-check-rdb redis-check-aof *.o *.gcda *.gcno *.gcov redis.info lcov-html
(cd ../deps & & make distclean)
make[2]: Entering directory `/root/redis-3.2.8/deps'
(cd hiredis & & make clean) > /dev/null || true
(cd linenoise & & make clean) > /dev/null || true
.
.
.
.
INSTALL redis-sentinel
CC redis-cli.o
LINK redis-cli
CC redis-benchmark.o
LINK redis-benchmark
INSTALL redis-check-rdb
CC redis-check-aof.o
LINK redis-check-aof
Hint: It' s a good idea to run ' make test' )
make[1]: Leaving directory `/root/redis-3.2.8/src'
[root@linuxhelp redis-3.2.8]# make install
cd src & & make install
make[1]: Entering directory `/root/redis-3.2.8/src'
Hint: It' s a good idea to run ' make test' )
INSTALL install
INSTALL install
INSTALL install
INSTALL install
INSTALL install
make[1]: Leaving directory `/root/redis-3.2.8/src'
And then move to the utils directory.
[root@linuxhelp redis-3.2.8]# cd utils
[root@linuxhelp utils]# ./install_server.sh
Welcome to the redis service installer
This script will help you easily set up a running redis server
Please select the redis port for this instance: [6379]
Selecting default: 6379
Please select the redis config file name [/etc/redis/6379.conf]
Selected default - /etc/redis/6379.conf
Please select the redis log file name [/var/log/redis_6379.log]
Selected default - /var/log/redis_6379.log
Please select the data directory for this instance [/var/lib/redis/6379]
Selected default - /var/lib/redis/6379
Please select the redis executable path [/usr/local/bin/redis-server]
Selected config:
Port : 6379
Config file : /etc/redis/6379.conf
Log file : /var/log/redis_6379.log
Data dir : /var/lib/redis/6379
Executable : /usr/local/bin/redis-server
Cli Executable : /usr/local/bin/redis-cli
Is this ok? Then press ENTER to go on or Ctrl-C to abort.
Copied /tmp/6379.conf => /etc/init.d/redis_6379
Installing service...
Successfully added to chkconfig!
Successfully added to runlevels 345!
Starting Redis server...
Installation successful!
Once you are through with installation you shall start and enable the redis service as follows.
[root@linuxhelp utils]# systemctl start redis_6379
[root@linuxhelp utils]# systemctl enable redis_6379
redis_6379.service is not a native service, redirecting to /sbin/chkconfig.
Executing /sbin/chkconfig redis_6379 on
The unit files have no [Install] section. They are not meant to be enabled
using systemctl.
Possible reasons for having this kind of units are:
1) A unit may be statically enabled by being symlinked from another unit' s
.wants/ or .requires/ directory.
2) A unit' s purpose may be to act as a helper for some other unit which has
a requirement dependency on it.
3) A unit may be started when needed via activation (socket, path, timer,
D-Bus, udev, scripted systemctl call, ...).
And finally, test your redis server by running the following command.
[root@linuxhelp utils]# redis-cli
127.0.0.1:6379> set test " Hugetest"
OK
127.0.0.1:6379> get test
" Hugetest"
127.0.0.1:6379>
With this, the installation of of Redis on CentOS comes to an end.
Comments ( 0 )
No comments available