Skip to main content

How to use Vagrant with Virtualbox


 


Hope that you have installed vagrant and virtualbox in your computer.

Below are steps on how to use vagrant command to run linux os on virtualbox

Steps:

1. Open powershell in windows or open git bash command prompt


2. Navigate to your project folder
Eg cd c:\vms

3. Run init command to create vagrant file and configuration file
vagrant init bento/ubuntu-16.04

Note: I want to install ubuntu-16.04. So i have chose bento/ubuntu-16.04
If you want other linux flavours like centos search in https://app.vagrantup.com and replace appropriately. Eg centos/7

4. Below command will power on the virtual machine.
vagrant up

Note: For the first time this command downloads the image from Internet.

5. Once VM is on you can ssh the VM using below command
vagrant ssh

Note: By default, user is vagrant and password is vagrant. You can switch to root user using sudo su -

Comments

Popular posts from this blog

Ansible script to stop iptables

 Ansible script to stop iptables and disable during boot Step 1. [root@cluster playbooks]# pwd /root/playbooks [root@cluster playbooks]# cat hosts [webservers] 169.254.41.221 169.254.41.222 Step2. [root@cluster playbooks]# cat iptables.yml --- - name: stop ipatbles and disable   hosts: webservers   tasks:   - name: stop iptables     service: name=iptables state=stopped   - name: disbale on iptable on boot     service: name=iptables enabled=no Step3: [root@cluster playbooks]# ansible-playbook iptables.yml PLAY [stop ipatbles and disable] *********************************************** TASK [setup] ******************************************************************* ok: [169.254.41.222] ok: [169.254.41.221] ok: [localhost] TASK [stop iptables] *********************************************************** changed: [localhost] ok: [169.254.41.221] ok: [169.254.41.222] TASK [disbale on iptable on boot] *********************************...

Get information about remote hosts using Ansible

Get information about remote hosts using Ansible setup command Below command gives all the information of client hosts which includes memory, server architecture, IP adresses etc. [root@ansible mywork]# ansible all -i hosts -m setup If you need just memory information of remote node then for the above command need to add filter as shown below [root@ansible mywork]# ansible all -i hosts -m setup -a "filter=ansible_*_mb" node01 | SUCCESS => {     "ansible_facts": {         "ansible_memfree_mb": 873,         "ansible_memory_mb": {             "nocache": {                 "free": 919,                 "used": 77             },             "real": {                 "free": 873,           ...

Using ansible ping module check connectivity between two nodes

Using ansible ping module check connectivity between two nodes Once server and client machine is configured with SSH passwordless authentication and  ansible installed in server, we will verify if ansible can connect from server to client. If you have not configured refer page Login to server node and create a directory to save all the work done in one location Eg:mywork [root@ansible ~]# mkdir mywork [root@ansible ~]# cd mywork/ Create new file called "hosts" under "mywork" and add your client host name in the file as shown below. [root@ansible mywork]# cat hosts [mynodes] node01 Now is the time to check if ansible from server machine able to communicate to client node01 To check this we will use ansible module called ping. Run command as shown below. [root@ansible mywork]# ansible all -i hosts -u root -m ping node01 | SUCCESS => {     "changed": false,     "ping": "pong" }