Vagrant Managing Virtual Machines

Slides:



Advertisements
Similar presentations
SSH SSH is “Secure SHell” Secure, compressed, widely supported, fast Allows both users to get jobs done, and also allows system administrators to sleep.
Advertisements

DVG-N5402SP.
VMware vCenter Server Module 4.
Amazon EC2 Quick Start adapted from EC2_GetStarted.html.
Remote Accessing Your Home Computer Using VNC and a Dynamic DNS Name.
Red Hat Installation. Installing Red Hat Linux is the process of copying operating system files from a CD, DVD, or USB flash drive to hard disk(s) on.
Linux Operations and Administration
System Administration: Linux Track 2 Workshop June 2010 Pago Pago, American Samoa.
April WebEx Intel ® Active Management Technology (AMT) LANDesk Provisioning LANDesk Server Manager.
Course 201 – Administration, Content Inspection and SSL VPN
1 ISA Server 2004 Installation & Configuration Overview By Nicholas Quinn.
Getting Started with GIT. Basic Navigation cd means change directory cd.. moves you up a level cd dir_name moves you to the folder named dir_name A dot.
One to One instructions Installing and configuring samba on Ubuntu Linux to enable Linux to share files and documents with Windows XP.
Eucalyptus Virtual Machines Running Maven, Tomcat, and Mysql.

© 2005,2006 NeoAccel Inc. Partners Presentation SSL VPN-Plus 2.0 Quick Start Guide.
N ETWORKED & D ISTRIBUTED COMPUTING S YSTEMS L AB Programming Assignments EE323 Computer Networks.
Hands-On Virtual Computing
Sponsored by the National Science Foundation Configuration Management For Experimenters: Ansible Hands-On Sarah Edwards, GPO.
Home Media Network Hard Drive Training for Update to 2.0 By Erik Collett Revised for Firmware Update.
Model a Container Runtime environment on Your Mac with VMware AppCatalyst VMworld Fabio Rapposelli
FTP Server and FTP Commands By Nanda Ganesan, Ph.D. © Nanda Ganesan, All Rights Reserved.
The Art and Zen of Managing Nagios with Puppet Michael Merideth - VictorOps
Vagrant workflow Jul. 15, 2014.
Computer Networking From LANs to WANs: Hardware, Software, and Security Chapter 13 FTP and Telnet.
Networking in Linux. ♦ Introduction A computer network is defined as a number of systems that are connected to each other and exchange information across.
VMWare Workstation Installation. Starting Vmware Workstation Go to the start menu and start the VMware Workstation program. *Note: The following instructions.
DHP Agenda: How to Access Web Interface of the DHP-1320 on Access Point Mode How to Access Web Interface of the DHP-1320 on Router Mode How to Change.
File-zilla uploads Andre Naylor| Account Manager 15 th August 2011 TMS Reports.
Linux Services Configuration
Apache, MySQL and PHP Installation and Configuration Chapter 2 MySQL Installation and Configuration.
PAYware Transact Terminal Interface Manager
FTP COMMANDS OBJECTIVES. General overview. Introduction to FTP server. Types of FTP users. FTP commands examples. FTP commands in action (example of use).
VMWare Workstation Installation. Starting Vmware Workstation Go to the start menu and start the VMware Workstation program. *Note: The following instructions.
Quick Start Up Tool. Why the StartUp Tool? Plug-and-play installation of Ingate and SIP trunking, as simple as possible. Necessary steps:  Unpack your.
How to setup DSS V6 iSCSI Failover with XenServer using Multipath Software Version: DSS ver up55 Presentation updated: February 2011.
Basic Setup of OpenMeetings Version Three Styles for Setup Style1 : Starting from Scratch – Starting from svn check out and compiling with ant.
Chapter 7: Using Network Clients The Complete Guide To Linux System Administration.
Installing git In Linux: sudo apt-get install git In Windows: download it from run the setuphttp://git-scm.com/download/win.
1 Dr. Tom Hicks Computer Science Department Trinity University 1.
CACI Proprietary Information | Date 1 Upgrading to webMethods Product Suite Name: Semarria Rosemond Title: Systems Analyst, Lead Date: December 8,
Basic Web Design UVICELL Week 4 Templates and site management Week 4 Templates and site management.
Linux Basics Part 2. VIM Editor vi improved Installed on most Linux machines Can be a bit confusing at first... o Cheat sheets FTW Other popular editors:
bitcurator-access-webtools Quick Start Guide
ONAP on Vagrant for ONAPers
Contents Software components All users in one location:
Efficient development and deployment of Hydra projects using Vagrant
Using Vagrant to Build a Manageable and Sharable Lab Environment
ECE 544: Middlebox lab Abhigyan Sharma.
Enterprise Hybrid Cloud
Lab 1 introduction, debrief
Drupal VM and Docker4Drupal For Drupal Development Platform
Hands-On Virtualization in the Classroom
Drupal VM and Docker4Drupal as Consistent Drupal Development Platform
OPNFV Arno Installation & Validation Walk-Through
VPN-Implementation Using UBUNTU OS and OpenVPN and Hamachi in client-server environment. By Ruphin Byamungu, Kusinza United States International University-Nairobi.
Telnet/SSH Connecting to Hosts Internet Technology.
INSTALLING AND SETTING UP APACHE2 IN A LINUX ENVIRONMENT
Chapter 27: System Security
SSH SSH is “Secure SHell” Secure, compressed, widely supported, fast
Configuration Of A Pull Network.
Lecture 16B: Instructions on how to use Hadoop on Amazon Web Services
Different types of Linux installation
SUSE Linux Enterprise Desktop Administration
bitcurator-access-webtools Quick Start Guide
Lecture9: Embedded Network Operating System: cisco IOS
Designing IIS Security (IIS – Internet Information Service)
Azure Container Service
HC VMware Module
Lecture9: Embedded Network Operating System: cisco IOS
Presentation transcript:

