Vagrant install Redis server


In this tutorial, How to use Vagrant install Redis server.

My Environment for Vagrant install Redis server

  • Host OS: Window 11
  • Vagrant version: 2.2.18
  • Vagrant provider: VirtualBox
  • Boxes Vagrant: rockylinux/8
  • Terminal/PowerShell
  • Installed VirtualBox

Vagrant directory and files will look like as below:

│   Vagrantfile
│       redis.conf

I created an “” script to install Redis Server on Rocky Linux. I use the provisioning shell of Vagrant to deploy Redis Server on Rocky Linux.

The content script is as below:


# Install Redis
sudo dnf install -y git unzip net-tools
sudo dnf module install redis -y

sudo sysctl vm.overcommit_memory=1
echo never > sudo  /sys/kernel/mm/transparent_hugepage/enabled

#Configure Redis
sudo cp /etc/redis.conf /etc/redis.conf.orig
sudo cp /vagrant/conf/redis.conf /etc/redis.conf

sudo systemctl start redis
sudo systemctl enable redis
sudo systemctl status redis

For example, the File “redis.conf” configures Redis Server as below:

protected-mode yes
port 6379
tcp-backlog 511
timeout 0
tcp-keepalive 300
daemonize no
supervised no
pidfile /var/run/
loglevel notice
logfile /var/log/redis/redis.log
databases 16
always-show-logo yes
save 900 1
save 300 10
save 60 10000
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
dbfilename dump.rdb
dir /var/lib/redis
replica-serve-stale-data yes
replica-read-only yes
repl-diskless-sync no
repl-diskless-sync-delay 5
repl-disable-tcp-nodelay no
replica-priority 100
lazyfree-lazy-eviction no
lazyfree-lazy-expire no
lazyfree-lazy-server-del no
replica-lazy-flush no
appendonly yes
appendfilename "appendonly.aof"
appendfsync everysec
no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb
aof-load-truncated yes
aof-use-rdb-preamble yes
lua-time-limit 5000
slowlog-log-slower-than 10000
slowlog-max-len 128
latency-monitor-threshold 0
notify-keyspace-events ""
hash-max-ziplist-entries 512
hash-max-ziplist-value 64
list-max-ziplist-size -2
list-compress-depth 0
set-max-intset-entries 512
zset-max-ziplist-entries 128
zset-max-ziplist-value 64
hll-sparse-max-bytes 3000
stream-node-max-bytes 4096
stream-node-max-entries 100
activerehashing yes
client-output-buffer-limit normal 0 0 0
client-output-buffer-limit replica 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60
hz 10
dynamic-hz yes
aof-rewrite-incremental-fsync yes
rdb-save-incremental-fsync yes

Create a Virtual Machine

I will navigate to my working directory. For example, the “Rocky-Redis” folder and create initialized Vagrantfile vagrant as the command below.

cd Rocky-Redis
vagrant init rockylinux/8

Configure the Virtual Machine

Edit the Vagrantfile and paste the content below

# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure("2") do |config| = "rockylinux/8"
  config.ssh.insert_key = false  

  config.vbguest.auto_update = false
  config.vm.define "redisserver" do |redisserver|
    redisserver.vm.hostname = "" "private_network", ip: "" "forwarded_port", guest: 6379, host: 6379
    redisserver.vm.provision "shell", 
     path: "C:\\MyData\\Vagrant_VMS\\Projects\\Vagrant\\Rocky-Redis\\shell\\"



Deploy Redis Server on Rocky Linux

Use the command below to create and configures guest machines according to your Vagrantfile.

vagrant up

Finally, we will connect to the Redis server.

vagrant ssh redisserver

The output terminal as below

Vagrant install Redis server


You have to use the Vagrant install Redis server on Rocky Linux. I hope will this your helpful. Thank you for reading the DevopsRoles page!


About HuuPV

My name is Huu. I love technology and especially Devops Skill such as Docker, vagrant, git so forth. I likes open-sources. so I created site to share the knowledge that I have learned. My Job: IT system administrator. Hobbies: summoners war game, gossip.
View all posts by HuuPV →

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.