Redis: Install Redis into Linux
In this article I will introduce how to install a Redis into Linux and make it as a service
Download
- go to Redis website and find the download button, get its link, example link
- in Linux, run
wget <above link>
, if there is no wget command, run “yum install wget -y” first tar -xf <downloaded_folder>
unzip the downloaded folder
Install
-
cd to the folder where we put unzipped content
-
make
, to compile the executable into system- if this command fails, possibly some dependencies are missing, e.g.
yum install gcc
make distclean
and rerunmake
- if this command fails, possibly some dependencies are missing, e.g.
-
now there are some runnable programs in
/src
folder -
make install PREFIX=/opt/redis
to copy the programs from/src
folder to specified one -
now we can only run the redis program under that folder, let’s make redis command globally accessible
-
vi /etc/profile
-
export REDIS_HOME=/opt/redis export $PATH=$PATH:$REDIS_HOME/bin
- source
-
-
then go to
<redis folder>/utils
-
./install_server
-
which may encounter the issue
This system seems to use systemd. Please take a look at the provided example service unit files in this directory, and adapt and install them.
the solution can be found in this stack overflow thread
-
then the command can executed successfully, just use the default option for pop-up questions
-
Verify
To verify whether the Redis has started successfully, we can
ps -fe | grep redis
should has some recordsservice redis_6379 status
should be executable, which meansredis_6379
can be found under/etc/init.d