Skip to content

How to quickly set up a Centreon 21.04 with Vagrant

Blog How to quickly set up a Centreon 21.04 with Vagrant


As published on our blog, we are very happy to share with you the release of the latest Centreon 21.04 version. This is the third time that the Centreon team successfully released a new major version under lockdown mode. 

Before making the release generally available, we needed to test and validate the new version with all its new features and changes. We also asked for help from our community and some members agreed to test the beta packages. We’re grateful for their help! 

In order to speed up the setup of a Centreon environment for testing purposes during the QA phase, we used several solutions such as Docker containers deployed on Portainer, VMs deployed on AWS or VMs locally managed by Vagrant

In this blog post, we will show how to quickly set up Centreon 21.04 with Vagrant.

What is Vagrant?

According to the Vagrant official documentation, Vagrant is a tool for building and managing virtual machine environments in a single workflow

In other words, Vagrant is a tool that allows you to create, configure, and manage virtual machines through a CLI (Command-Line Interface). So this is a layer of software between a virtualization tool (such as VirtualBox, Docker, Hyper-V) and a VM.

Vagrant uses a concept of “boxes” which are the package format for Vagrant environments. And in order to manage these environments, Vagrant uses a Vagrantfile, a standard format for describing an environment. According to the documentation, the primary function of Vagrantfile is to describe the type of machine required for a project, and how to configure and provision these machines. 

Getting started with Vagrant


Before starting, make sure you already have a virtualization solution on your system. Here we will assume that you already have a working VirtualBox installation, otherwise please follow this documentation.


In order to install Vagrant, you can follow its official documentation here.  

Set up a project

The simplest way to start a new VM under CentOS 7 for instance (it will generate automatically a Vagrantfile that you can modify later according to your use case).

cd ~ && mkdir vagrant-centos7
cd vagrant-centos7
vagrant init centos/7
vagrant up
vagrant ssh

You are now connected, via SSH, to your newly created CentOS 7 VM!


You may have noticed that this VM does not come loaded with Centreon 21.04! Fortunately, Vagrant supports automatic provisioning that could be achieved with our script available on our GitHub repository. Don’t worry, we will provide a complete Vagrantfile below 🙂

Some useful commands

You may consult the CLI documentation to get more information. Below some useful commands that will help you to manage your VM.

Command Purpose
vagrant status Get the current status of your box/VM
vagrant halt Stop your current box/VM
vagrant up Start your current box/VM
vagrant reload Stop & restart your current box/VM
vagrant provision Run the provision
vagrant destroy Destroy your current box/VM
vagrant save Snapshot your current box/VM
vagrant restore Restore your box/VM from a snapshot
vagrant ssh Connect via SSH to your box/VM

Set up a Centreon 21.04 central on a CentOS 7 box 

By executing the following instructions, you will be able to initialize a new CentOS 7 VM with a Centreon 21.04 central server.

cd ~ && mkdir vagrant-centreon
cd vagrant-centreon

cat <<EOF > Vagrantfile
#Dynamically generated hostname
HOSTNAME = “centos7.” + ENV[“USER”] + “.” +“%Y%m%d.%H%M%S”)