Vagrant Managing Virtual Machines

“But it works on my machine….”

Vagrant – take back control! Build environments based on virtual machines Create a development system that matches production Share that system with development team

What is Vagrant? A wrapper around Virtual Machines VirtualBox, VMware, AWS Create standard environments using provisioning scripts Everyone works from the same base configuration Remote access to boxes Help test and debug remotely

Why use Vagrant Create new Virtual Machines (VMs) quickly Reproducibility Provision the environments with a script Portability Only need to copy the initialisation and provisioning scripts Cross Platform Linux, MacOS, Windows

Pre-Requisites VirtualBox or similar The Virtual Machine system Vagrant Download installer from www.vagrantup.com/downloads.html A Base box (Next Slide...)

Vagrant Boxes Previously built base VM images that are ready to run Create your own Use a publicly created one https://atlas.hashicorp.com/boxes/search Various flavours of Linux, Windows or MacOS

$ vagrant box add USER/BOX Vagrant Boxes (cont.) VM images are downloaded available globally to the local host system Add a box to the local repository (done automatically in the initialisation) $ vagrant box add USER/BOX

Hashicorp (makers of Vagrant) publish as basic Ubuntu Linux 12.04 box Official Boxes Hashicorp (makers of Vagrant) publish as basic Ubuntu Linux 12.04 box $ vagrant box add hashicorp/precise64

$ vagrant init hashicorp/precise64 Getting Up and Running Having found a suitable image, all it needs is to be initialised and brought up $ cd ~/wip/new_project $ vagrant init hashicorp/precise64 $ vagrant up $ vagrant ssh

$ vagrant init This will check the local repository for the image and download it if required Creates a copy of the image in your working directory Creates a Vagrantfile initialisation file in your working directory

$ vagrant up Reads the configuation from the Vagrantfile Starts the Virtual Machine Provisions the machine according to the configuration Includes copying a SSH public key for access to the VM

$ vagrant ssh Logs into the VM over SSH using the public key created during initialisation

Vagrantfile The key configuration file Describes the VM configuration and optional provisioning Written in Ruby (but simple enough to understand without detailed knowledge of Ruby)

Search Path Vagrant will climb the directory tree looking for the first Vagrantfile it can find Starts from the current directory and works up Start can be overridden with VAGRANT_CWD environment variable

Minimum Configuration # -*- mode: ruby -*- # vi: set ft=ruby : Vagrant.configure("2") do |config| config.vm.box = "bento/ubuntu-16.04" end This will use the Ubuntu 16.04 VM from the open source Bento* project in a default configuration. * Bento – a single portion carry out meal in Japanese cooking

Some Config options config.vm config.vm.box The VM to be used config.vm.hostname Sets the hostname of the box config.vm.network Configures the network (see separate slide) config.vm.provider Configures settings specific to a provider (see separate slide) config.vm.synced_folder Configures the synced folders between the host and the guest (see separate slide)

