REDIS INSTALLATION
The goal is to install Redis as user redis into centos 7 Environment or make a default installation into Centos 7
The first 2 steps are the same for both solution,
Step 3 is an example of custom installation made from me
Step 4 is an example of default installation
Pre-requisites
Install the following packages,
yum install tcl wget gcc make
Step 1- Downloading Redis
At the time of writing this tutorial, Redis 6.2.6 is the latest version. So to download the redis 6.2.6, open your terminal & execute the following command,
https://github.com/redis/redis/archive/7.0.4.tar.gz
Next, we will extract the downloaded tar package,
tar zxvf 7.0.4.tar.gz
Step 2- Compiling & Installing Redis
Now that we have extracted the package, we will compile & install Redis. Firstly, open the extracted folder,
cd redis-7.0.4
& then goto folder ‘deps’,
cd deps
Now, we will compile the packages by executing the following commands,
make hiredis lua jemalloc linenoise
make geohash-int
Next, we will move back to the main directory i.e. ‘redis-7.0.4’
cd ../
& will run ‘make’ & ‘make install’ commands
make
make install
Once these commands have been executed, we will move onto to installing the ‘init’ script.
Step 3- Installing init scripting custom
create a user redis
useradd -m -U -d /var/lib/redis -s /sbin/nologin redis
then setup systemctl
vi /usr/lib/systemd/system/redis_6379.service
this is my redis.conf
them start redis
systemctl enable redis_6379systemctl start redis_6379systemctl statusredis_6379RESULT OF SERVICE STATUSredis_6379.service — Redis persistent key-value database
Loaded: loaded (/usr/lib/systemd/system/redis_6379.service; enabled; vendor preset: disabled)
Active: active (running) since Wed 2022–09–14 13:14:00 EDT; 22min ago
Main PID: 31529 (redis-server)
CGroup: /system.slice/redis_6379.service
└─31529 /usr/local/bin/redis-server 0.0.0.0:6379
Step 4- Installing init scripting default
Init script will setup a redis service with port number, config file, log file & a data directory. To run run init script,
cd utils\
& run the install_server.sh script,
./install_server.sh
We will now be asked for some information regarding Redis server, as shown below.
if you get this error
This systems seems to use systemd.
Please take a look at the provided example service unit files in this directory, and adapt and install them. Sorry!
edit vi ./install_server.sh
comment it and try again !!!
#_pid_1_exe="$(readlink -f /proc/1/exe)"
#if [ "${_pid_1_exe##*/}" = systemd ]
#then
# echo "This systems seems to use systemd."
# echo "Please take a look at the provided example service unit files in this directory, and adapt and install them. Sorry!"
# exit 1
#fi```
after that, you start Redis with
service redis_6379 start
read the link below
That’s all any question let me know