#Private IP address
IP =
Vagrant.configure(“2”) do |config|

  # type of the box : CentOS 7 here = “centos/7” “private_network”, ip: “#{IP}”
  config.vm.hostname = “#{HOSTNAME}”

  # allocated resources to the VM
  config.vm.provider “virtualbox” do |vm|
   vm.check_guest_additions = false
   vm.memory = 1024
   vm.cpus = 1

  config.vm.provision “shell”,
   path: “”,
   env: {
        “ENV_CENTREON_OPERATION” => “install”,
        “ENV_CENTREON_REPO” => “stable”,
        “ENV_CENTRAL_IP” => “#{IP}”,
        “ENV_CENTREON_TOPOLOGY” => “central”,
        “ENV_CENTREON_ADMIN_PASSWD” => “centreon“,
        “ENV_MARIADB_CENTREON_PASSWD” => “centreon”,
        “ENV_WIZARD_AUTOPLAY” => “true”,


vagrant up

A few minutes later, your VM is initialized and you will be able to access to the Centreon web interface at with these credentials: admin/centreon

One Vagrantfile to rule them all

If you want to manage multiple VMs at once, you call add instructions (for managing a VM) in the same Vagrantfile as below.

ENV[“LC_ALL”] = “en_US.UTF-8”

r =
random_id = r.rand (1..1000)

repos = “stable”

#define your desired environment here
hosts = {
 “poller-1” => { :type => “poller”, :ip => “”, :cpus => 1, :mem => 256 },
 “poller-2” => { :type => “poller”, :ip => “”, :cpus => 1, :mem => 256 },
 “central” => { :type => “central”, :ip => “”, :cpus => 2, :mem => 1024 },

os = “oracle8”

Vagrant.configure(“2”) do |config|
 hosts.each_with_index do |(hostname, info), index|
  config.vm.define hostname do |instance|
     instance_id = #{os}#{hostname}#{random_id}-“ + ENV[“USER”]

     # type of the box : oracle linux 8 here = “oraclelinux/8”
     config.vm.box_url = “”

     instance.vm.hostname = #{instance_id} “private_network”, ip: #{info[:ip]}
     instance.vm.provider “virtualbox” do |vm| = #{instance_id}
       vm.memory = #{info[:mem]}
       vm.cpus = #{info[:cpus]}
     end #end of provider

     instance.vm.provision “shell”,
     path: “”,
     env: { “ENV_CENTRAL_IP” => #{info[:ip]},

            “ENV_CENTREON_TOPOLOGY” => #{info[:type]},
            “ENV_CENTREON_OPERATION” => “install”,
            “ENV_CENTREON_REPO” => #{repos},
            “ENV_CENTREON_ADMIN_PASSWD” => “centreon”,
            “ENV_MARIADB_CENTREON_PASSWD” => “centreon”,
            “ENV_WIZARD_AUTOPLAY” => “true” }
   end #end of config
 end #end of hosts

It will create several VMs that you can use for testing a distributed environment: 

  • 2 Pollers with the latest Centreon 21.04: poller-1 and poller-2
  • 1 Central with the latest Centreon 21.04: central 

You still can use the usual vagrant command to manage each VM individually like:

vagrant status
Current machine states:

poller-1                  running (virtualbox)
poller-2                  running (virtualbox)
central                   running (virtualbox)

This environment represents multiple VMs. The VMs are all listed above with their current state. For more information about a specific VM, run `vagrant status NAME`.

A few words about the environment variables in the Vagrantfile

As you can see, here the provisioning consists of executing the script exactly like you would by following the instructions available on our website. This script execution will depend on the parameters given in input. In the case of using Vagrant, we can set these parameters as environment variables for the provisioning. 

Variable Purpose Provided value

Type of operation that will be executed: install or upgrade. 

Currently only the “install” operation from scratch is supported.

ENV_CENTREON_TOPOLOGY Type of centreon server that will be installed : a central server or a poller central or poller

Centreon yum repositories that will be used for the operation : unstable, testing, stable.

If you want to test beta or unreleased packages, you can set “unstable,testing”.

ENV_CENTRAL_IP IP address of the VM, useful in the case where you want to test with a private network (for instance)

Centreon default admin user password. 

These credentials will be needed for the Web login.


MariaDB default centreon user password. 

These credentials will be used by Centreon for connecting to the MariaDB server.

ENV_WIZARD_AUTOPLAY If enabled (set to “true) the script will automatically execute the Web installation steps. true

Next step

As you can see,Vagrant allows our team to very quickly initialize a local environment. Indeed, in a few minutes, you can have an environment with a ready-to-use Centreon instance on CentOS 7 or Oracle Linux 8. For your information, for a testing purpose, we also used a RHEL8-box Vagrantfile with an automatic subscription registration mechanism. We are now working on the next step by building official Centreon boxes that we will provide directly on Vagrant Cloud. Please stay tuned!


Hung Bui is Chief Technology Officer for Centreon, leading the company’s research and development. In this role, Hung oversees technology strategy and product engineering, currently focused on innovations such as AIOps, which combines artificial intelligence, machine learning, analytics and other advanced technologies to improve IT operations. Prior to joining Centreon, Hung held a senior technology role with FastConnect, a cloud computing and performance-led company. Prior to this, he held roles in PKI and digital signature solutions with a variety of software editors. Hung holds a degree in computer science engineering from ESIEE Paris.


Facebook picto Twitter picto Twitter picto

Similar posts

Ready to see how Centreon can transform your business?

Keep informed on our latest news