Some Config options config.vm.network Port forwarding Static IP Vagrant.configure("2") do |config| config.vm.network "forwarded_port", guest: 80, host: 8080 end Vagrant.configure("2") do |config| config.vm.network "private_network", ip: "192.168.1.1" end

Private vs Public Networks By default, networks are private (only accessible from the host machine) Use the flag "public_network" to make the guest network accessible from the LAN Vagrant.configure("2") do |config| config.vm.network "public_network", ip: "10.0.0.1" end

Some Config options config.vm.provider Allows overriding options for the Virtual Machine provider. config.vm.provider "virtualbox" do |vb| vb.memory = "2048" end

Some Config options config.vm.synced_folder By default, Vagrant shares the project directory (the one with the Vagrantfile) to the guest as /vagrant Additional folders can be shared Useful option to keep project sources on the host machine Vagrant.configure("2") do |config| # other config here config.vm.synced_folder "src/", "/srv/website" end

Provisioning Allows initial configuration of the VM Shell scripts Ansible Chef Puppet etc

When provisioning happens On first vagrant up When vagrant provision is run on an active VM When vagrant reload --provision is run

Define provisioning within the Vagrant file config.vm.provision Basic Provisioning Define provisioning within the Vagrant file config.vm.provision Vagrant.configure("2") do |config| # ... other configuration config.vm.provision "shell" do |s| s.inline = "echo hello" end

Either inline or path (path to an external script file) Shell Scripts Either inline or path (path to an external script file) config.vm.provision "shell", inline: <<-SHELL apt-get update # Create the linux directory if it does not exist if [ ! -d /home/vagrant/src/linux ] then cd /home/vagrant mkdir src cd src fi SHELL end

Shell Scripts Vagrant.configure("2") do |config| config.vm.provision "shell", path: "script.sh" end Vagrant.configure("2") do |config| config.vm.provision "shell", path: "http://host.com/script.sh" end Vagrant.configure("2") do |config|config.vm.provision "shell", inline: <<-SHELL apt-get update mkdir /home/vagrant/src SHELL end

Files Allows uploading of files from the host to the guest VM Used in conjunction with shell scripts Vagrant.configure("2") do |config| # ... other configuration config.vm.provision "file", source: "~/.gitconfig", destination: ".gitconfig" end

Sharing the VM Allows sharing of the VM to anyone (including remote sites) Three modes HTTP SSH General Any (or all) and be used at any time Requires (free) account with Hashicorp Atlas

Creates a URL that you can share with anyone Default mode HTTP Sharing Creates a URL that you can share with anyone Default mode $ vagrant share ==> default: Detecting network information for machine... default: Local machine address: 192.168.163.152 default: Local HTTP port: 4567 default: Local HTTPS port: disabled ==> default: Checking authentication and authorization... ==> default: Creating Vagrant Share session... default: Share will be at: ghastly-wombat-4051 ==> default: Your Vagrant Share is running! default: Name: ghastly-wombat-4051 ==> default: URL: http://ghastly-wombat-4051.vagrantshare.com

SSH Sharing Creates a hostname that can be used to provide remote SSH access Creates a public/private key pair. Private key is encrypted and uploaded to the Vagrant management server Public key copied to guest VM Access remotely with $ vagrant connect –ssh <hostname>

SSH Sharing (Cont.) $ vagrant share --ssh ==> default: Detecting network information for machine... default: Local machine address: 192.168.163.152 default: Local HTTP port: 4567 default: Local HTTPS port: disabled default: SSH Port: 22 ==> default: Generating new SSH key... default: Please enter a password to encrypt the key: default: Repeat the password to confirm: default: Inserting generated SSH key into machine... ==> default: Checking authentication and authorization... ==> default: Creating Vagrant Share session... default: Share will be at: itty-bitty-polar-8667 ==> default: Your Vagrant Share is running! default: Name: itty-bitty-polar-8667

vagrant halt Stops the VM cleanly vagrant destroy Removes the VM Stopping the VM vagrant halt Stops the VM cleanly vagrant destroy Removes the VM

Questions? ming@siliconbladeconsultants.com

Blatant Plug Available For: System Design Bespoke Programming Web Applications High Availability Design Weddings, Bar Mitzvahs and Baby Namings www.siliconbladeconsultants.com