Select Page

Vagrant for Development Environments

Introduction

Vagrant is a tool to automate the build and manage virtual environments in a unified workflow. The tool is easy to use, drastically reduces the virtual environment setup time, and I consider it the first step to Infrastructure as a Code for development environments.

Why Vagrant?

Vagrant is cross-platform, supports Linux, Debian, Centos, Mac OS, and Windows.

Developers, Operators, or anyone can quickly create development environments on top of virtual machine providers in a unified workflow and produce repeatable patterns or templates for different use cases. Supported providers are VirtualBox (default), VMware , libvirt (Linux kvm), AWS, Hyper-V, Docker, and custom providers.

Provisioning tools automatically install and manage the software within the virtual machines. Supported provisioning tools are File, Shell, Ansible, Puppet, Chef, CFEngine, Docker, Podman, Salt.

Vagrant is for everyone, it’s the easiest and fastest way to build a virtual environment.

Use cases

  • Development environment
  • Test/staging environment for websites and applications
  • Testbed for upgrades, patches, and configurations
  • Demos, Evaluations, and Proof of concept
  • Application prototype

Install Vagrant and VirtualBox on Ubuntu/Debian

Download the latest Vagrant and the VirtualBox packages from the official websites.

suresh@lxware:~$ wget <https://releases.hashicorp.com/vagrant/2.2.9/vagrant_2.2.9_x86_64.deb>
suresh@lxware:~$ wget <https://download.virtualbox.org/virtualbox/6.1.10/virtualbox-6.1_6.1.10-138449~Ubuntu~eoan_amd64.deb>
suresh@lxware:~$ sudo dpkg -i vagrant_2.2.9_x86_64.deb
suresh@lxware:~$ sudo dpkg -i virtualbox-6.1_6.1.10-138449~Ubuntu~eoan_amd64.deb
suresh@lxware:~$ vagrant --vesion
suresh@lxware:~$ vagrant --help

Getting Started

I am using the default provider VirtualBox as it is more easy to use and compatible. Most of the commands do not require root access. Create a directory or switch to your existing project directory. And Initialize the project directory with the Vagrant init command.

suresh@lxware:~$ mkdir first_project
suresh@lxware:~$ cd first_project
suresh@lxware:~/first_project$ vagrant init ubuntu/bionic64
suresh@lxware:~/first_project$ ls
ubuntu-bionic-18.04-cloudimg-console.log  Vagrantfile

When you run Init command for the first time it creates a Vagrantfile in the current directory . you can also use any of the vagrant boxes on vagrant cloud https://app.vagrantup.com/boxes/search or build your own box.

Vagrantfile defines the environment, it consists of configuration and provision instructions of the virtual machines. The syntax of the Vagrantfiles is Ruby, the default Vagrantfile consists of various configuration and provision options that are commented “#”. You can remove the “#” to enable the required option or start off with a new file. As you see the Vagrantfile is easier to understand, hence programming knowledge of Ruby is not required. However, please be cautious about the indentation.

suresh@lxware:~/first_project$ cat Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :

# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
  # The most common configuration options are documented and commented below.
  # For a complete reference, please see the online documentation at
  # <https://docs.vagrantup.com>.

  # Every Vagrant development environment requires a box. You can search for
  # boxes at <https://vagrantcloud.com/search>.
  config.vm.box = "ubuntu/bionic64"

  # Disable automatic box update checking. If you disable this, then
  # boxes will only be checked for updates when the user runs
  # `vagrant box outdated`. This is not recommended.
  # config.vm.box_check_update = false

  # Create a forwarded port mapping which allows access to a specific port
  # within the machine from a port on the host machine. In the example below,
  # accessing "localhost:8080" will access port 80 on the guest machine.
  # NOTE: This will enable public access to the opened port
  # config.vm.network "forwarded_port", guest: 80, host: 8080

  # Create a forwarded port mapping which allows access to a specific port
  # within the machine from a port on the host machine and only allow access
  # via 127.0.0.1 to disable public access
  # config.vm.network "forwarded_port", guest: 80, host: 8080, host_ip: "127.0.0.1"

  # Create a private network, which allows host-only access to the machine
  # using a specific IP.
  # config.vm.network "private_network", ip: "192.168.33.10"

	# Create a public network, which generally matched to bridged network.
  # Bridged networks make the machine appear as another physical device on
  # your network.
  # config.vm.network "public_network"

  # Share an additional folder to the guest VM. The first argument is
  # the path on the host to the actual folder. The second argument is
  # the path on the guest to mount the folder. And the optional third
  # argument is a set of non-required options.
  # config.vm.synced_folder "../data", "/vagrant_data"

  # Provider-specific configuration so you can fine-tune various
  # backing providers for Vagrant. These expose provider-specific options.
  # Example for VirtualBox:
  #
  # config.vm.provider "virtualbox" do |vb|
  #   # Display the VirtualBox GUI when booting the machine
  #   vb.gui = true
  #
  #   # Customize the amount of memory on the VM:
  #   vb.memory = "1024"
  # end
  #
  # View the documentation for the provider you are using for more
  # information on available options.

	# Enable provisioning with a shell script. Additional provisioners such as
  # Ansible, Chef, Docker, Puppet and Salt are also available. Please see the
  # documentation for more information about their specific syntax and use.
  # config.vm.provision "shell", inline: <<-SHELL
  #   apt-get update
  #   apt-get install -y apache2
  # SHELL
end

Simple Vagrantfile

Vagrant.configure("2") do |config|
  config.vm.box = "ubuntu/bionic64"
end

Vagrant up

When you run vagrant up for the first time it downloads the ubuntu/bionic64 box from the vagrant cloud.

