Skip to main content
Vagrant configuration for Linux Machines

Vagrant configuration for Linux Machines

Vagrant is an open-source tool that helps developers create and manage virtualized development environments. It allows you to set up and configure reproducible development environments in a consistent and automated manner. Vagrant is commonly used in software development to ensure that all team members are working in the same environment, reducing the "it works on my machine" problem.

Here's how Vagrant works:

  1. Configuration File: Developers create a configuration file called a "Vagrantfile" that describes the desired environment setup. This file can specify details like the base operating system, resources (CPU, memory), networking, and provisioners.

  2. Box: Vagrant uses a "box" as a base image for the virtual machine. A box is a pre-built, minimal operating system image that can be customized according to the Vagrantfile.

  3. Commands: Developers use the Vagrant command-line interface (CLI) to interact with the virtual machine. Common commands include vagrant up (starts the virtual machine), vagrant halt (shuts it down), vagrant suspend (pauses it), and vagrant destroy (deletes it).

  4. Provisioning: Vagrant supports various provisioning tools, such as shell scripts, Ansible, Chef, and Puppet. These tools automate the configuration and installation of software within the virtual machine.

  5. Networking: Vagrant provides options to configure networking settings, such as port forwarding and private networks, to allow communication between the host machine and the virtual machine.

Benefits of using Vagrant include:

  • Isolation: Virtual machines created by Vagrant are isolated from the host system and other virtual machines. This ensures that changes made to the development environment do not affect the host system or other projects.

  • Reproducibility: Vagrant ensures that all team members are working in the same environment, reducing the likelihood of compatibility issues.

  • Automation: The process of setting up and configuring a development environment is automated through the Vagrantfile and provisioning tools.

  • Flexibility: Vagrant supports various virtualization providers, such as VirtualBox, VMware, and Hyper-V, allowing developers to choose the platform that best suits their needs.

  • Collaboration: Developers can share Vagrantfiles, making it easier to collaborate on projects with consistent environments.

Keep in mind that since my last knowledge update in September 2021, there might have been new developments or changes in the Vagrant ecosystem. It's a good idea to refer to the official Vagrant documentation or online resources for the latest information.

 

Clone the repository.

git clone https://github.com/sheikhkamranm/vagrant.git

 

Create Ubuntu Machine and run docker with docker-compose to configure ELK STACK in docker environment.

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

ENV['VAGRANT_NO_PARALLEL'] = 'yes'

Vagrant.configure(2) do |config|

  config.vm.provision "shell", path: "bootstrap.sh"

  NodeCount = 1

  (1..NodeCount).each do |i|

    config.vm.define "ubuntuvm" do |node|

      node.vm.box               = "generic/ubuntu2204"
      node.vm.box_check_update  = false
      node.vm.box_version       = "4.2.16"
      node.vm.hostname          = "ubuntuvm.example.com"

      node.vm.network "private_network", ip: "172.16.16.100"

      node.vm.provider :virtualbox do |v|
        v.name    = "ubuntuvm"
        v.memory  = 1024
        v.cpus    = 1
      end

      node.vm.provider :libvirt do |v|
        v.nested  = true
        v.memory  = 1024
        v.cpus    = 1
      end

    end

  end

end

 

Output:

ssh the system.

vagrant ssh

Update the system.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Tags

Add new comment

Restricted HTML

  • You can align images (data-align="center"), but also videos, blockquotes, and so on.
  • You can caption images (data-caption="Text"), but also videos, blockquotes, and so on.

About

With our expertise in web design and development, we craft visually appealing and user-friendly websites that deliver exceptional results.