- Download the Redis Compressed Package
You can download Redis directly from the official Redis website. For convenience, here's a direct link to version 6.2.14: Redis 6.2.14 download link.
On the homepage of the Redis website, click on "Download" to access the download page. If you want the latest stable version, choose the topmost "stable" option. However, for this guide, we'll use Redis 6.2.14. Scroll down to the "Older Redis Versions" section and click on "download 6.2.14" to start downloading.
- Upload the Redis Package to the Server
To upload the downloaded package to your server, you can use tools like FinalShell or Xshell. FinalShell is a free tool that allows you to drag and drop files directly onto the server, making it beginner-friendly.
- Installing Redis
Once the package is uploaded, follow these steps:
- Navigate to the directory where the Redis package is located and extract it:
tar -zxvf redis-6.2.14.tar.gz
- Move into the extracted directory:
cd redis-6.2.14
- Compile the source code using
make. This may take some time:
make
- Install Redis by specifying the installation path:
make install PREFIX=/usr/local/redis
- Verify the installation by checking the contents of the
/usr/local/redisdirectory:
ls -l /usr/local/redis/
ls -l /usr/local/redis/bin
Ensure that the bin directory contains Redis-related executable files.
- Create symbolic links to
/usr/binfor easier access:
rm -rf /usr/bin/redis-*
ln -s /usr/local/redis/bin/redis-server /usr/bin/redis-server
ln -s /usr/local/redis/bin/redis-cli /usr/bin/redis-cli
ln -s /usr/local/redis/bin/redis-benchmark /usr/bin/redis-benchmark
ln -s /usr/local/redis/bin/redis-check-rdb /usr/bin/redis-check-rdb
ln -s /usr/local/redis/bin/redis-sentinel /usr/bin/redis-sentinel
- Check the installed versions:
redis-server -v
redis-cli -v
At this point, Redis should be successfully installed.
- Configuring Redis
- Copy the
redis.conffile from the installation directory to/etcfor easier management:
cp redis-6.2.14/redis.conf /etc
- Open the configuration file with a text editor (e.g., Vim):
vim /etc/redis.conf
- Modify the following settings in the configuration file:
- Set
daemonizetoyesto allow Redis to run as a background process:
daemonize yes
- Bind Redis to specific IP addresses (if needed). By default, it binds to all network interfaces:
bind 127.0.0.1 -::1
- Specify the port Redis will listen on (default is 6379):
port 6379
- Define the number of databases:
databases 16
- Optionally, set a password for Redis access by uncommenting and modifying the
requirepassline:
requirepass your_password_here
- Start Redis with the Configuration File
Run the following command to start Redis using the specified configuraton:
redis-server /etc/redis.conf