suresh@lxware:~/first_project$ vagrant up

Vagrant ssh

This command establishes an ssh connection to the vagrant box you just created. /vagrant directory of the guest vm sync’s with the environment directory of the host. In my case it is /home/suresh/first_project. hence you can send or share files across the environment from the environments directory.

suresh@lxware:~/first_project$ vagrant ssh
vagrant@bionic64:~$  hostname
bionic64.localdomain
vagrant@ubuntu-bionic:~$ cd /vagrant
vagrant@ubuntu-bionic:/vagrant$ ls
Vagrantfile  ubuntu-bionic-18.04-cloudimg-console.log
vagrant@ubuntu-bionic:/vagrant$ logout
Connection to 127.0.0.1 closed.

Please try vagrant and let me know your experience. I will write more about vagrant in the coming days.

-END-

Zoho Suite for new business & freelancers

Zoho Suite for new business & freelancers
Comments

Written by Suresh Rathinam

Are you starting a new business ? Confused about where to start ? Feeling Lost among the numerous solutions available for collaboration, finance, sales & Marketing? How about integrating the data between all the softwares? Will there be  a signficant capital expediture on the on the infrastructure for the essentials?

I have one answer for all these questions Zoho.

 Zoho is a software company with 50+ Million users in 2019, builds software to solve almost all the business problems that I have known; be it collaboration, finance, sales & martketing, people & HR, IT & helpdesk, building applications,  monitoring, identity management, business workflows, support, Analytics and project management. Zoho has applications built for all these problems as SaaS and the pricing is very competitive.

The great thing about all the applications is that you can get a subscription to each of them individualy or in bundles or all in one bundle. All Zoho applications are intergrated out of the box and you can integrate external applications to Zoho using their API’s.  

 

“A product to meet every need.”

With Zoho One you can run your whole business on the cloud. 

If you are just starting your business and you may need a simple solution for  book keeping,  invoicing, online checkouts, subscriptions, email & collaboration, social media campaigns, surveys, forms, webinars and events. I picked a few solutions and I believe these are essential for a new business.

Sales & Marketing

Zoho Social is  for managing your brands in social media.  You will be able to schedule unlimited posts, monitor and create customized reports and analyze your brands performance in social media.

Zoho SalesIQ is a live chat embedded on your website, helping your visitors to get in touch with you in realtime.

Zoho Survey is for creating your own surveys. View result graphically in realtime.

Zoho Forms is for collection of data with online forms. You can manage the data with the integrated apps. 

Finance

Zoho Invoice is online invoicing software for small businesses with automatic payment reminders and receive online payments faster.

 Zoho Subscriptions is a subscription billing software with billing life cycle , automated recurring billing, manage subsciptions, send tax compliant invoices and recieve payments on time.

Zoho Checkout is for collecting payments online, comes with a customizable branded payment page and start accepting payments.

Zoho Books is a book keeping / accounting software for managing your finances , automate business workflows, and manage finances across departments.

Collaboration

 Similar to popular collaboration suites there are solutions for email with Zoho Mail, meeting with Zoho Meeting, chat with Zoho Cliq and files management with Zoho Docs. It doesn’t end here, there are few more solutions that are attractive.

Zoho Showtime is a complete training solution to deliver trainings, with polls, questions, slides, screenshare, fileshare, etc.

Zoho Backstage is a super event management solution to run conferences , meetups and product launches for unllimited users.

It’s fascinating to find end to end solutions for all business needs under the same hood. The good thing about Zoho is you can start free forever with the limited users and essential features. But still you will be able to tick off a lot of your requirements with the limited features and you can choose the subscription that meets your requirement and surprisingly all the products are not costlier like the popular ones. Please hover over the products and click to navigate to the landing page of the respective products to understand more about them and check on the pricing page for the comparison of free plans and paid per user subscriptions available monthly and yearly.

Zoho One is an All in one bundle that has about 40+ solutions in a per user subscription model.

I will try to blog about every product of zoho in detail in the coming days. Let me know which Zoho product you like the most and why?.

Related Articles

Zoho Suite for new business & freelancers

Are you starting a new business ? Confused about where to start ? Feeling Lost among the numerous solutions available for collaboration, finance, sales & Marketing? How about integrating the data between all the softwares? Will there be  a signficant capital...

Captivated to Programming

I used to be a Nerd since a child, meddling with mechanical components, spares of motors, circuits and bulbs always fascinated me. I still remeber the excitement after accidentally fixing a Radio Transistor as they were named in the 90's. Many Christmas holidays were...

Captivated to Programming

I used to be a Nerd since a child, meddling with mechanical components, spares of motors, circuits and bulbs always fascinated me. I still remeber the excitement after accidentally fixing a Radio Transistor as they were named in the 90’s. Many Christmas holidays were fun since my neigbour always invites me for fixing the decoration lights and lets me DJ his vinyl player. And he also had Computers that runs with a series of 5-1/4″ disks. I remebered playing dave, prince of persia, and pac man in his computers. That was my first introduction to computers, though at that age I didn’t understand that computers could do greater things than gaming and I got stuck to it since then. At that time computers were not so popular and were not introduced in my school then.
May be at mid school computer science was introduced in our curriculum, Those were times when computers had those big CRT monitors and were kept above the rectangular CPU, the bulky keyboard and mouse with a heavy ball. Teachers had a tough time controlling kids playing with it like marbles. I guess the first operating system we were introduced to was windows 95 and the first Programming Language we were taught was Logo – the turtle and GW BASIC. Logo has a turtle that draws as per the instructions given to them on basis of the number of steps, directions and  x & y axis. Whereas, the GW Basic was more for some simple games and business calculations. So that’s the inception of my Computer Journey.

(more…)